You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> on 2008/01/23 19:31:53 UTC
Rendering bug with transforms?
Hello,
I've come across a pretty odd problem with Batik. I'm using the
1.7 release version. For my application, I've developed a "circle
slider" which is pretty much a Jslider that goes in a circle. I use it
to rotate elements from 0 degrees to 360 degrees. As I move the slider,
the shape on the JSVGCanvas changes. This works perfectly for circle,
ellipse, line, and rect elements. On other elements (polygon, polyline,
path, text), the element is rapidly flipped 180 degrees ONLY when the
circle slider is between 90 and 270 degrees.
So I get a smooth rotation from 0 to 90. From 90 to 270 the
element gets flipped upside-down over and over again, oscillating back
and forth. From 270 to 360 (0), I get smooth rotation again. The
reason I think it's Batik is because it doesn't occur with every element
and my application is reporting the correct number of degrees. I think
it's odd that it only happens witin that certain range. Has anyone
experienced this?
Michael Bishop
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Rendering bug with transforms?
Posted by Archie Cobbs <ar...@dellroad.org>.
Glad you got it working.
FYI here's a good explanation of using the dot product to compute angles:
http://en.wikipedia.org/wiki/Dot_product#Geometric_interpretation
On Jan 24, 2008 10:02 AM, Bishop, Michael W. CONTR J9C880 <
Michael.Bishop@je.jfcom.mil> wrote:
> Yeah, if I switch my "getRotationAngle" method with yours in my main
> application, everything works itself out. This bug's probably been in
> my code for a long time; I just never noticed it until I started
> smoothly rotating objects on the canvas as opposed to applying a single
> rotation angle.
>
> Thanks for checking that out.
>
> Michael Bishop
>
> > -----Original Message-----
> > From: archie.cobbs@gmail.com [mailto:archie.cobbs@gmail.com]
> > On Behalf Of Archie Cobbs
> > Sent: Wednesday, January 23, 2008 5:16 PM
> > To: batik-users@xmlgraphics.apache.org
> > Subject: Re: Rendering bug with transforms?
> >
> > Something is wrong with your logic that computes the angles.
> > The reason you are not seeing it with rectangles and circles
> > is because they have 180 degree rotational symmetry.
> >
> > Apply the attached patch to your code to see what the real
> > angle is you are rotating by, which bounces around during
> > part of the rotation.
> >
> > Don't know what the exact problem is but you can probably
> > figure it out from here...
> >
> > -Archie
> >
> >
> > On Jan 23, 2008 3:29 PM, Bishop, Michael W. CONTR J9C880 <
> > Michael.Bishop@je.jfcom.mil
> > <ma...@je.jfcom.mil> > wrote:
> >
> >
> > I got snapshots from the original, rotated (flipped)
> > and rotated
> > (correct) DOMs. Since the transform is in matrix form,
> > it's hard to
> > discern anything save the fact that all three are
> > different. I loaded
> > each snapshot in Squiggle; they looked the same as they do in my
> > application.
> >
> > I was able to create a test class that can showcase
> > this behavior. It's
> > not a specific SVG; it's an application that rotates a
> > rect element,
> > degree-by-degree a full 360 degrees on a JSVGCanvas
> > successfully. Then
> > it does the same with a text element and the errors
> > occur between 90 and
> > 270.
> >
> > I'll attach the class for those curious; it's a single
> > file that just
> > needs Batik on the classpath:
> > mil.jfcom.cie.whiteboard.TestElementTransform
> >
> > I guess I should also file a bug unless someone finds
> > something wrong
> > with the attached code.
> >
> >
> > Michael Bishop
> >
> > > -----Original Message-----
> > > From: archie.cobbs@gmail.com
> > <ma...@gmail.com> [mailto:archie.cobbs@gmail.com]
> > > On Behalf Of Archie Cobbs
> >
> > > Sent: Wednesday, January 23, 2008 2:52 PM
> > > To: batik-users@xmlgraphics.apache.org
> > > Subject: Re: Rendering bug with transforms?
> > >
> >
> > > I would be interesting to "snapshot" your DOM after the
> > > unexpected flip occurs then:
> > >
> > > - Save it to a file.
> > > - Verify relaunching squiggle on the file still shows
> > item flipped.
> > > - Do analysis to determine whether matrix is incorrect (your
> > > bug) or batik is mis-reading it (batik bug).
> > > - If Batik is mis-reading matrix, create Bugzilla issue
> > > containing simplified counterexample SVG file.
> > >
> > > One possibility is your computation is broken around the
> > > "corner cases" of 90 and 270 degress. Continuous reading and
> > > updating of the matrix makes these corner cases more likely
> > > to be hit.
> > >
> > >
> > > On Jan 23, 2008 1:36 PM, Bishop, Michael W. CONTR J9C880
> > > <Mi...@je.jfcom.mil> wrote:
> > >
> > >
> > > OK, the slider basically reports a degree from 0 to
> > > 359. I have a
> > > ChangeListener attached that updates the "transform"
> > > attribute of the
> > > selected element.
> > >
> > > So what essentially happens:
> > >
> > > - Retrieve the "transform" (I use the matrix only)
> > > attribute as an
> > > AffineTransform.
> > > - Revert the current rotation angle on the
> > AffineTransform.
> > > - Apply the new rotation angle to the AffineTransform.
> > > - Convert the AffineTransform to a "transform"
> > attribute.
> > > - Apply the new "transform" attribute to the
> > element on the
> > > UpdateManager.
> > >
> > > I don't think static rotation covers it. My old
> > > rotation technique was
> > > a plain JSlider that would only update the element
> > > after the change
> > > occurs. This never fails. It only seems to happen
> > > when the document is
> > > continuously updated as the slider is moving. Another
> > > interesting fact
> > > is that sometimes an element STAYS flipped;
> > when I get back to 0
> > > degrees, I see that a text element might be upside-down.
> > >
> > > If this behavior was consistant across all elements,
> > > I'd be more apt to
> > > dig through my code. It only seems to happen with
> > > certain elements.
> > > Maybe I can write a test case that will draw an element
> > > to a canvas,
> > > then rotate it through 360 degrees with a for loop.
> > >
> > > Michael Bishop
> > >
> > >
> > > > -----Original Message-----
> > > > From: archie.cobbs@gmail.com [mailto:
> >
> > > archie.cobbs@gmail.com <ma...@gmail.com> ]
> > > > On Behalf Of Archie Cobbs
> > > > Sent: Wednesday, January 23, 2008 1:41 PM
> > > > To: batik-users@xmlgraphics.apache.org
> > > > Subject: Re: Rendering bug with transforms?
> > > >
> > > > What is your slider actually doing?
> > > >
> > > > If it's just updating the "transform"
> > attribute of a DOM
> > > > element, in theory you should be able to
> > produce a static
> > > > document containing a polygon rotated e.g.
> > 120 degrees that
> > > > squiggle renders upside down.
> > > >
> > > > I.e., what's the simplest document or program
> > that reproduces
> > > > incorrect rendering? I'm sure something
> > obvious like an
> > > > upside down rotation would be fixed pretty quickly.
> > > >
> > > > On the other hand, it could be your logic.
> > How exactly does a
> > > > circular slider position turn into SVG attributes?
> > > >
> > > >
> > > > On Jan 23, 2008 12:31 PM, Bishop, Michael W.
> > CONTR J9C880
> > > > < Michael.Bishop@je.jfcom.mil
> > <ma...@je.jfcom.mil> > wrote:
> > > >
> > > >
> > > > Hello,
> > > > I've come across a pretty odd
> > problem with Batik.
> > > > I'm using the
> > > > 1.7 release version. For my application, I've
> > > > developed a "circle
> > > > slider" which is pretty much a Jslider
> > that goes in a
> > > > circle. I use it
> > > > to rotate elements from 0 degrees to
> > 360 degrees. As I
> > > > move the slider,
> > > > the shape on the JSVGCanvas changes. This works
> > > > perfectly for circle,
> > > > ellipse, line, and rect elements. On
> > other elements
> > > > (polygon, polyline,
> > > > path, text), the element is rapidly
> > flipped 180 degrees
> > > > ONLY when the
> > > > circle slider is between 90 and 270 degrees.
> > > > So I get a smooth rotation from 0 to 90.
> > > From 90 to 270 the
> > > > element gets flipped upside-down over
> > and over again,
> > > > oscillating back
> > > > and forth. From 270 to 360 (0), I get
> > smooth rotation
> > > > again. The
> > > > reason I think it's Batik is because it
> > doesn't occur
> > > > with every element
> > > > and my application is reporting the
> > correct number of
> > > > degrees. I think
> > > > it's odd that it only happens witin
> > that certain range.
> > > > Has anyone
> > > > experienced this?
> > > >
> > > > Michael Bishop
> > > >
> > > >
> > > >
> > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > batik-users-unsubscribe@xmlgraphics.apache.org
> >
> > > <mailto:
> > batik-users-unsubscribe@xmlgraphics.apache.org
> > <ma...@xmlgraphics.apache.org> >
> >
> > > > For additional commands, e-mail:
> > > > batik-users-help@xmlgraphics.apache.org
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Archie L. Cobbs
> > > >
> > > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > batik-users-unsubscribe@xmlgraphics.apache.org
> >
> > > <ma...@xmlgraphics.apache.org>
> >
> > > For additional commands, e-mail:
> > > batik-users-help@xmlgraphics.apache.org
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Archie L. Cobbs
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail:
> > batik-users-help@xmlgraphics.apache.org
> >
> >
> >
> >
> >
> > --
> > Archie L. Cobbs
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
--
Archie L. Cobbs
RE: Rendering bug with transforms?
Posted by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil>.
Yeah, if I switch my "getRotationAngle" method with yours in my main
application, everything works itself out. This bug's probably been in
my code for a long time; I just never noticed it until I started
smoothly rotating objects on the canvas as opposed to applying a single
rotation angle.
Thanks for checking that out.
Michael Bishop
> -----Original Message-----
> From: archie.cobbs@gmail.com [mailto:archie.cobbs@gmail.com]
> On Behalf Of Archie Cobbs
> Sent: Wednesday, January 23, 2008 5:16 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: Re: Rendering bug with transforms?
>
> Something is wrong with your logic that computes the angles.
> The reason you are not seeing it with rectangles and circles
> is because they have 180 degree rotational symmetry.
>
> Apply the attached patch to your code to see what the real
> angle is you are rotating by, which bounces around during
> part of the rotation.
>
> Don't know what the exact problem is but you can probably
> figure it out from here...
>
> -Archie
>
>
> On Jan 23, 2008 3:29 PM, Bishop, Michael W. CONTR J9C880 <
> Michael.Bishop@je.jfcom.mil
> <ma...@je.jfcom.mil> > wrote:
>
>
> I got snapshots from the original, rotated (flipped)
> and rotated
> (correct) DOMs. Since the transform is in matrix form,
> it's hard to
> discern anything save the fact that all three are
> different. I loaded
> each snapshot in Squiggle; they looked the same as they do in my
> application.
>
> I was able to create a test class that can showcase
> this behavior. It's
> not a specific SVG; it's an application that rotates a
> rect element,
> degree-by-degree a full 360 degrees on a JSVGCanvas
> successfully. Then
> it does the same with a text element and the errors
> occur between 90 and
> 270.
>
> I'll attach the class for those curious; it's a single
> file that just
> needs Batik on the classpath:
> mil.jfcom.cie.whiteboard.TestElementTransform
>
> I guess I should also file a bug unless someone finds
> something wrong
> with the attached code.
>
>
> Michael Bishop
>
> > -----Original Message-----
> > From: archie.cobbs@gmail.com
> <ma...@gmail.com> [mailto:archie.cobbs@gmail.com]
> > On Behalf Of Archie Cobbs
>
> > Sent: Wednesday, January 23, 2008 2:52 PM
> > To: batik-users@xmlgraphics.apache.org
> > Subject: Re: Rendering bug with transforms?
> >
>
> > I would be interesting to "snapshot" your DOM after the
> > unexpected flip occurs then:
> >
> > - Save it to a file.
> > - Verify relaunching squiggle on the file still shows
> item flipped.
> > - Do analysis to determine whether matrix is incorrect (your
> > bug) or batik is mis-reading it (batik bug).
> > - If Batik is mis-reading matrix, create Bugzilla issue
> > containing simplified counterexample SVG file.
> >
> > One possibility is your computation is broken around the
> > "corner cases" of 90 and 270 degress. Continuous reading and
> > updating of the matrix makes these corner cases more likely
> > to be hit.
> >
> >
> > On Jan 23, 2008 1:36 PM, Bishop, Michael W. CONTR J9C880
> > <Mi...@je.jfcom.mil> wrote:
> >
> >
> > OK, the slider basically reports a degree from 0 to
> > 359. I have a
> > ChangeListener attached that updates the "transform"
> > attribute of the
> > selected element.
> >
> > So what essentially happens:
> >
> > - Retrieve the "transform" (I use the matrix only)
> > attribute as an
> > AffineTransform.
> > - Revert the current rotation angle on the
> AffineTransform.
> > - Apply the new rotation angle to the AffineTransform.
> > - Convert the AffineTransform to a "transform"
> attribute.
> > - Apply the new "transform" attribute to the
> element on the
> > UpdateManager.
> >
> > I don't think static rotation covers it. My old
> > rotation technique was
> > a plain JSlider that would only update the element
> > after the change
> > occurs. This never fails. It only seems to happen
> > when the document is
> > continuously updated as the slider is moving. Another
> > interesting fact
> > is that sometimes an element STAYS flipped;
> when I get back to 0
> > degrees, I see that a text element might be upside-down.
> >
> > If this behavior was consistant across all elements,
> > I'd be more apt to
> > dig through my code. It only seems to happen with
> > certain elements.
> > Maybe I can write a test case that will draw an element
> > to a canvas,
> > then rotate it through 360 degrees with a for loop.
> >
> > Michael Bishop
> >
> >
> > > -----Original Message-----
> > > From: archie.cobbs@gmail.com [mailto:
>
> > archie.cobbs@gmail.com <ma...@gmail.com> ]
> > > On Behalf Of Archie Cobbs
> > > Sent: Wednesday, January 23, 2008 1:41 PM
> > > To: batik-users@xmlgraphics.apache.org
> > > Subject: Re: Rendering bug with transforms?
> > >
> > > What is your slider actually doing?
> > >
> > > If it's just updating the "transform"
> attribute of a DOM
> > > element, in theory you should be able to
> produce a static
> > > document containing a polygon rotated e.g.
> 120 degrees that
> > > squiggle renders upside down.
> > >
> > > I.e., what's the simplest document or program
> that reproduces
> > > incorrect rendering? I'm sure something
> obvious like an
> > > upside down rotation would be fixed pretty quickly.
> > >
> > > On the other hand, it could be your logic.
> How exactly does a
> > > circular slider position turn into SVG attributes?
> > >
> > >
> > > On Jan 23, 2008 12:31 PM, Bishop, Michael W.
> CONTR J9C880
> > > < Michael.Bishop@je.jfcom.mil
> <ma...@je.jfcom.mil> > wrote:
> > >
> > >
> > > Hello,
> > > I've come across a pretty odd
> problem with Batik.
> > > I'm using the
> > > 1.7 release version. For my application, I've
> > > developed a "circle
> > > slider" which is pretty much a Jslider
> that goes in a
> > > circle. I use it
> > > to rotate elements from 0 degrees to
> 360 degrees. As I
> > > move the slider,
> > > the shape on the JSVGCanvas changes. This works
> > > perfectly for circle,
> > > ellipse, line, and rect elements. On
> other elements
> > > (polygon, polyline,
> > > path, text), the element is rapidly
> flipped 180 degrees
> > > ONLY when the
> > > circle slider is between 90 and 270 degrees.
> > > So I get a smooth rotation from 0 to 90.
> > From 90 to 270 the
> > > element gets flipped upside-down over
> and over again,
> > > oscillating back
> > > and forth. From 270 to 360 (0), I get
> smooth rotation
> > > again. The
> > > reason I think it's Batik is because it
> doesn't occur
> > > with every element
> > > and my application is reporting the
> correct number of
> > > degrees. I think
> > > it's odd that it only happens witin
> that certain range.
> > > Has anyone
> > > experienced this?
> > >
> > > Michael Bishop
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > batik-users-unsubscribe@xmlgraphics.apache.org
>
> > <mailto:
> batik-users-unsubscribe@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org> >
>
> > > For additional commands, e-mail:
> > > batik-users-help@xmlgraphics.apache.org
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Archie L. Cobbs
> > >
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > batik-users-unsubscribe@xmlgraphics.apache.org
>
> > <ma...@xmlgraphics.apache.org>
>
> > For additional commands, e-mail:
> > batik-users-help@xmlgraphics.apache.org
> >
> >
> >
> >
> >
> >
> > --
> > Archie L. Cobbs
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>
>
>
>
>
> --
> Archie L. Cobbs
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Rendering bug with transforms?
Posted by Archie Cobbs <ar...@dellroad.org>.
Something is wrong with your logic that computes the angles. The reason you
are not seeing it with rectangles and circles is because they have 180
degree rotational symmetry.
Apply the attached patch to your code to see what the real angle is you are
rotating by, which bounces around during part of the rotation.
Don't know what the exact problem is but you can probably figure it out from
here...
-Archie
On Jan 23, 2008 3:29 PM, Bishop, Michael W. CONTR J9C880 <
Michael.Bishop@je.jfcom.mil> wrote:
> I got snapshots from the original, rotated (flipped) and rotated
> (correct) DOMs. Since the transform is in matrix form, it's hard to
> discern anything save the fact that all three are different. I loaded
> each snapshot in Squiggle; they looked the same as they do in my
> application.
>
> I was able to create a test class that can showcase this behavior. It's
> not a specific SVG; it's an application that rotates a rect element,
> degree-by-degree a full 360 degrees on a JSVGCanvas successfully. Then
> it does the same with a text element and the errors occur between 90 and
> 270.
>
> I'll attach the class for those curious; it's a single file that just
> needs Batik on the classpath:
> mil.jfcom.cie.whiteboard.TestElementTransform
>
> I guess I should also file a bug unless someone finds something wrong
> with the attached code.
>
> Michael Bishop
>
> > -----Original Message-----
> > From: archie.cobbs@gmail.com [mailto:archie.cobbs@gmail.com]
> > On Behalf Of Archie Cobbs
> > Sent: Wednesday, January 23, 2008 2:52 PM
> > To: batik-users@xmlgraphics.apache.org
> > Subject: Re: Rendering bug with transforms?
> >
> > I would be interesting to "snapshot" your DOM after the
> > unexpected flip occurs then:
> >
> > - Save it to a file.
> > - Verify relaunching squiggle on the file still shows item flipped.
> > - Do analysis to determine whether matrix is incorrect (your
> > bug) or batik is mis-reading it (batik bug).
> > - If Batik is mis-reading matrix, create Bugzilla issue
> > containing simplified counterexample SVG file.
> >
> > One possibility is your computation is broken around the
> > "corner cases" of 90 and 270 degress. Continuous reading and
> > updating of the matrix makes these corner cases more likely
> > to be hit.
> >
> >
> > On Jan 23, 2008 1:36 PM, Bishop, Michael W. CONTR J9C880
> > <Mi...@je.jfcom.mil> wrote:
> >
> >
> > OK, the slider basically reports a degree from 0 to
> > 359. I have a
> > ChangeListener attached that updates the "transform"
> > attribute of the
> > selected element.
> >
> > So what essentially happens:
> >
> > - Retrieve the "transform" (I use the matrix only)
> > attribute as an
> > AffineTransform.
> > - Revert the current rotation angle on the AffineTransform.
> > - Apply the new rotation angle to the AffineTransform.
> > - Convert the AffineTransform to a "transform" attribute.
> > - Apply the new "transform" attribute to the element on the
> > UpdateManager.
> >
> > I don't think static rotation covers it. My old
> > rotation technique was
> > a plain JSlider that would only update the element
> > after the change
> > occurs. This never fails. It only seems to happen
> > when the document is
> > continuously updated as the slider is moving. Another
> > interesting fact
> > is that sometimes an element STAYS flipped; when I get back to 0
> > degrees, I see that a text element might be upside-down.
> >
> > If this behavior was consistant across all elements,
> > I'd be more apt to
> > dig through my code. It only seems to happen with
> > certain elements.
> > Maybe I can write a test case that will draw an element
> > to a canvas,
> > then rotate it through 360 degrees with a for loop.
> >
> > Michael Bishop
> >
> >
> > > -----Original Message-----
> > > From: archie.cobbs@gmail.com [mailto:
> > archie.cobbs@gmail.com <ma...@gmail.com> ]
> > > On Behalf Of Archie Cobbs
> > > Sent: Wednesday, January 23, 2008 1:41 PM
> > > To: batik-users@xmlgraphics.apache.org
> > > Subject: Re: Rendering bug with transforms?
> > >
> > > What is your slider actually doing?
> > >
> > > If it's just updating the "transform" attribute of a DOM
> > > element, in theory you should be able to produce a static
> > > document containing a polygon rotated e.g. 120 degrees that
> > > squiggle renders upside down.
> > >
> > > I.e., what's the simplest document or program that reproduces
> > > incorrect rendering? I'm sure something obvious like an
> > > upside down rotation would be fixed pretty quickly.
> > >
> > > On the other hand, it could be your logic. How exactly does a
> > > circular slider position turn into SVG attributes?
> > >
> > >
> > > On Jan 23, 2008 12:31 PM, Bishop, Michael W. CONTR J9C880
> > > <Mi...@je.jfcom.mil> wrote:
> > >
> > >
> > > Hello,
> > > I've come across a pretty odd problem with Batik.
> > > I'm using the
> > > 1.7 release version. For my application, I've
> > > developed a "circle
> > > slider" which is pretty much a Jslider that goes in a
> > > circle. I use it
> > > to rotate elements from 0 degrees to 360 degrees. As I
> > > move the slider,
> > > the shape on the JSVGCanvas changes. This works
> > > perfectly for circle,
> > > ellipse, line, and rect elements. On other elements
> > > (polygon, polyline,
> > > path, text), the element is rapidly flipped 180 degrees
> > > ONLY when the
> > > circle slider is between 90 and 270 degrees.
> > > So I get a smooth rotation from 0 to 90.
> > From 90 to 270 the
> > > element gets flipped upside-down over and over again,
> > > oscillating back
> > > and forth. From 270 to 360 (0), I get smooth rotation
> > > again. The
> > > reason I think it's Batik is because it doesn't occur
> > > with every element
> > > and my application is reporting the correct number of
> > > degrees. I think
> > > it's odd that it only happens witin that certain range.
> > > Has anyone
> > > experienced this?
> > >
> > > Michael Bishop
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > batik-users-unsubscribe@xmlgraphics.apache.org
> > <ma...@xmlgraphics.apache.org>
> > > For additional commands, e-mail:
> > > batik-users-help@xmlgraphics.apache.org
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Archie L. Cobbs
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > batik-users-unsubscribe@xmlgraphics.apache.org
> > <ma...@xmlgraphics.apache.org>
> > For additional commands, e-mail:
> > batik-users-help@xmlgraphics.apache.org
> >
> >
> >
> >
> >
> >
> > --
> > Archie L. Cobbs
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
--
Archie L. Cobbs
RE: Rendering bug with transforms?
Posted by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil>.
I got snapshots from the original, rotated (flipped) and rotated
(correct) DOMs. Since the transform is in matrix form, it's hard to
discern anything save the fact that all three are different. I loaded
each snapshot in Squiggle; they looked the same as they do in my
application.
I was able to create a test class that can showcase this behavior. It's
not a specific SVG; it's an application that rotates a rect element,
degree-by-degree a full 360 degrees on a JSVGCanvas successfully. Then
it does the same with a text element and the errors occur between 90 and
270.
I'll attach the class for those curious; it's a single file that just
needs Batik on the classpath:
mil.jfcom.cie.whiteboard.TestElementTransform
I guess I should also file a bug unless someone finds something wrong
with the attached code.
Michael Bishop
> -----Original Message-----
> From: archie.cobbs@gmail.com [mailto:archie.cobbs@gmail.com]
> On Behalf Of Archie Cobbs
> Sent: Wednesday, January 23, 2008 2:52 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: Re: Rendering bug with transforms?
>
> I would be interesting to "snapshot" your DOM after the
> unexpected flip occurs then:
>
> - Save it to a file.
> - Verify relaunching squiggle on the file still shows item flipped.
> - Do analysis to determine whether matrix is incorrect (your
> bug) or batik is mis-reading it (batik bug).
> - If Batik is mis-reading matrix, create Bugzilla issue
> containing simplified counterexample SVG file.
>
> One possibility is your computation is broken around the
> "corner cases" of 90 and 270 degress. Continuous reading and
> updating of the matrix makes these corner cases more likely
> to be hit.
>
>
> On Jan 23, 2008 1:36 PM, Bishop, Michael W. CONTR J9C880
> <Mi...@je.jfcom.mil> wrote:
>
>
> OK, the slider basically reports a degree from 0 to
> 359. I have a
> ChangeListener attached that updates the "transform"
> attribute of the
> selected element.
>
> So what essentially happens:
>
> - Retrieve the "transform" (I use the matrix only)
> attribute as an
> AffineTransform.
> - Revert the current rotation angle on the AffineTransform.
> - Apply the new rotation angle to the AffineTransform.
> - Convert the AffineTransform to a "transform" attribute.
> - Apply the new "transform" attribute to the element on the
> UpdateManager.
>
> I don't think static rotation covers it. My old
> rotation technique was
> a plain JSlider that would only update the element
> after the change
> occurs. This never fails. It only seems to happen
> when the document is
> continuously updated as the slider is moving. Another
> interesting fact
> is that sometimes an element STAYS flipped; when I get back to 0
> degrees, I see that a text element might be upside-down.
>
> If this behavior was consistant across all elements,
> I'd be more apt to
> dig through my code. It only seems to happen with
> certain elements.
> Maybe I can write a test case that will draw an element
> to a canvas,
> then rotate it through 360 degrees with a for loop.
>
> Michael Bishop
>
>
> > -----Original Message-----
> > From: archie.cobbs@gmail.com [mailto:
> archie.cobbs@gmail.com <ma...@gmail.com> ]
> > On Behalf Of Archie Cobbs
> > Sent: Wednesday, January 23, 2008 1:41 PM
> > To: batik-users@xmlgraphics.apache.org
> > Subject: Re: Rendering bug with transforms?
> >
> > What is your slider actually doing?
> >
> > If it's just updating the "transform" attribute of a DOM
> > element, in theory you should be able to produce a static
> > document containing a polygon rotated e.g. 120 degrees that
> > squiggle renders upside down.
> >
> > I.e., what's the simplest document or program that reproduces
> > incorrect rendering? I'm sure something obvious like an
> > upside down rotation would be fixed pretty quickly.
> >
> > On the other hand, it could be your logic. How exactly does a
> > circular slider position turn into SVG attributes?
> >
> >
> > On Jan 23, 2008 12:31 PM, Bishop, Michael W. CONTR J9C880
> > <Mi...@je.jfcom.mil> wrote:
> >
> >
> > Hello,
> > I've come across a pretty odd problem with Batik.
> > I'm using the
> > 1.7 release version. For my application, I've
> > developed a "circle
> > slider" which is pretty much a Jslider that goes in a
> > circle. I use it
> > to rotate elements from 0 degrees to 360 degrees. As I
> > move the slider,
> > the shape on the JSVGCanvas changes. This works
> > perfectly for circle,
> > ellipse, line, and rect elements. On other elements
> > (polygon, polyline,
> > path, text), the element is rapidly flipped 180 degrees
> > ONLY when the
> > circle slider is between 90 and 270 degrees.
> > So I get a smooth rotation from 0 to 90.
> From 90 to 270 the
> > element gets flipped upside-down over and over again,
> > oscillating back
> > and forth. From 270 to 360 (0), I get smooth rotation
> > again. The
> > reason I think it's Batik is because it doesn't occur
> > with every element
> > and my application is reporting the correct number of
> > degrees. I think
> > it's odd that it only happens witin that certain range.
> > Has anyone
> > experienced this?
> >
> > Michael Bishop
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > batik-users-unsubscribe@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
> > For additional commands, e-mail:
> > batik-users-help@xmlgraphics.apache.org
> >
> >
> >
> >
> >
> >
> > --
> > Archie L. Cobbs
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
> For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>
>
>
>
>
>
> --
> Archie L. Cobbs
>
>
Re: Rendering bug with transforms?
Posted by Archie Cobbs <ar...@dellroad.org>.
I would be interesting to "snapshot" your DOM after the unexpected flip
occurs then:
- Save it to a file.
- Verify relaunching squiggle on the file still shows item flipped.
- Do analysis to determine whether matrix is incorrect (your bug) or batik
is mis-reading it (batik bug).
- If Batik is mis-reading matrix, create Bugzilla issue containing
simplified counterexample SVG file.
One possibility is your computation is broken around the "corner cases" of
90 and 270 degress. Continuous reading and updating of the matrix makes
these corner cases more likely to be hit.
On Jan 23, 2008 1:36 PM, Bishop, Michael W. CONTR J9C880 <
Michael.Bishop@je.jfcom.mil> wrote:
> OK, the slider basically reports a degree from 0 to 359. I have a
> ChangeListener attached that updates the "transform" attribute of the
> selected element.
>
> So what essentially happens:
>
> - Retrieve the "transform" (I use the matrix only) attribute as an
> AffineTransform.
> - Revert the current rotation angle on the AffineTransform.
> - Apply the new rotation angle to the AffineTransform.
> - Convert the AffineTransform to a "transform" attribute.
> - Apply the new "transform" attribute to the element on the
> UpdateManager.
>
> I don't think static rotation covers it. My old rotation technique was
> a plain JSlider that would only update the element after the change
> occurs. This never fails. It only seems to happen when the document is
> continuously updated as the slider is moving. Another interesting fact
> is that sometimes an element STAYS flipped; when I get back to 0
> degrees, I see that a text element might be upside-down.
>
> If this behavior was consistant across all elements, I'd be more apt to
> dig through my code. It only seems to happen with certain elements.
> Maybe I can write a test case that will draw an element to a canvas,
> then rotate it through 360 degrees with a for loop.
>
> Michael Bishop
>
> > -----Original Message-----
> > From: archie.cobbs@gmail.com [mailto:archie.cobbs@gmail.com]
> > On Behalf Of Archie Cobbs
> > Sent: Wednesday, January 23, 2008 1:41 PM
> > To: batik-users@xmlgraphics.apache.org
> > Subject: Re: Rendering bug with transforms?
> >
> > What is your slider actually doing?
> >
> > If it's just updating the "transform" attribute of a DOM
> > element, in theory you should be able to produce a static
> > document containing a polygon rotated e.g. 120 degrees that
> > squiggle renders upside down.
> >
> > I.e., what's the simplest document or program that reproduces
> > incorrect rendering? I'm sure something obvious like an
> > upside down rotation would be fixed pretty quickly.
> >
> > On the other hand, it could be your logic. How exactly does a
> > circular slider position turn into SVG attributes?
> >
> >
> > On Jan 23, 2008 12:31 PM, Bishop, Michael W. CONTR J9C880
> > <Mi...@je.jfcom.mil> wrote:
> >
> >
> > Hello,
> > I've come across a pretty odd problem with Batik.
> > I'm using the
> > 1.7 release version. For my application, I've
> > developed a "circle
> > slider" which is pretty much a Jslider that goes in a
> > circle. I use it
> > to rotate elements from 0 degrees to 360 degrees. As I
> > move the slider,
> > the shape on the JSVGCanvas changes. This works
> > perfectly for circle,
> > ellipse, line, and rect elements. On other elements
> > (polygon, polyline,
> > path, text), the element is rapidly flipped 180 degrees
> > ONLY when the
> > circle slider is between 90 and 270 degrees.
> > So I get a smooth rotation from 0 to 90. From 90 to 270 the
> > element gets flipped upside-down over and over again,
> > oscillating back
> > and forth. From 270 to 360 (0), I get smooth rotation
> > again. The
> > reason I think it's Batik is because it doesn't occur
> > with every element
> > and my application is reporting the correct number of
> > degrees. I think
> > it's odd that it only happens witin that certain range.
> > Has anyone
> > experienced this?
> >
> > Michael Bishop
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail:
> > batik-users-help@xmlgraphics.apache.org
> >
> >
> >
> >
> >
> >
> > --
> > Archie L. Cobbs
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
--
Archie L. Cobbs
RE: Rendering bug with transforms?
Posted by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil>.
OK, the slider basically reports a degree from 0 to 359. I have a
ChangeListener attached that updates the "transform" attribute of the
selected element.
So what essentially happens:
- Retrieve the "transform" (I use the matrix only) attribute as an
AffineTransform.
- Revert the current rotation angle on the AffineTransform.
- Apply the new rotation angle to the AffineTransform.
- Convert the AffineTransform to a "transform" attribute.
- Apply the new "transform" attribute to the element on the
UpdateManager.
I don't think static rotation covers it. My old rotation technique was
a plain JSlider that would only update the element after the change
occurs. This never fails. It only seems to happen when the document is
continuously updated as the slider is moving. Another interesting fact
is that sometimes an element STAYS flipped; when I get back to 0
degrees, I see that a text element might be upside-down.
If this behavior was consistant across all elements, I'd be more apt to
dig through my code. It only seems to happen with certain elements.
Maybe I can write a test case that will draw an element to a canvas,
then rotate it through 360 degrees with a for loop.
Michael Bishop
> -----Original Message-----
> From: archie.cobbs@gmail.com [mailto:archie.cobbs@gmail.com]
> On Behalf Of Archie Cobbs
> Sent: Wednesday, January 23, 2008 1:41 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: Re: Rendering bug with transforms?
>
> What is your slider actually doing?
>
> If it's just updating the "transform" attribute of a DOM
> element, in theory you should be able to produce a static
> document containing a polygon rotated e.g. 120 degrees that
> squiggle renders upside down.
>
> I.e., what's the simplest document or program that reproduces
> incorrect rendering? I'm sure something obvious like an
> upside down rotation would be fixed pretty quickly.
>
> On the other hand, it could be your logic. How exactly does a
> circular slider position turn into SVG attributes?
>
>
> On Jan 23, 2008 12:31 PM, Bishop, Michael W. CONTR J9C880
> <Mi...@je.jfcom.mil> wrote:
>
>
> Hello,
> I've come across a pretty odd problem with Batik.
> I'm using the
> 1.7 release version. For my application, I've
> developed a "circle
> slider" which is pretty much a Jslider that goes in a
> circle. I use it
> to rotate elements from 0 degrees to 360 degrees. As I
> move the slider,
> the shape on the JSVGCanvas changes. This works
> perfectly for circle,
> ellipse, line, and rect elements. On other elements
> (polygon, polyline,
> path, text), the element is rapidly flipped 180 degrees
> ONLY when the
> circle slider is between 90 and 270 degrees.
> So I get a smooth rotation from 0 to 90. From 90 to 270 the
> element gets flipped upside-down over and over again,
> oscillating back
> and forth. From 270 to 360 (0), I get smooth rotation
> again. The
> reason I think it's Batik is because it doesn't occur
> with every element
> and my application is reporting the correct number of
> degrees. I think
> it's odd that it only happens witin that certain range.
> Has anyone
> experienced this?
>
> Michael Bishop
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>
>
>
>
>
>
> --
> Archie L. Cobbs
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Rendering bug with transforms?
Posted by Archie Cobbs <ar...@dellroad.org>.
What is your slider actually doing?
If it's just updating the "transform" attribute of a DOM element, in theory
you should be able to produce a static document containing a polygon rotated
e.g. 120 degrees that squiggle renders upside down.
I.e., what's the simplest document or program that reproduces incorrect
rendering? I'm sure something obvious like an upside down rotation would be
fixed pretty quickly.
On the other hand, it could be your logic. How exactly does a circular
slider position turn into SVG attributes?
On Jan 23, 2008 12:31 PM, Bishop, Michael W. CONTR J9C880 <
Michael.Bishop@je.jfcom.mil> wrote:
> Hello,
> I've come across a pretty odd problem with Batik. I'm using the
> 1.7 release version. For my application, I've developed a "circle
> slider" which is pretty much a Jslider that goes in a circle. I use it
> to rotate elements from 0 degrees to 360 degrees. As I move the slider,
> the shape on the JSVGCanvas changes. This works perfectly for circle,
> ellipse, line, and rect elements. On other elements (polygon, polyline,
> path, text), the element is rapidly flipped 180 degrees ONLY when the
> circle slider is between 90 and 270 degrees.
> So I get a smooth rotation from 0 to 90. From 90 to 270 the
> element gets flipped upside-down over and over again, oscillating back
> and forth. From 270 to 360 (0), I get smooth rotation again. The
> reason I think it's Batik is because it doesn't occur with every element
> and my application is reporting the correct number of degrees. I think
> it's odd that it only happens witin that certain range. Has anyone
> experienced this?
>
> Michael Bishop
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
--
Archie L. Cobbs