Logo Search packages:      
Sourcecode: adesklets version File versions

void imlib_image_query_pixel ( int  x,
int  y,
Imlib_Color *  color_return 
)

Parameters:
x The x coordinate of the pixel.
y The y coordinate of the pixel.
color_return The returned color.
Fills the color_return color structure with the color of the pixel in the current image that is at the (x, y) location specified.

Definition at line 4809 of file imlib2.c.

{
   ImlibImage         *im;
   DATA32             *p;

   if (!ctx)
      ctx = imlib_context_new();
   CHECK_PARAM_POINTER("imlib_image_query_pixel", "image", ctx->image);
   CHECK_PARAM_POINTER("imlib_image_query_pixel", "color_return", color_return);
   CAST_IMAGE(im, ctx->image);
   if ((!(im->data)) && (im->loader) && (im->loader->load))
      im->loader->load(im, NULL, 0, 1);
   if (!(im->data))
      return;
   if ((x < 0) || (x >= im->w) || (y < 0) || (y >= im->h))
     {
        color_return->red = 0;
        color_return->green = 0;
        color_return->blue = 0;
        color_return->alpha = 0;
        return;
     }
   p = im->data + (im->w * y) + x;
   color_return->red = ((*p) >> 16) & 0xff;
   color_return->green = ((*p) >> 8) & 0xff;
   color_return->blue = (*p) & 0xff;
   color_return->alpha = ((*p) >> 24) & 0xff;
}


Generated by  Doxygen 1.6.0   Back to index