Drawing antialiased shapes with alpha transparency



Hello,

I am trying to draw a polygon with anti-aliasing to a Gdk::Pixmap.
Currently, I use Gtk::Drawable::draw_polygon(), but it does not seem to
support this. Are there any Gtk/Gdk widgets that support drawing
anti-aliased shapes?

In the second step, I am trying to copy the shape from the resulting
pixmap to a Gtk::DrawingArea without overwriting the boundary box. So
the pixmap needs to support Alpha transparency, because otherwise the
anti-aliasing would be destroyed.
I tried this:

1. Initialize the pixmap by drawing a rectangle at the size of the
pixmap with Gtk::Drawable::draw_rectangle(), with the Gdk::GC set using
Gdk::GC::set_function(Gdk::CLEAR).

2. Draw the shape on that pixmap.

3. Copy the pixmap to a Gtk::DrawingArea using
Gtk::Drawable::draw_drawable() the same Gdk::GC.

This does copy the shape, but it also fills the boundary box with black.
Is there a way to copy /only/ the *set* pixels and thus, preserve the
transparency?

The reason for this is that I am creating a Canvas drawing all kinds of
shapes and I want to cache some shapes in a Pixmap, which is a member of
the Component (Composite Pattern).

Any hints/documentation pointers appreciated.

-Samuel
-- 
 ------------------------------------------------------
|      Samuel Abels       |   http://www.debain.org    |
| spam ad debain dod org  | knipknap ad jabber dod org |
 ------------------------------------------------------



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