[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    RE: [gtkmm] Creating new Pixmap?
From:       "Find All" <find_all () hotmail ! com>
Date:       2004-05-25 9:30:51
Message-ID: SEA2-F70CG9cy1fucy800067a73 () hotmail ! com
[Download RAW message or body]




>From: "Find All" <find_all@hotmail.com>
>To: dbdavis@dbd-associates.com, gtkmm-list@gnome.org
>Subject: RE: [gtkmm] Creating new Pixmap?
>Date: Tue, 25 May 2004 09:26:53 +0000
>
>
>
>
>>From: "David B. Davis" <dbdavis@dbd-associates.com>
>>Reply-To: dbdavis@dbd-associates.com
>>To: gtkmm-list@gnome.org
>>Subject: [gtkmm] Creating new Pixmap?
>>Date: Mon, 24 May 2004 14:05:09 -0500
>>
>>I've been spinning my wheels a couple days now trying to create a 
>>Gdk::Pixmap.  Most of the .create* methods take a RefPtr to a Drawable, 
>>and I cannot figure out what Drawable to pass!
>>
>>Perhaps I am not using the optimum tactics: I want to read an image file, 
>>add some simple line drawing (so I need a Drawable, I assume a Pixmap), 
>>then scale it up (presumably in a Pixbuf, not a Pixmap) before setting it 
>>into an Image.  I've had no problem reading an image file (.pgm) into a 
>>Pixbuf, scaling it and displaying in an Image, but moving from Pixbuf to 
>>Pixmap and back just isn't working for me.
>>
>>Can someone give me a hand here?
>>
>>Thanks,
>>David


Upss, what a mistake I forgot to answer ;-)



To create a pixmap :


gint winx,winy,winw,winh,wind;
Glib::RefPtr<Gdk::GC> gc_;
Glib::RefPtr<Gdk::Window> window;
Glib::RefPtr < Gdk::Colormap > colormap;
Glib::RefPtr<Gdk::Pixbuf> pixbuffer_total;
Glib::RefPtr<Gdk::Pixmap> pixmap;

window = this->get_window();
window->get_geometry (winx,winy,winw,winh,wind);

gc_ = Gdk::GC::create (window);

colormap = get_default_colormap();

pixmap=Gdk::Pixmap::create(window,winw,winh,window->get_depth());
pixmap->set_colormap(colormap);



With the appropiate pixmap, to get the image of the pixbuf to the pixmap do:

pixmap->draw_pixbuf(gc_,
		   pixbuffer_total,
		   0,0,0,0,
		   winw,
		   winh,
		   Gdk::RGB_DITHER_NONE,0,0);


For more information look at the Gdk::Pixmap and Gdk::Pixbuf class 
reference.

_________________________________________________________________
Horóscopo, tarot, numerología... Escucha lo que te dicen los astros. 
http://astrocentro.msn.es/

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic