Layering multiple transparent images Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Jan 05, 2005 6:49 pm

Layering multiple transparent images

Post by ionstream » Sat Jul 29, 2006 6:55 pm

I'm trying to make an animation program, which requires "onion skinning." The animation is composed of layers, and when onion skinning is enabled, the previous 3 frame are shown on top of eachother, transparently, so that the artist can compare the current frame to the previous frames.

At first I was thinking each layer should be a wxBitmap, but there is no function that will blit a wxBitmap to a DC with a certain opacity. My next thought was to compute the transparency myself, and then write the pixel data directly to the wxDC. Unfortunately, you can't write pixel data directly to a DC (unless you use DrawPoint, super-slow), you need to create a wxBitmap and then blit it. This is very slow.

Does anyone have any suggestions on doing this, maybe some kind of overlay drawing? Thanks for your help.

User avatar
Posts: 15065
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax » Sat Jul 29, 2006 7:27 pm

1) use OpenGL

2) before blitting the bitmaps, use raw bitmaps access (see "image" sample) to set the alpha chanel of that bitmap yourself. Depending on the size of your images, this should be reasonably fast.

3) use something like
Use the source, Luke!

Post Reply