Hi there,

Can I extract arbitrary rectangular section out of an XIMage using `imlib_create_image_from_ximage()' ? I guess I can, but I was unable too so far.

I just fetched Imlib2 1.2.1.009 from CVS (this part of code is pretty stable since its original inclusion in october 2000 anyway), and I wonder if the `__imlib_GrabXImageToRGBA()' function is working as expected when it comes to extracting arbitrary rectangular sections out of an XImage: it seems the x and y parameters (12th and 13th) are just plainly ignored when positive (just look at the first few lines setting inx and iny), leading to always grep subimages at (0, 0) in the original image, since ox = oy = 0 when calling from `imlib_create_image_from_ximage()' ...

Am I misunderstanding how it is used here? The code for copying from source to destination looks like (I took out the 32 bits, non-bgr unmasked case since it is easy to read):

for (y = 0; y < h; y++)
{
   src = (DATA32 *) (xim->data + (xim->bytes_per_line * y));
   ptr = data + ((y + iny) * ow) + inx;

   for (x = 0; x < w; x++)
   {
      *ptr++ = 0xff000000 | ((*src) & 0x00ffffff);
      src++;
   }
}

When I would have expected something like:

for (y = 0; y < h; y++)
{
   src = (DATA32 *) (xim->data + (xim->bytes_per_line * (y + iny)) +
                     sizeof(DATA32) * inx);
   ptr = data + (y * w);

   for (x = 0; x < w; x++)
   {
      *ptr++ = 0xff000000 | ((*src) & 0x00ffffff);
      src++;
   }
}

with (inx, iny) being the coordinates of the subimage we want to grab from
the xim XImage. Thanks in advance for your pointers on this! Yours,

--
Sylvain Fourmanoit <[EMAIL PROTECTED]>

No wonder Clairol makes so much money selling shampoo.
Lather, Rinse, Repeat is an infinite loop!


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to