SetPixel() public method

public SetPixel ( IntPtr hdc, int X, int Y, int crColor ) : int
hdc System.IntPtr
X int
Y int
crColor int
return int
Ejemplo n.º 1
0
        public void drawBitmap(IntPtr hdc, int X, int Y, Bitmap bmp)
        {
            Win32GDI GDI_Win32 = Win32GDI.getInstance();

            for (int y = Y; y < Y + bmp.Height; y++)
            {
                for (int x = X; x < X + bmp.Width; x++)
                {
                    int p = 0;
                    System.Drawing.Color pixel = bmp.GetPixel(x - X, y - Y);

                    if (pixel.R == 0 && pixel.G == 0 && pixel.B == 0)
                    {
                        p = 0;
                    }
                    else
                    {
                        p = 0xFFFFFF;
                    }

                    GDI_Win32.SetPixel(hdc, x, y, p);
                }
            }
        }