Re: Zooming in GtkDrawingArea



gao chaowei wrote:

> I hope i get help here. I put a message several days ago, untill now i
> have not seen response. I feel worry because my supervisor ...
> My Program:
>
> GtkDrawingArea darea; 

Allocate pixmap (on configure event, for example).

>
> draw_arc(....);
> ... 

Draw pixmap.

>
> Finally a tree is displayed(maybe large).
>
> My question is:
>
> How can i zoom in or zoom out what i have drawing in an efficient way.
> If other way can achieve this goal. Anybody have idea? Wait for your
> help!! 

Zoom is possible via pixbuf. Make pixbuf from pixmap
(gdk_pixbuf_get_from_drawable() function).
Scale pixbuf to another pixbuf with a preffered size
(gdk_pixbuf_scale*() functions).
Draw scaled pixbuf to drawable you like (drawing area window on expose
event, or
another pixmap).

"gtk-doc/gdk/gdk-drawing-primitives.html"
"gtk-doc/gdk/gdk-pixbufs.html"
"gtk-doc/gdk-pixbuf/gdk-pixbuf-scaling.html"

Olexiy





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