https://issues.apache.org/bugzilla/show_bug.cgi?id=46721

           Summary: Bug in SVGFeOffsetElementBridge when using
                    primitiveUnits="objectBoundingBox" -- Wrong Translation
           Product: Batik
           Version: 1.8
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: major
          Priority: P2
         Component: GVT Filters
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Hello,

Line 106 of SVGFeOffsetElementBridge states:

        float dx = convertNumber(filterElement, SVG_DX_ATTRIBUTE, 0, ctx);
        float dy = convertNumber(filterElement, SVG_DY_ATTRIBUTE, 0, ctx);
>       AffineTransform at = AffineTransform.getTranslateInstance(dx, dy);


However, this sets an offset filter in userSpace coordinates, not in
objectBoundingBox units.

The translation should take into account the object bounding box (as required
by spec http://www.w3.org/TR/SVG/filters.html#feOffsetElement),
which is available in 
  filteredElement.geometryBounds 
in this method.

I suggest in case of objectBoundingBox units to rather set:

>       AffineTransform at = AffineTransform.getTranslateInstance(
          dx * filteredElement.geometryBounds.getWidth() , 
          dy * filteredElement.geometryBounds.getHeight() );

Being new to Batik, I don't master all the implications, so decide what's best!

Congrats for Batik, this great piece of work!

-----------------------------------------

Test case:

Apply the following filter to any <svg>


  <defs>
        <filter id="CenteringFilter" filterUnits="objectBoundingBox"
primitiveUnits="objectBoundingBox" x="-0.5" y="-0.5" width="1.5" height="1.5">
                <feOffset in="SourceGraphic" dx="-0.5" dy="-0.5" /> <!-- FIXME
dx & dy !!! -->
        </filter>
  </defs>


-----------------------------------------

Note: this works fine with Adove Viewer but not with Batik.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to