LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
Functions
Pixel Operations

Functions

void gdImageSetPixel (gdImagePtr im, int x, int y, int color)
 Sets the pixel at the specified coordinates to the given color. Replaces or blends with the background depending on the most recent call to gdImageAlphaBlending and the alpha channel value of 'color'; default is to overwrite. Tiling and line styling are also implemented here. All other gd drawing functions pass through this call, allowing for many useful effects. Overlay and multiply effects are used when gdImageAlphaBlending is passed gdEffectOverlay and gdEffectMultiply.
 
int gdImageGetPixel (gdImagePtr im, int x, int y)
 Gets the color of the pixel at the specified coordinates.
 
int gdImageGetTrueColorPixel (gdImagePtr im, int x, int y)
 Gets the truecolor value of the pixel at the specified coordinates.
 

Detailed Description

Function Documentation

◆ gdImageGetPixel()

int gdImageGetPixel ( gdImagePtr  im,
int  x,
int  y 
)

Gets the color of the pixel at the specified coordinates.

Parameters
imThe image.
xThe x-coordinate of the pixel.
yThe y-coordinate of the pixel.
Returns
The color of the pixel. For palette images, this is the palette index. For truecolor images, this is the truecolor value.

◆ gdImageGetTrueColorPixel()

int gdImageGetTrueColorPixel ( gdImagePtr  im,
int  x,
int  y 
)

Gets the truecolor value of the pixel at the specified coordinates.

Parameters
imThe image.
xThe x-coordinate of the pixel.
yThe y-coordinate of the pixel.
Returns
The truecolor value of the pixel. For palette images, this function will return the truecolor value corresponding to the palette index of the pixel.

◆ gdImageSetPixel()

void gdImageSetPixel ( gdImagePtr  im,
int  x,
int  y,
int  color 
)

Sets the pixel at the specified coordinates to the given color. Replaces or blends with the background depending on the most recent call to gdImageAlphaBlending and the alpha channel value of 'color'; default is to overwrite. Tiling and line styling are also implemented here. All other gd drawing functions pass through this call, allowing for many useful effects. Overlay and multiply effects are used when gdImageAlphaBlending is passed gdEffectOverlay and gdEffectMultiply.

Parameters
imThe image.
xThe x-coordinate of the pixel.
yThe y-coordinate of the pixel.
colorThe color to set the pixel to. Color can be a palette index for palette images or a truecolor value for truecolor images.
See also
gdImageGetPixel gdImageGetTrueColorPixel gdImageAlphaBlending gdImageCreateTruecolor gdImageCreatePalette