Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unable to darken an image using a matrix with negative values via feColorMatrix #1111

Closed
@tm93112

Description

@tm93112

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>

darker

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp