Decoding X-cursors (konqueror-like)

Ksquirrel sf.net ksquirrel at tut.by
Wed Feb 9 17:35:01 CET 2005


Hi. I'm trying to decode X cursors by myself. I have a little trouble 
with colorizing. Konqueror can do it, so can I ask you what's wrong ?

Original cursor: http://www.gamedev.ru/images/?id=3599, 
My decoded cursor: http://www.gamedev.ru/images/?id=3598

Here is a decoding function, it decodes one scan line form file, file 
pointer is already been set to correct file offset:

...
struct RGB
{
    unsigned char r, g, b;
};

struct RGBA
{
    unsigned char r, g, b, a;
};

...

int fmt_read_scanline(fmt_info *finfo, RGBA *scan)
{
     RGB rgb;
     unsigned char a;

     for(int i = 0;i < WIDTH_OF_CURSOR;i++)
     {
         fread(&a, sizeof(unsigned char), 1, fptr);
         fread(&rgb, sizeof(RGB), 1, fptr);

         memcpy(scan+i, &rgb, sizeof(RGB));
         (scan+i)->a = a;
     }

     return SQERR_OK;
}

First I read alpha channel byte, as it said in X11/Xcursor/Xcursor.h, 
then - RGB triplet. But my cursor looks bad.

Whats wrong?
Thanks.

Regards, Krasu.
 
 
---
Новый Siemens MC60 - лучшая цена в Минске!
http://ultraprice.by/product3571.html


More information about the konq-e mailing list