Re: [GTKMM] Standalone pixmap



On Wed, 2004-12-29 at 13:57 +0000, Chris Vine wrote:
> On Wednesday 29 December 2004 12:55, Mateusz 'vArDo' Bilinski wrote:
> > Rob Benton wrote:
> > > Passing a Gdk::Drawable into the Gdk::Pixmap::create() method does not
> > > associate it or anything like that.  All it does is set the Pixmap's
> > > depth to that of the Gdk::Drawable you passed in.
> > >
> > > If I'm wrong someone please correct me.  I looked at the Gtk
> > > "gdk_pixmap_new()" function for this info.
> >
> > Thanks for anwsering.
> >
> > I think you're right. I've checked this once again. I misunderstood it
> > because I thought I've checked it once and for example I couldn't create
> > a pixmap with size for 10x20 and had to create a pixmap using get_width
> > (), get_height() methods. But it was probably very late ;/.
> >
> > But from what I read if I set my own depth (diffrent from -1) I don't
> > have to give any Gdk::Drawable. The question is how to do it?
> 
> The first argument is of type const Glib::RefPtr<Gdk::Drawable>&.  You can 
> have an null (empty) Glib::RefPtr<>.  Thus:
> 
>   Glib::RefPtr<Gdk::Drawable> drawable;
> 
> Will provide an empty Glib::RefPtr

If we are talking about 
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGdk_1_1Pixbuf.html#e0

Gdk::Pixbuf::create(const Glib::RefPtr<Drawable>& src, const
Glib::RefPtr<Colormap>& cmap, int src_x, int src_y, int dest_x, int
dest_y, int width, int height)

well I think that uses gdk_pixbuf_get_from_drawable(), and the drawable
parameter of that can not be null.

You should never have to provide a null RefPtr, so please try to provide
a patch to add extra API if it really seems to be necessary/possible.

>  with a reference count of 0,

The reference count of a null RefPtr is meaningless.

>  for which the 
> test (drawable) will yield false, and !drawable will yield true.
> 
> Try passing a first argument of Glib::RefPtr<Gdk::Drawable>() to the 
> Gdk::Pixmap::create() function.  It is legal c++.  Whether you can pass no 
> object and get the result you want is another matter - try it and see.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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