Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feColorMatrix not working #897

Closed
Rydori opened this issue Jan 14, 2020 · 7 comments
Closed

feColorMatrix not working #897

Rydori opened this issue Jan 14, 2020 · 7 comments
Assignees
Projects

Comments

@Rydori
Copy link

Rydori commented Jan 14, 2020

I wanted to use a ColorMatrix, but rendering it just ignored the filter
The following is the interesting part out of the svg

<defs>
	<filter id="aquamarin">
		<feColorMatrix in="SourceGraphic" type="matrix" values="0.0941176470588235 0 0 0 0, 0 0.7686274509803922 0 0 0, 0 0 0.8784313725490196 0 0, 0 0 0 1 0"></feColorMatrix>
	</filter>
</defs>

<image style="overflow:visible;" width="100" height="100" xlink:href="image.png"  transform="matrix(1 0 0 1 355 0)" filter="url(#aquamarin)">
</image>
@Rydori
Copy link
Author

Rydori commented Jan 14, 2020

it seems to be a problem with the evaluation of the filter and transform, the following works in my svg (also here only the problematic code)

<defs>
	<filter id="aquamarin">
		<feColorMatrix in="SourceGraphic" type="matrix" values="0.0941176470588235 0 0 0 0, 0 0.7686274509803922 0 0 0, 0 0 0.8784313725490196 0 0, 0 0 0 1 0"></feColorMatrix>
	</filter>
</defs>
<g transform="matrix(1 0 0 1 355 0)">
<image style="overflow:visible;" width="100" height="100" xlink:href="image.png"  filter="url(#aquamarin)">
</image>
</g>

@gabelerner
Copy link
Member

can you send your whole svg w/ any images?

using your filter on a rect works for me:

<svg>
  <defs>
         <filter id="aquamarin">
		<feColorMatrix in="SourceGraphic" type="matrix" values="0.0941176470588235 0 0 0 0, 0 0.7686274509803922 0 0 0, 0 0 0.8784313725490196 0 0, 0 0 0 1 0" />
	</filter>
  </defs>
  <rect fill="gray" x="1" y="1" width="100" height="100" filter="url(#aquamarin)" />	
</svg>

image

@Rydori
Copy link
Author

Rydori commented Feb 3, 2020

the problem is only present when you apply the filter on an rect or image or whatever when the element with the filter-attribute has also a transform attribute that for example translates it.
Like I wrote in my posts above, when you move the transform to a group that surrounds the element, there is no problem at all.

@Rydori
Copy link
Author

Rydori commented Feb 3, 2020

This works:

<svg>
  <defs>
         <filter id="aquamarin">
		<feColorMatrix in="SourceGraphic" type="matrix" values="0.0941176470588235 0 0 0 0, 0 0.7686274509803922 0 0 0, 0 0 0.8784313725490196 0 0, 0 0 0 1 0" />
	</filter>
  </defs>
<g transform="matrix(1 0 0 1 355 0)">
  <rect fill="gray" x="1" y="1" width="100" height="100" filter="url(#aquamarin)" />	
</g>
</svg>

and this not:

<svg>
  <defs>
         <filter id="aquamarin">
		<feColorMatrix in="SourceGraphic" type="matrix" values="0.0941176470588235 0 0 0 0, 0 0.7686274509803922 0 0 0, 0 0 0.8784313725490196 0 0, 0 0 0 1 0" />
	</filter>
  </defs>
  <rect fill="gray" transform="matrix(1 0 0 1 355 0)" x="1" y="1" width="100" height="100" filter="url(#aquamarin)" />	
</svg>

(tested on https://canvg.github.io/canvg/demo/index.html today)

@dangreen dangreen self-assigned this Feb 3, 2020
@dangreen
Copy link
Collaborator

@Rydori Thanks for an issue.

@Rydori @gabelerner I can take it soon

@dangreen
Copy link
Collaborator

@Rydori Hi! Before release you can test fix on demo page: https://canvg.github.io/canvg/demo/index.html?url=../svgs/issue897a.svg

@dangreen
Copy link
Collaborator

@Rydori canvg@3.0.6 was released

@dangreen dangreen added this to Done in Development Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development
  
Done
Development

No branches or pull requests

3 participants