-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
[RTM] Implement effects #10
Conversation
src/Effects.php
Outdated
|
||
if ($gamma <= 0) { | ||
throw new InvalidArgumentException(sprintf( | ||
'Invalid gamma correction value %s, must be a positive float or interger', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: interger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking!
Fixed in 72a3839
src/Effects.php
Outdated
|
||
if ($deviation <= 0) { | ||
throw new InvalidArgumentException(sprintf( | ||
'Invalid sigma %s, must be a positive float or interger', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: interger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 72a3839
50432ec
to
2f9cf47
Compare
This would be against the reproducible builds philosophy. Can we fix that by a deterministic algorithm? |
We could create a hash over the whole SVG, but that would result in the same hash if two SVGs have the exact same contents which could result in duplicate IDs. But this case may be very unlikely. Do you think we should switch to the hash? |
That's exactly the thing. Imho it would be correct to create exactly the same twice. It's the very same image so it should result in the same output. I mean, for thumbnails that doesn't really make sense because I guess nobody would apply other logic to it like selecting an ID using JS. But it's a general purpose library, it doesn't have to generate thumbnails and I think in that case it would make sense to always create the same output. |
Done in bfd29db. |
Looks like PHP is blocking AppVeyor downloads or something? |
I think so too, we should probably switch to a different source for the downloads. See symfony/symfony@51b82f5#diff-180360612c6b8c4ed830919bbb4dd459L20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! LGTM.
Some notes about why certain things are implemented this way: - Direct CSS filters like `filter: blur(1)` are not supported in SVG context in some browsers, so we have to use the `<filter>` element. - Working around that by using `url()` with a data URI doesn’t work everywhere either. - To avoid duplicate IDs we generate them with a hash of the SVG itself. - Multiple values for the `filter` attribute are not supported in some browsers, so we are using multiple elements in `<filter>`. - `filter` attribute on the main `<svg>` element is not supported in IE/Edge, this is why we are using a `<g>` wrapper.
Followup to #9
Implements all effects from the
Effects
interface.Some notes about why certain things are implemented this way:
filter: blur(1)
are not supported in SVG context in some browsers, so we have to use the<filter>
element.url()
with a data URI doesn’t work everywhere either.filter
attribute on the main<svg>
element is not supported in IE/Edge, this is why we are using a<g>
wrapper.filter
attribute are not supported in some browsers, so we are using multiple elements in<filter>
.some random bytesa hash of the SVG itself.