Problems with pixbuf



Hello dear community,

I have a class, having a pixbuf as a member:

class image
{
...
Glib::RefPtr<Gdk::Pixbuf> Pixbuf;
void LoadImage(const char* file);
...
}

Now I load the image manual:

void image::LaodImage(const char* file)
{
unsigned int *Data;
int width,height;
...
//Loads the image into Data, storing width and height
...
Pixbuf=Gdk::Pixbuf::create_from_data((const guint8*)Data,
										Gdk::COLORSPACE_RGB,
										true,
										8,
										width,
										height,
										width*4);
}

And finally a draw the pixbuf on a drawing area:

Pixbuf->render_to_drawable(drawingarea->get_window(),drawingarea->get_style()->get_black_gc(),0,0,x,y,Pixbuf->get_width(),pixbuf->get_height(),Gdk::RGB_DITHER_NONE,0,
0);

(This happens every expose-event of the drawing area)

The problem is, that the image does not look right! It looks as if the
memeory, where the pixbuf is placed, gets overwriten. And it get's worse
every re-draw :(

Something I am doing wrong?
Thanks!
Nathan
-- 
View this message in context: http://www.nabble.com/Problems-with-pixbuf-tf3369114.html#a9374163
Sent from the Gtkmm mailing list archive at Nabble.com.




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