Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-09-2005, 03:08 PM   #1
LQ Newbie
Registered: Feb 2005
Posts: 1

Rep: Reputation: 0
decoding X cursors

Hi. I'm trying to decode X cursors by myself. I have a little trouble with colorizing. Can I ask you what's wrong ?

Original cursor:
My decoded cursor:

Here is a decoding function, it decodes one scan line from 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?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom cursors lukeleia3 Linux - Software 3 02-18-2005 07:11 PM
Default X Cursors Hockney Twang Linux - General 0 06-19-2004 12:10 PM
How do I use my new cursors? NonSumPisces Linux - Newbie 1 05-30-2004 04:18 AM
new cursors Grimsdyke Linux - Software 1 08-17-2003 10:42 AM
kde cursors philfighter Linux - General 0 08-21-2001 05:16 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration