-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Image<TPixel> comes with an indexer so you do not need to create a new array. You are also not using tha alpha component of the Rgba32 struct so you might as well save another 25% memory by ignoring it and using the Rgb24 struct instead.
Could be:
public static void UpdateCanvasAsImageSharp(this LedMatrix matrix, Action<IImageProcessingContext<Rgb24>> method)
{
matrix.UpdateCanvas(canvas =>
{
using (Image<Rgb24> img = new Image<Rgb24>(canvas.Width, canvas.Height))
{
img.Mutate(method);
for (int x = 0; x < canvas.Width; x++)
{
for (int y = 0; y < canvas.Height; y++)
{
Rgb24 rgb = img[x,y];
canvas.SetPixel(x, y, rgb.R, rgb.G, rgb.B);
}
}
}
});
}Metadata
Metadata
Assignees
Labels
No labels