Accessing PixBuf pixels
- From: "Luka Napotnik" <luka napotnik gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Accessing PixBuf pixels
- Date: Thu, 18 Dec 2008 14:32:44 +0100
Hello. I have some difficulties with manipulation of pixels in the
GdkPixbuf data buffer. I use the following loop to iterate thought
each pixel:
-----------------------------------
n_channels = gdk_pixbuf_get_n_channels(pixbuf);
guchar *pixel;
guchar *data = gdk_pixbuf_get_pixels(pixbuf);
for (i = 0; i < width*height; i++) {
pixel = buffer + i * n_channels;
pixel[0] = 100; /* Red channel */
pixel[1] = 100; /* Green channel */
pixel[2] = 100; /* Blue channel */
pixel[3] = 100; /* Alpha channel */
}
-----------------------------------
Is this the right way to handle a RGBA buffer?
Greets,
Luka
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]