[reportlab-users] painting an image over another

Michele Simionato michele.simionato at gmail.com
Fri Feb 4 01:57:33 EST 2005


Just subscribed and I already have a question!

I have two big full page images like these:

Image 1:

+---------------+
|               |
| ############# |
| ############# |
|               |
|               |
|               |
|               |
+---------------+

Image 2:

+---------------+
|               |
|               |
|               |
|               |
| @@@@@@@@@@@@@ |
| @@@@@@@@@@@@@ |
|               |
+---------------+

I want to draw Image 2 over Image 1 and to 
get as final result:

Image 3:

+---------------+
|               |
| ############  |
| ############  |
|               |
| @@@@@@@@@@@@@ |
| @@@@@@@@@@@@@ |
|               |
+---------------+

However Image 2 is completely overriding Image 1 and I get
as result Image 2. I looked at the source code for Canvas.drawImage
and I have found a promising mask attribute. If if can tell  to
the Canvas that the white part of Image 2 has to be treated as
transparent, I am done. But how do I do that?
Should I set the mask on Image 1 or Image 2
or both, and how?
 
Thanks for your help, 

       Michele Simionato


More information about the reportlab-users mailing list