[reportlab-users] RGBA Colors

Robin Becker robin at reportlab.com
Wed Dec 2 05:20:14 EST 2009

Kevin D Smith wrote:

> I think I tripped across an issue with using alphas. I was drawing a box with borders (each component done with rect(...)). The background had an alpha set using an RGBA color, but the borders had an alpha value of 1. For whatever reason, the background and the top, right, and bottom borders came out with the alpha. The left border came out completely opaque. I'm not sure why just the left border came out opaque. I drew the objects in the order: background, left, top, right, bottom. In order to get the behavior I wanted, I had to save the state before drawing the background, then restore it afterward. This seems to be an issue with the alpha implementation even without the patch since I was setting the alpha explicitly for each of the components and it still happened.


> I've attached the test PDF that I created. The code is part of a much larger program so it would be tricky to separate it out, but I could probably work up a test case if needed.



Not exactly sure what's going on with your code. Presumably there are 5
rectangles with different fill colours set so the first has alpha=0.5 and the
next four fills are black with alpha=1. I'll try and get to this later today.
Robin Becker

More information about the reportlab-users mailing list