Re: Displaying a scaled pixmap
- From: Michael J M Thomson <mjmt internode on net>
- To: TheLonelyStar <nabble lonely-star org>
- Cc: gtkmm-list gnome org
- Subject: Re: Displaying a scaled pixmap
- Date: Fri, 23 Mar 2007 22:05:52 +1100
TheLonelyStar wrote:
Hello dear community,
I draw a pixmap on a Gtk::DrawingArea using render_to_drawable.
What I have not found out is how to scale the pixmap while drawing!
Any hints?
Thanks!
nathan
Cairo's perfect for that...
#include <gdk/gdkcairo.h>
...
// create a Cairo context that outputs to drawingarea's window
cairo_t* cairo = gdk_cairo_create(
drawingarea.get_window()->gobj());
// note above needs GdkWindow* from RefPtr<Gdk::Window>, hence gobj()
gdk_cairo_set_source_pixmap(cairo,
pixmap->gobj(), // function needs GdkPixmap*
0, 0);
cairo_scale(cairo, 2.0, 2.0);
cairo_rectangle(cairo, 0, 0, pixmap->get_width(), pixmap->get_height());
cairo_fill(cairo);
cairo_destroy(cairo);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]