Exemplo n.º 1
0
        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());
            }
        }
Exemplo n.º 2
0
 public static uint Encode(this ColorFormat colorFormat, OutputPixel outputPixel)
 {
     return(colorFormat.Encode(outputPixel.R, outputPixel.G, outputPixel.B, outputPixel.A));
 }
Exemplo n.º 3
0
 /// <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));
 }
Exemplo n.º 4
0
 public static uint Encode(this Color Color, ColorFormat Format)
 {
     return(Format.Encode(Color.R, Color.G, Color.B, Color.A));
 }