[LIBART] Libart images look broken
- From: Samuel Abels <newsgroups debain org>
- To: libart gnome org
- Subject: [LIBART] Libart images look broken
- Date: Wed, 05 Jan 2005 16:09:29 +0100
Hello,
I am implementing a canvas using libart with C++ and now when I display
an image it looks broken (many random pixels are cluttered over the
image). This is what I do:
------------------------
#define BYTES_PER_PIXEL 3
#define ROWSTRIDE (unsigned int)(rect.get_width() * BYTES_PER_PIXEL)
// Draw the path to a buffer.
art_u32 color = PCANVASLEAFPOLYGON_BORDER_COLOR;
art_u8* buffer = art_new(art_u8, rect.get_width()
* rect.get_height()
* BYTES_PER_PIXEL);
art_rgb_run_alpha(buffer,
PCANVASLEAFPOLYGON_BACKGROUND_COLOR_R,
PCANVASLEAFPOLYGON_BACKGROUND_COLOR_G,
PCANVASLEAFPOLYGON_BACKGROUND_COLOR_B,
PCANVASLEAFPOLYGON_BACKGROUND_COLOR_A,
rect.get_width() * rect.get_height());
pixbuf = Gdk::Pixbuf::create_from_data((guint8*)buffer,
Gdk::COLORSPACE_RGB,
TRUE,
8,
rect.get_width(),
rect.get_height(),
ROWSTRIDE);
pixbuf->save("bla.png", "png"); //FIXME!!!
free(rotated);
art_svp_free(path);
art_free(buffer);
------------------------
Also, when I do this often enough the application segfaults somewhere in
Gtk::Pixbuf when it is exposed.
I am probably writing into unallocated memory, only I do not know why.
Can somebody please point me to what I am doing wrong?
-Samuel
--
------------------------------------------------------
| Samuel Abels | http://www.debain.org |
| spam ad debain dod org | knipknap ad jabber dod org |
------------------------------------------------------
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]