From: Marc Heiler <ruby-forum-incoming@an...> - 2008-02-03 13:00:45
first a short explanation. I plan to use an image that shows a simple
map, i.e. a google map, or a map from a dungeon or similar. The virtual
hero group (the players) can only see a limited area, either because the
map is so large, or because it is dark inside a cave etc...
For this to simulate, I would like to select a small circle of the map.
Upon keyevents (this part is easy) the circle moves.
So far so good, but I was looking at
I am not entirely sure, is there a way to select circular areas?
copy_area for example speaks only about "Copies a rectangular area from
source pixbuf(self) to dest_pixbuf. " but I would need a circular area.
If anyone has an idea , I would be glad to hear about it!
Posted via http://www.ruby-forum.com/.
Am Sonntag, den 03.02.2008, 14:00 +0100 schrieb Marc Heiler:
> I am not entirely sure, is there a way to select circular areas?
> copy_area for example speaks only about "Copies a rectangular area from
> source pixbuf(self) to dest_pixbuf. " but I would need a circular area.
no, Gdk::Pixbuf has nothing like this. A way to go is to use
Gdk::Drawable. There you can copy a rectangulare area into a drawable,
and render this under the use of a clipmask of an Gdk::GC onto an other
drawable. The clipmask you can easily be create with
Gdk::Drawable.draw_arc. This is a quite easy and very fast way, but has
no alpha blending for the edges of the cliping area.
An other way is to use ruby cairo. Here
http://cairographics.org/samples/clip_image/ you will find exactly what