Logo Search packages:      
Sourcecode: adesklets version File versions

void imlib_image_query_pixel_hsva ( int  x,
int  y,
float *  hue,
float *  saturation,
float *  value,
int *  alpha 
)

Parameters:
x The x coordinate of the pixel.
y The y coordinate of the pixel.
hue The returned hue channel.
saturation The returned saturation channel.
value The returned value channel.
alpha The returned alpha channel.
Gets the HSVA color of the pixel from the current image that is at the (x, y) location specified.

Definition at line 4850 of file imlib2.c.

{
   ImlibImage         *im;
   DATA32             *p;
   int                 r, g, b;

   if (!ctx)
      ctx = imlib_context_new();
   CHECK_PARAM_POINTER("imlib_image_query_pixel", "image", ctx->image);
   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))
     {
        *hue = 0;
        *saturation = 0;
        *value = 0;
        *alpha = 0;
        return;
     }
   p = im->data + (im->w * y) + x;
   r = ((*p) >> 16) & 0xff;
   g = ((*p) >> 8) & 0xff;
   b = (*p) & 0xff;
   *alpha = ((*p) >> 24) & 0xff;

   __imlib_rgb_to_hsv(r, g, b, hue, saturation, value);
}


Generated by  Doxygen 1.6.0   Back to index