Re: Saving the map as image



I haven't tried this but...

1. get ChamplainView (see 1 below)
2. get the stage with get_actor_stage
3. use get_pixels on the stage.
4. see 5 below.

On Sun, 2011-01-16 at 16:10 +0100, Patrick Salecker wrote:
> Am 11.01.2011 00:02, schrieb Jiří Techet:
> > On Thu, Jan 6, 2011 at 21:04, Patrick Salecker<patty9999 gmx de>  wrote:
> >> Hi everyone,
> >>
> >> I want to save the visible part of the map as an image, what is the best way
> >> to do it?
> >> I tried it by using gtk.widget.get_snapshot, but then the area of the map is
> >> blank.
> > I haven't tried it myself but something like this might work:
> >
> > 1. get ChamplainView from the GtkChamplainEmbed widget by
> > gtk_champlain_embed_get_view()
> > 2. As ChamplainView is a ClutterActor, you can create a texture from
> > it by  clutter_texture_new_from_actor()
> > 3. Get the CoglTexture from ClutterTexture by clutter_texture_get_cogl_texture()
> > 4. Get the image data by cogl_texture_get_data()
> > 5. Use GdkPixbufLoader to load the data and save it with gdk_pixbuf_save()
> >
> > I'm not sure at all this will work and I'm not sure this is the
> > easiest way either. If someone knows a better way, please let us know.
> Thanks for your idea.
> 
> It fails at 3., the ClutterTexture created with 
> clutter_texture_new_from_actor() has no CoglTexture, so get_cogl_texture 
> and get_property("cogl-texture") return None (in Python).
> 
> 
> _______________________________________________
> libchamplain-list mailing list
> libchamplain-list gnome org
> http://mail.gnome.org/mailman/listinfo/libchamplain-list
> 




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