// assumes 24 bits per pixel RGB public static unsafe void SetPixel(this BitmapData data, long x, long y, ColorF c) { byte *p = data.GetRGBPointer(x, y); p[2] = (byte)(c.R * 255); p[1] = (byte)(c.G * 255); p[0] = (byte)(c.B * 255); }
public static unsafe void SetPixel(this BitmapData data, long x, long y, Color c) { byte *p = data.GetRGBPointer(x, y); p[2] = c.R; p[1] = c.G; p[0] = c.B; }
// assumes 24 bits per pixel RGB public static unsafe ColorF GetPixel(this BitmapData data, long x, long y) { byte *p = data.GetRGBPointer(x, y); return(ColorF.From(Color.FromArgb(p[2], p[1], p[0]))); }