Re: Pixbuff::get_pixels() image format.

Evgeny Repekto wrote:


you need to create the pixbuf with the option has_alpha=false for 24bit rgb

static Glib::RefPtr<Pixbuf <>> create <> (Colorspace <> colorspace, bool has_alpha, int bits_per_sample, int width, int height)



For more efficiency I wished to put raw image data to the Pixbuff directly.
I have raw image data in this format:

"RGBRGBRGB..." - stirng of unsigned char, the length of the string is
(image height)x(image width)x3I guess it's famous type of image storing.

I used memcpy function to put my image to the pixbuff. I got the pointer to
the raw image data of Pixbuff by using get_pizels() method of Pixbuff.
But after I have shown the Pixbuff I saw strange image. After some time
of exploring, I got the idea, that I should put image this way

    for (unsigned int i=0; i<mPicHeight; i++)
RawPic+i*mPicWidth*3, mPicWidth*3);

What is this strange amount of information (i*4*3)? What for it?

I tried to found the image format but I could not. As it said in the
for Gdk::PixBuff

"guint8* Gdk::Pixbuf::get_pixels ()const
 Queries a pointer to the pixel data of a pixbuf.

 Returns:A pointer to the pixbuf's pixel data. Please see <xref
linkend="image-data"/> for information about how the pixel data is
stored in memory. "

What this means <xref linkend="image-data"/>?
Please, answer who knows, or has any ideas. I need to know the format for sure.
gtkmm-list mailing list
gtkmm-list gnome org

Alexander Gehlert - Intern
reply to : alexander gehlert raritan com

Raritan Zwickau
Software Development
Scheringerstrasse 1
08056 Zwickau

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