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

SetPixel() public method

Set pixel with the specified coordinates to the specified value.

The method sets all color components of the pixel to the specified value. If it is a grayscale image, then pixel's intensity is set to the specified value. If it is a color image, then pixel's R/G/B components are set to the same specified value (if an image has alpha channel, then it is set to maximum value - 255 or 65535).

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

public SetPixel ( int x, int y, byte value ) : void
x int X coordinate of the pixel to set.
y int Y coordinate of the pixel to set.
value byte Pixel value to set.
return void
        public void SetPixel( int x, int y, byte value )
        {
            SetPixel( x, y, value, value, value, 255 );
        }

Same methods

UnmanagedImage::SetPixel ( IntPoint point, Color color ) : void
UnmanagedImage::SetPixel ( int x, int y, Color color ) : 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