Problem writing pixels to GdkPixbuf data buffer
- From: Luka Napotnik <luka napotnik gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Problem writing pixels to GdkPixbuf data buffer
- Date: Tue, 15 Jul 2008 09:22:08 +0200
Hello.
I encounter a strange problem when I'm writing image data to the
GdkPixbuf data buffer.
I create an empty pixbuf and get the data buffer. Then I use:
pixel = pixbuf_data + i * n_channels
, where pixel is a pointer to the pixel, pixbuf_data is the pixbuf data
buffer, i is a counter in a for loop with a condition:
for (i = 0; i < width*height; i++)
This for loop should iterate throught all pixel in the image. The
n_channels variable is 4 because I use a RGBA pixbuf.
When I have this pixel pointer, I use pixel[0], pixel[1], pixel[2] and
pixel[3] to modify the RGBA values.
I then handle the "expose-event", create a cairo surface using the
GdkPixbuf and display the surface onto the drawing area. The problem is
when I display the pixbuf the image is shifted to the right for exacly
two pixels. Meaning the first two pixels in the upper left are two
places to the right, making the last two pixels of the row appear in the
second row. I hope you understand.
Am I making something wrong when writing data to the pixbuf? Or is there
any other explanation. Please help.
Greets,
Luka
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]