Canvas rendering issues / Text Transition rendering issues

Jim Graham james.graham at oracle.com
Wed Jan 2 19:36:24 PST 2013


Line joins specify how to draw the corners in a path.  See the example 
images in the documentation for some examples:

http://docs.oracle.com/javafx/2/api/javafx/scene/shape/Shape.html#strokeLineJoinProperty

Note that the first shape using a miter join has a "point" on it that 
shoots out further from the main path.  If you made the shape sharper 
and sharper then that point would extend further and further out until 
the path was turning a 180 angle at that tip and then the miter would 
shoot out to infinity.  To keep the miters from shooting out to infinity 
there is a limit specified by the miterLimit property, but the default 
setting of 10 allows it to shoot out to 10 times the line width before 
it is replaced by a bevel join instead.

The bevel join and round join cases are much better behaved...

			...jim

On 1/2/2013 6:42 PM, Jose Martinez wrote:
> Jim,
>
> I suspect that the jittering is the bounds, as you also suggested.  The
> jittering started when the electric lines were added.  I been meaning to
> fix that and now that the holidays are over I will be working on that.
>   My initial fix is also what you suggested... padding the Parent.
>
> I do not follow when you speak about round or bevel join.  Can you
> elaborate?  Is this in regards to how the stroke is done or related to
> the algorithm for creating the electric lines?
>
> I agree it is not optimized.  It was more for testing performance with
> something over the top.  For each of those lines multiple random calls
> are made... very inefficient.  I imagine having a predefined set of
> points to avoid the random calls might improve perf.
>
> thanks
> jose
> ------------------------------------------------------------------------
> *From:* Jim Graham <james.graham at oracle.com>
> *To:* Daniel Zwolenski <zonski at gmail.com>
> *Cc:* "openjfx-dev at openjdk.java.net" <openjfx-dev at openjdk.java.net>
> *Sent:* Wednesday, January 2, 2013 9:07 PM
> *Subject:* Re: Canvas rendering issues / Text Transition rendering issues
>
> I noticed that the path-based Vector enemies jump around a bit.  I'm
> wondering if this could be due to the bounds of the enemy shifting
> around as the electric lines are added.  Note that you use a stroked
> Path with its default decorations which I believe means miter joins
> which can have spikes in their contributions to bounds when you turn
> tight corners, so as the last triangular segment is randomly generated
> the angle of that last corner to the end before the path is closed can
> shoot out a miter of arbitrary length.
>
> Try using a round or bevel join instead - both of which will have faster
> and more stable bounds computations anyway which can avoid some
> per-frame overhead.  Round would be the most stable choice for bounds,
> but bevel would be the fastest to render.  Another technique for making
> the bounds stable is to include an element that pads the bounds of your
> group beyond the most outlying "jittery" element.  For example,
> including a transparent rectangle whose bounds exceed the circle by
> enough to encompass the spiking of the miter joins or the tiny
> variations in the bevel joins would smooth out the stability of the
> bounds.  The bounds with round joins will always be fairly stable since
> they always have a constant stroke extension distance from the outermost
> points of a path...
>
>              ...jim
>
>


More information about the openjfx-dev mailing list