[reportlab-users] Semi-transparent gradient

Lele Gaifax lele at metapensiero.it
Mon Apr 4 13:57:37 EDT 2022


Hi Robin,

Robin Becker <robin at reportlab.com> writes:

> I think your logic would be correct, but I believe that the linearGradient
> functionality is ignoring the alpha as you suspect.
>
> 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.

If I understand correctly, I then get that it's not possible to have a
gradient that works on the alpha level. Not a great problem, I will try using
a semi-transparent image over the real one.

> I can certainly change the whole gradient using eg
>
> c._setFillAlpha(0.7)
>
> prior to calling c.linerGradient.

I tried that, and it somewhat work, but is not appropriate for my case,
because I'd like to blur only a part of the image. Anyway, will try to find an
alternative, although less elegant, approach.

Thanks a lot,
bye, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.



More information about the reportlab-users mailing list