[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Access image in a GdkPixmap



> 
Thanks Sven for the solution.

> 
> Yep, that's exactly right. Be warned though: it is *really, really, slow*.
>:-)
> 
Not a problem in my case, it's for printing purpose.

However, I still have a problem with the value return by 
gdk_image_get. This is a part of my code :

    GdkImage* image;
    guint32 valPixel;
    guchar row[3*tailleY];

    ...

    gdk_window_get_size(pixmap, &tailleX, &tailleY);
    
    image = gdk_image_get(pixmap, 0,0, tailleX, tailleY);

    for(i=0 ; i <tailleX; i++)
    {
        for(j=0 ; j <tailleY; j++)
        {
            valPixel = gdk_image_get_pixel(image, j,i);
            row[j*3+0] = (guchar)((valPixel << 8) >>24);
            row[j*3+1] = (guchar)((valPixel <<16) >>24);
            row[j*3+2] = (guchar)((valPixel <<24) >>24);
            printf("%u : %d %d %d\n", valPixel, row[j*3+0], row[j*3+1], row[j*3+2]);
        }
}

When I execute this function, I get something like :
65535: 0 255 255
for a white pixel

I was thinking that the return value represent a RGB color. But in my 
case, only 16bits seems to be used...

Any idea ?

David



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]