Skip to content

Commit 0fa3921

Browse files
Add all IPixel interface methods.
1 parent 961bbf4 commit 0fa3921

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

src/ImageSharp/Advanced/AotCompilerTools.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ private static void Seed<TPixel>()
8282
where TPixel : unmanaged, IPixel<TPixel>
8383
{
8484
// This is we actually call all the individual methods you need to seed.
85+
AotPixelInterface<TPixel>();
8586
AotCompileOctreeQuantizer<TPixel>();
8687
AotCompileWuQuantizer<TPixel>();
8788
AotCompilePaletteQuantizer<TPixel>();
@@ -95,6 +96,30 @@ private static void Seed<TPixel>()
9596
// TODO: Do the discovery work to figure out what works and what doesn't.
9697
}
9798

99+
private static void AotPixelInterface<TPixel>()
100+
where TPixel : unmanaged, IPixel<TPixel>
101+
{
102+
TPixel pixel = default;
103+
Rgba32 rgba32 = default;
104+
pixel.ToRgba32(ref rgba32);
105+
pixel.FromRgba32(rgba32);
106+
pixel.FromScaledVector4(pixel.ToScaledVector4());
107+
pixel.FromVector4(pixel.ToVector4());
108+
109+
pixel.FromArgb32(default);
110+
pixel.FromBgr24(default);
111+
pixel.FromBgra32(default);
112+
pixel.FromBgra5551(default);
113+
pixel.FromL16(default);
114+
pixel.FromL8(default);
115+
pixel.FromLa16(default);
116+
pixel.FromLa32(default);
117+
pixel.FromRgb24(default);
118+
pixel.FromRgb48(default);
119+
pixel.FromRgba64(default);
120+
pixel.FromRgb24(default);
121+
}
122+
98123
/// <summary>
99124
/// This method doesn't actually do anything but serves an important purpose...
100125
/// If you are running ImageSharp on iOS and try to call SaveAsGif, it will throw an exception:
@@ -107,7 +132,7 @@ private static void Seed<TPixel>()
107132
/// </summary>
108133
/// <typeparam name="TPixel">The pixel format.</typeparam>
109134
private static void AotCompileOctreeQuantizer<TPixel>()
110-
where TPixel : unmanaged, IPixel<TPixel>
135+
where TPixel : unmanaged, IPixel<TPixel>
111136
{
112137
using var test = new OctreeQuantizer<TPixel>(Configuration.Default, new OctreeQuantizer().Options);
113138
var frame = new ImageFrame<TPixel>(Configuration.Default, 1, 1);

0 commit comments

Comments
 (0)