- Notifications
You must be signed in to change notification settings - Fork619
Closed
Description
Using the following svg as an example, you can see that the image is not rendered darker.
<svg> <defs> <filter><feColorMatrix in="SourceGraphic" type="matrix" values="1.14 0 0 -0.7325 0, 0 1.14 0 -0.7325 0, 0 0 1.14 -0.7325 0, 0 0 0 1 0" /></filter> </defs> <rect fill="gray" x="1" y="1" width="100" height="100" filter="url(#darken)" /></svg>
It appears the ternary in this function is the reason:
function m(matrix: number[],i: number,v: number) {const mi = matrix[i];return mi * (mi < 0 ? v - 255 : v);}
If this is changed to
function m(matrix: number[],i: number,v: number) {const mi = matrix[i];return mi * v;}
then the darkness is applied appropriately.
Perhaps there's a reason for this ternary that I'm not aware of from my limited use with canvg that I just can't see?
Metadata
Metadata
Assignees
Labels
No labels