public void SetPixel(int x, int y, OutputPixel color) { if (!IsValidPosition(x, y)) { return; } //var Position = PixelFormatDecoder.GetPixelsSize(GuPixelFormat, Y * Width + X); var position = GetOffset(x, y); var value = ColorFormat.Encode(color); switch (BitsPerPixel) { case 16: *(ushort *)(Address + position) = (ushort)value; break; case 32: *(uint *)(Address + position) = value; break; default: throw(new NotImplementedException()); } }
public static uint Encode(this ColorFormat colorFormat, OutputPixel outputPixel) { return(colorFormat.Encode(outputPixel.R, outputPixel.G, outputPixel.B, outputPixel.A)); }
/// <summary> /// /// </summary> /// <param name="color"></param> /// <param name="format"></param> /// <returns></returns> public static uint Encode(this Color color, ColorFormat format) { return(format.Encode(color.R, color.G, color.B, color.A)); }
public static uint Encode(this Color Color, ColorFormat Format) { return(Format.Encode(Color.R, Color.G, Color.B, Color.A)); }