GdkPixbuf pixel data weirdness
- From: "Chris Garrett" <garrett91 hotmail com>
- To: gtk-app-devel-list gnome org
- Subject: GdkPixbuf pixel data weirdness
- Date: Sun, 09 Mar 2003 21:31:38 +0000
Hi,
I hope that someone can help me with this one. I am trying to draw into a
gdkpixbuf pixel by pixel, in a solid color, with a black border around the
edge (one pixel wide). I thought it was working until a few days ago, when
I changed the size of the pixbuf and things went pearshaped. When the width
of the pixbuf is a multiple of 4, it works (20, 24, 28...). With any other
width, its as though I have offset the data somehow - the pixbuf appears
striped and the border comes in diagonally.
Here are the code snippets:
First, I create the pixbuf:
colorpixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
FALSE, 8, BUTTONSIZE, BUTTONSIZE);
Then, on an expose event, I draw the pixbuf:
pos=gdk_pixbuf_get_pixels(colorpixbuf);
for (y=0; y<BUTTONSIZE; y++) {
for (x=0; x<BUTTONSIZE; x++) {
if (x == 0 || y == 0 ||
x == BUTTONSIZE-1 || y == BUTTONSIZE-1 ) {
*pos++ = 0;
*pos++ = 0;
*pos++ = 0;
}
else {
*pos++ = red;
*pos++ = green;
*pos++ = blue;
}
}
}
The pixbuf is on a drawingarea, and is rendered to it after the above bit of
code.
Has anyone got any ideas, because I cant see what is going wrong here!
Best regards,
Chris.
_________________________________________________________________
Surf together with new Shared Browsing
http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]