[reportlab-users] Semi-transparent gradient
Robin Becker
robin at reportlab.com
Mon Apr 4 09:11:46 EDT 2022
Hi Lele,
I think your logic would be correct, but I believe that the linearGradient functionality is ignoring the alpha as you
suspect.
I did not have any great part in the pdf canvas gradient code. However, I think the problem is in the color definitions
we are using that are derived from the input colours. I think that is done in canvas._normalizeColor which seems only to
care about the rgb values.
I seem to recall tha pdf transparency is supposed to apply to objects rather than colours.
I can certainly change the whole gradient using eg
c._setFillAlpha(0.7)
prior to calling c.linerGradient.
On 04/04/2022 12:48, Lele Gaifax wrote:
> Hi all,
>
> I need to put some text on top of an image, and to make sure it's readable I'm
> drawing a rectangle filled with a semi-transparent color (say,
> rgba(250,250,250,0.6)) and then writing the text over that.
>
...........
--
Robin Becker
More information about the reportlab-users
mailing list