At this time, there is nothing in Maui itself that would be relevant to your goal.
First option is to use SkiaSharp in a way that gives higher performance manipulation of individual pixels.
Second option is to use a c# byte array.
Regardless of the approach you use, its important to measure how slow it is to move to/from the array, vs how slow individual pixel writing is.
I'll assume that you have tested writing HUNDREDS of pixels (with a single decode/encode), and compared how long that took to writing NO pixels (just decoding the image, then returning it to a format you can display.)
For example, encoding to jpeg takes a significant amount of time. Be sure to measure time, to find out whether SetPixel is the problem, or something else in the process.
ALSO, be aware that any of these solutions will likely be quite slow, if a debugger is attached. Consider "Debug menu / Run without debugger", to get a better feel for how long it will take in the final app.
Likewise, test on an actual device, not an emulator. Unless you have a very fast pc running the emulator.
Approach 1: SkColor pixel array
// --- NOT TESTED ---
// Given "SKBitmap bitmap", extract pixels.
SkiaSharp.SKColor[] pixels = bitmap.Pixels;
// manipulate individual pixels.
SKColor color = MyGetPixel(pixels, 12, 34, bitmap);
var newcolor = new SKColor(255,128, 0);
MySetPixel(newcolor, pixels, 12, 34, bitmap);
...
// write pixels back to bitmap.
bitmap.Pixels = pixels;
// --- helper methods. ---
SKColor MyGetPixel(SKColor[] pixels, int x, int y, SKBitmap bitmap)
{
return pixels[y * bitmap.Width + x];
}
void MySetPixel(SKColor color, SKColor[] pixels, int x, int y, SKBitmap bitmap)
{
pixels[y * bitmap.Width + x] = color;
}
Approach 2: byte array
For high performance, copy bitmap data to a byte[]
variable.
Look for some c# library or explanation of manipulating image data when its in a byte array. Recommending what to use is beyond scope of StackOverflow; you'll have to research.
There are some earlier SO questions such as Faster alternatives to SetPixel and GetPixel ....
Maui runs on .Net; any c# solution should be relevant.