AForge.Imaging.UnmanagedImage.SetPixel C# (CSharp) Method

SetPixel() public method

Set pixel with the specified coordinates to the specified color.

For images having 16 bpp per color plane, the method extends the specified color value to 16 bit by multiplying it by 256.

For grayscale images this method will calculate intensity value based on the below formula: 0.2125 * Red + 0.7154 * Green + 0.0721 * Blue

public SetPixel ( int x, int y, Color color ) : void
x int X coordinate of the pixel to set.
y int Y coordinate of the pixel to set.
color Color Color to set for the pixel.
return void
        public void SetPixel( int x, int y, Color color )
        {
            SetPixel( x, y, color.R, color.G, color.B, color.A );
        }

Same methods

UnmanagedImage::SetPixel ( IntPoint point, Color color ) : void
UnmanagedImage::SetPixel ( int x, int y, byte value ) : void
UnmanagedImage::SetPixel ( int x, int y, byte r, byte g, byte b, byte a ) : void

Usage Example

Beispiel #1
0
 public void dessinePoint(IntPoint point, UnmanagedImage img,int nbPixel,Color col)
 {
     for (int i = point.X - nbPixel / 2; i < point.X + nbPixel / 2 + 1; i++)
     {
         for (int j = point.Y - nbPixel / 2; j < point.Y + nbPixel / 2 + 1; j++)
         {
             img.SetPixel(i, j, col);
         }
     }
 }
All Usage Examples Of AForge.Imaging.UnmanagedImage::SetPixel