GdPicture image identifier.
Value that specifies the x-coordinate (column) of the pixel.
Value that specifies the y-coordinate (row) of the pixel.
The color to apply, as Color object. A suitable color value can be obtained by using the ARGB() method.
Example





In This Topic

PixelSetColor Method (GdPictureImaging)

In This Topic
Sets the color of a specified pixel in a GdPicture image.
Syntax
'Declaration

 

Public Function PixelSetColor( _

   ByVal ImageID As Integer, _

   ByVal DstLeft As Integer, _

   ByVal DstTop As Integer, _

   ByVal PixelColor As GdPictureColor _

) As GdPictureStatus
public GdPictureStatus PixelSetColor( 

   int ImageID,

   int DstLeft,

   int DstTop,

   GdPictureColor PixelColor

)
public function PixelSetColor( 

    ImageID: Integer;

    DstLeft: Integer;

    DstTop: Integer;

    PixelColor: GdPictureColor

): GdPictureStatus; 
public function PixelSetColor( 

   ImageID : int,

   DstLeft : int,

   DstTop : int,

   PixelColor : GdPictureColor

) : GdPictureStatus;
public: GdPictureStatus PixelSetColor( 

   int ImageID,

   int DstLeft,

   int DstTop,

   GdPictureColor PixelColor

) 
public:

GdPictureStatus PixelSetColor( 

   int ImageID,

   int DstLeft,

   int DstTop,

   GdPictureColor PixelColor

) 

Parameters

ImageID
GdPicture image identifier.
DstLeft
Value that specifies the x-coordinate (column) of the pixel.
DstTop
Value that specifies the y-coordinate (row) of the pixel.
PixelColor
The color to apply, as Color object. A suitable color value can be obtained by using the ARGB() method.

Return Value

A member of the GdPictureStatus enumeration.
Example
Getting the red channel histogram of a jpeg image and creating an image representing this histogram.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())

{

    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg", false);

 

    // Get the red channel histogram and the image dimensions.

    int[] histo = new int[256];

    gdpictureImaging.HistogramGetRed(imageID, ref histo);

    int count = gdpictureImaging.GetWidth(imageID) * gdpictureImaging.GetHeight(imageID);

 

    gdpictureImaging.ReleaseGdPictureImage(imageID);

 

    // Create an image representing the histogram. 

    // The image has the same width as the histogram and its height is 1000.                

    int histogramID = gdpictureImaging.CreateNewGdPictureImage(256, 1000, 24, Color.White);

    for (int i = 0; i < 256; i++)

    {

        int value = histo[i] * 1000 / count;

        for (int j = 0; j < value; j++)

        {

            gdpictureImaging.PixelSetColor(histogramID, i, j, Color.Red);

        }

    }

 

    gdpictureImaging.SaveAsPNG(histogramID, "histo.png");

    gdpictureImaging.ReleaseGdPictureImage(histogramID);

}
See Also