Re: Slightly confused with setFillGray

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
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, [email protected]
Providenza & Boekelheide, Inc.
smime.p7s (application/pkcs7-signature, 3.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.