[reportlab-users] Slightly confused with setFillGray
Tim Roberts
timr at probo.com
Wed Jan 15 15:06:03 EST 2020
Frank wrote:
>
> This is a minor point, but I want to make sure I understand it.
>
> I thought that setFillGray(0), setFillColorRGB(0, 0 ,0), and
> setFillColor(colors.black) were interchangeable.
>
> I have discovered that, if you have previously executed
> setFillColor(colors.transparent), alpha is set to 0.
>
> If you then execute any of the above commands, only
> setFillColor(colors.black) resets the alpha value. The other two do
> not, resulting in text being invisible.
>
> Am I missing something?
Nope, that's the way it works. setFillGray, setFillColorRGB,
setStrokeGray, and SetStrokeColorRGB all have an additional parameter to
specify the alpha value. If you don't supply a value, the current alpha
value is retained. "colors.black" happens to include all four components.
C:\tmp>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from reportlab.lib import colors
>>> colors.black
Color(0,0,0,1)
>>>
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20200115/9560f8e4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3389 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20200115/9560f8e4/attachment.bin>
More information about the reportlab-users
mailing list