Re: Crash when calling Gdk::Drawable::draw_pixbuf
- From: Falk Schilling <falk schilling gmx net>
- To: gtkmm-list gnome org
- Subject: Re: Crash when calling Gdk::Drawable::draw_pixbuf
- Date: Sat, 20 Jun 2009 11:48:56 +0200
Ok, I now tried to cope with Gdk::Pixmap. I now use the following code
in the constructor of my derived Gtk::Window.
m_imgcol is an object of my ImageCollection class, that contains
pointers to rdcnnsim::Image* (derivate of Gtk::Image), accessible via
the image(m,n)-method (an analog approach is used for Gdk::Pixbuf and
now Gdk::Pixmap, except that I use Glib::RefPtr<> for the members there).
for ( int i=0 ; i < static_cast<int>(RDCNNS_NUMBER); i++)
for ( int j=0; j< static_cast<int>(IMAGES_NUMBER); j++)
{
rdcnn_enum_t m = static_cast<rdcnn_enum_t>(i);
name_t n = static_cast<name_t>(j);
if ( !(m == TARGET && n == INPUT) )
{
m_refGlade->get_widget_derived(
glade_widget_names[m][n],
m_imgcol.image(m,n)
);
m_imgcol.image(m,n)->load(EMPTY_IMAGE.c_str());
m_imgcol.pixmap(m,n) =
Gdk::Pixmap::create(m_imgcol.image(m,n)->get_window(),
m_dim.get_width(),
m_dim.get_height(),
m_imgcol.image(m,n)->get_window()
->get_depth());
//m_colormap = this->get_default_colormap();
m_imgcol.pixbuf(m,n)
= m_imgcol.image(m,n)->get_pixbuf();
}
}
The problem is, that now Gdk::Pixmap::create causes the segfault. I
know, that this is a very bad solution, because I use the complete
(derived) Gtk:Image as Drawable, although I only want to modify its
Pixbuf, but that was just a try whether it works or not.
Greetings,
Falk
Falk Schilling schrieb:
> Hallo Daniel,
>
> thanks for your reply.
>
> Daniel Elstner schrieb:
>>> m_drawable = Gdk::Drawable::create();
>> That looks odd. If that create() method does indeed exist, I have no
>> idea what it would possibly do. Gdk::Drawable is an abstract base
>> class. :-)
>
> Well, that explains a few things, e.g. some missing constructor methods
> for Gdk::Drawable (compared with other classes). Since this class method
> returns a Glib::RefPtr<Gdk::Drawable> I assumed that this is the way of
> creating objects. The documentation unfortunately lacks some information
> at this point, what this is used for.
>
>>> Maybe I have somewhere overlooked something in the documentation, but I
>>> assume that this is the right way to instantiate an Gdk::Drawable object.
>> I'm surprised that it is possible at all. You want to instantiate a
>> Gdk::Pixmap, Gdk::Bitmap or Gdk::Window object, I think.
>>
>> Also, are you sure Gdk::Image is really what you want to use? This
>> stuff all maps directly to X11 primitives...
>
> Well, I don’t want to use Cairo for just drawing simple pixels. I indeed
> don’t need stuff like arcs, lines or whatever else; I want to read
> pixels out of an image, process the values and write the result into
> another image. Purely and simple pixel operations.
>
> Ok, you suggest to take Gdk::Pixmap for this stuff. Well, how do I
> convert the Gdk::Pixbuf into a Gdk::Pixmap?
>
> Greetings,
> Falk Schilling
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]