[reportlab-users] RGBA Colors

Robin Becker robin at reportlab.com
Thu Dec 3 06:54:20 EST 2009


Tim Roberts wrote:

> Kevin D Smith wrote:

>> I did wonder if it was something that I was doing. Can you clarify why this is wrong? I thought the save and restore state methods were simply there to reset the canvas state back to what it was before doing an operation.

>>

>

> I think the issue is as simple as that the FillAlpha value is NOT being

> saved and restored. It's currently just a local attribute of the canvas

> object, and so it persists. If you add it to the STATE_ATTRIBUTES list

> in canvas.py, this problem will probably go away.

>

> I haven't checked the svn version, so if this has already been done,

> then I'm all wet.

>

OK I think the extgstate save/restore state problem is fixed. There were two
problems there.

1 I forgot to put _extgstate into the state push/pop list
2 There was a problem related to how push/pop worked for the extgstate class.
I think we need to make a separate copy of the values for each stack frame, but
have the states object common.

I have checked in a possible fix to svn that seems to work Kevin's example ok,
but it may not be the final solution.

As for the colour alpha patch there are two proposals

1) use default None with that meaning don't touch canvas alpha.

2) use default 1 with that implying that canvas alpha is defunct since ordinary
colours will always override any existing canvas alpha.

In both cases the issue of what a None value on a colour alpha should mean is
meaningful. I guess logically it should do what the existing patch already does
ie avoid changing any existing value. That being the case I think I prefer
proposal 1). A harder version of two could insist that we always have to have an
alpha and could change all the defaults to 1 and insist that None is invalid.
--
Robin Becker


More information about the reportlab-users mailing list