On 13 Feb 2012, at 21:17, Prabu wrote:

> I have images A and B. Image A is 3 channel and Image B is 4 channel. I am 
> trying to display image A and then overlay image B on top of A in Fl_Window. 
> Can someone please provide me with sample code that shows how to do this or 
> point me in the right direction?

Note that fltk is a GUI library rather than an image manipulation library, so 
if you want to do anything really sophisticated (or even just a little bit 
sophisticated!) with your image compositing, then you'd certainly get better 
results using a dedicated image manipulation library, then just using fltk to 
render the final image...

That said, compositing images together is not that hard, if you just want to 
allow the "background" image to show through the alpha of the foreground image, 
so you can probably just crank that out "by hand" in a memory buffer then 
display the result.

Anyway, if your foreground image has alpha, you can probably just load the 
background image into a frame then display the alpha on top of it, fltk can 
more or less do that anyway. Take a look in the test folder, in particular at 
the pixmap_browser demo that shows basic image loading, and at the 
unittest_images demos that shows manipulation of RGBA images.

Those might be enough to get you up and running.

If you want to composite the image in memory yourself (and to be honest, I 
think I probably would if it were me...), or using some other image lib, then 
this howto might help show how to get at the image data and then display it...

http://www.fltk.org/articles.php?L468 

I think I'd probably just decompress the A image into RAM, composite the B 
image on top of it (accounting for the alpha, of course) and then dump the 
result to the display... Any good?

-- 
Ian







_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to