Re: [Inkscape-devel] The bias property for feConvolveMatrix
Erik Dahlstrom wrote:
On Wed, 08 Apr 2009 14:09:01 +0200, Jasper van de Gronde <th.v.d.gronde@...528...> wrote:
The SVG standard defines a "bias" property for feConvolveMatrix to offset the result of the filter. It specifies that this value should simply be added to the result for each channel. Implicitly the standard defines that these are premultiplied color values, however, this seems to make little sense, as the bias has very little meaning without taking the alpha channel into account.
Wouldn't the 'preserveAlpha' attribute[1] be sufficient to control this?
No, imagine that the image already has alpha=0.5, then adding a bias of 0.5 suddenly does not correspond to a transparent gray zero response, but rather a transparent white zero response.
... There should be some precedent, e.g:
- Opera 9.x
- Firefox 3.1
- ASV3
Unfortunately I don't have any of those installed, so if someone could help me test that would be great. I have attached a file that tests numerous cases using bias (and transparency), if someone could try it on his/her favourite renderer that would be great.
I have posted a patch for https://bugs.launchpad.net/inkscape/+bug/193926 The patch fixes the divisor to be calculated automatically by default.
Could you take a look at it and commit it?
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: 20 April, 2009 22:00 To: Erik Dahlstrom Cc: Inkscape Devel List Subject: Re: [Inkscape-devel] The bias property for feConvolveMatrix
Erik Dahlstrom wrote:
On Wed, 08 Apr 2009 14:09:01 +0200, Jasper van de Gronde <th.v.d.gronde@...528...> wrote:
The SVG standard defines a "bias" property for feConvolveMatrix to offset the result of the filter. It specifies that this value should simply be added to the result for each channel. Implicitly the standard defines that these are premultiplied color values, however, this seems to make little sense, as the bias has very little meaning without
taking
the alpha channel into account.
Wouldn't the 'preserveAlpha' attribute[1] be sufficient to control this?
No, imagine that the image already has alpha=0.5, then adding a bias of 0.5 suddenly does not correspond to a transparent gray zero response, but rather a transparent white zero response.
... There should be some precedent, e.g:
- Opera 9.x
- Firefox 3.1
- ASV3
Unfortunately I don't have any of those installed, so if someone could help me test that would be great. I have attached a file that tests numerous cases using bias (and transparency), if someone could try it on his/her favourite renderer that would be great.
Preben Soeberg wrote:
I have posted a patch for https://bugs.launchpad.net/inkscape/+bug/193926 The patch fixes the divisor to be calculated automatically by default.
Could you take a look at it and commit it?
I've had a look and in principle the fix to the sp-feconvolvematrix code seems fine. But:
- Could you perhaps base the fix on a more recent version? sp-feconvolvematrix.cpp no longer exists (it is now src/filters/convolvematrix.cpp).
- I have hardly any experience with the UI code, so if someone else could take a look at that part that would be great. (Otherwise, if you'll update the patch I'll just try it and commit it if it seems to work.)
Thanks for your efforts.
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: 20 April, 2009 22:54 To: Preben Soeberg Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] bugfix for divisor default (was: The bias property for feConvolveMatrix)
Preben Soeberg wrote:
I have posted a patch for
https://bugs.launchpad.net/inkscape/+bug/193926
The patch fixes the divisor to be calculated automatically by default.
Could you take a look at it and commit it?
I've had a look and in principle the fix to the sp-feconvolvematrix code seems fine. But:
- Could you perhaps base the fix on a more recent version?
sp-feconvolvematrix.cpp no longer exists (it is now src/filters/convolvematrix.cpp).
- I have hardly any experience with the UI code, so if someone else
could take a look at that part that would be great. (Otherwise, if you'll update the patch I'll just try it and commit it if it seems to work.)
Thanks for your efforts.
The patches are made on the correct and newest files, and I have tested them thoroughly.
I made a mistake, when editing in the patch (removed irrelevant changes in other files), so I have updated and posted it again.
Preben Soeberg wrote:
The patches are made on the correct and newest files, and I have tested them thoroughly.
I made a mistake, when editing in the patch (removed irrelevant changes in other files), so I have updated and posted it again.
Patch applied, thanks for your input! However, this does expose another issue. Inkscape now uses the default setting when divisor is set to zero, which is not that bad, but other renderers might consider it an error condition (as the spec says) and handle it differently. So, since Inkscape currently outputs divisor="0" when it actually "intents" to use the default values there might be discrepancies between Inkscape and other renderers (and Inkscape would in fact be "wrong").
Any ideas on how to properly resolve this would be appreciated. In my opinion the cleanest solution would be to explicitly allow setting divisor to the default in the UI (making the slider gray for example, while keeping its value in sync with the values in the kernel matrix) and reflecting this in the serialization. Setting the divisor to zero should be prevented in some way. (I have absolutely no idea how to do all this though.)
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: 21 April, 2009 21:25 To: Preben Soeberg Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] bugfix for divisor default
Preben Soeberg wrote:
The patches are made on the correct and newest files, and I have tested
them
thoroughly.
I made a mistake, when editing in the patch (removed irrelevant changes
in
other files), so I have updated and posted it again.
Patch applied, thanks for your input! However, this does expose another issue. Inkscape now uses the default setting when divisor is set to zero, which is not that bad, but other renderers might consider it an error condition (as the spec says) and handle it differently. So, since Inkscape currently outputs divisor="0" when it actually "intents" to use the default values there might be discrepancies between Inkscape and other renderers (and Inkscape would in fact be "wrong").
Any ideas on how to properly resolve this would be appreciated. In my opinion the cleanest solution would be to explicitly allow setting divisor to the default in the UI (making the slider gray for example, while keeping its value in sync with the values in the kernel matrix) and reflecting this in the serialization. Setting the divisor to zero should be prevented in some way. (I have absolutely no idea how to do all this though.)
When adding a new convolve matrix filter, it comes up correctly with no divisor attribute in the SVG data. It is when the slider is moved away from zero, the attribute appears, and then it does not disappear again, when the slider is set to zero.
The divisor is not updated correctly, when the divisor attribute is just deleted with the XML editor. Setting the divisor to zero and the deleting it works correctly.
So, if the slider has been touched, how can the divisor attribute be deleted, when the slider is set to zero again?
Thanks a lot for your work !!!
ivan
________________________________ De : Preben Soeberg <prsodk@...400...> À : Jasper van de Gronde <th.v.d.gronde@...528...> Cc : inkscape-devel@lists.sourceforge.net Envoyé le : Lundi, 20 Avril 2009, 17h18mn 12s Objet : Re: [Inkscape-devel] The bias property for feConvolveMatrix
I have posted a patch for https://bugs.launchpad.net/inkscape/+bug/193926 The patch fixes the divisor to be calculated automatically by default.
Could you take a look at it and commit it?
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: 20 April, 2009 22:00 To: Erik Dahlstrom Cc: Inkscape Devel List Subject: Re: [Inkscape-devel] The bias property for feConvolveMatrix
Erik Dahlstrom wrote:
On Wed, 08 Apr 2009 14:09:01 +0200, Jasper van de Gronde <th.v.d.gronde@...528...> wrote:
The SVG standard defines a "bias" property for feConvolveMatrix to offset the result of the filter. It specifies that this value should simply be added to the result for each channel. Implicitly the standard defines that these are premultiplied color values, however, this seems to make little sense, as the bias has very little meaning without
taking
the alpha channel into account.
Wouldn't the 'preserveAlpha' attribute[1] be sufficient to control this?
No, imagine that the image already has alpha=0.5, then adding a bias of 0.5 suddenly does not correspond to a transparent gray zero response, but rather a transparent white zero response.
... There should be some precedent, e.g:
- Opera 9.x
- Firefox 3.1
- ASV3
Unfortunately I don't have any of those installed, so if someone could help me test that would be great. I have attached a file that tests numerous cases using bias (and transparency), if someone could try it on his/her favourite renderer that would be great.
------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Jasper van de Gronde wrote:
... There should be some precedent, e.g:
- Opera 9.x
- Firefox 3.1
- ASV3
Unfortunately I don't have any of those installed, so if someone could help me test that would be great. I have attached a file that tests numerous cases using bias (and transparency), if someone could try it on his/her favourite renderer that would be great.
I'd like to repeat this plea. I just installed Firefox just to try it myself and found that it does not support the bias property... So if you have any renderer other than Batik, Inkscape, Firefox or Safari on the iPhone I would appreciate it if you could send me an image showing how it renders the attached test file.
(Note that I changed the file a bit to make it easier to spot differences in implementation.)
Remember, that if you dump a picture from a color managed application, you will get it with the display profile as workspace profile. It should be converted to sRGB to be comparable.
-----Original Message----- From: Jasper van de Gronde [mailto:th.v.d.gronde@...528...] Sent: 13 May, 2009 23:06 To: Erik Dahlstrom Cc: Inkscape Devel List Subject: Re: [Inkscape-devel] The bias property for feConvolveMatrix
Jasper van de Gronde wrote:
... There should be some precedent, e.g:
- Opera 9.x
- Firefox 3.1
- ASV3
Unfortunately I don't have any of those installed, so if someone could help me test that would be great. I have attached a file that tests numerous cases using bias (and transparency), if someone could try it on his/her favourite renderer that would be great.
I'd like to repeat this plea. I just installed Firefox just to try it myself and found that it does not support the bias property... So if you have any renderer other than Batik, Inkscape, Firefox or Safari on the iPhone I would appreciate it if you could send me an image showing how it renders the attached test file.
(Note that I changed the file a bit to make it easier to spot differences in implementation.)
participants (3)
-
Ivan Louette
-
Jasper van de Gronde
-
Preben Soeberg