Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Java
 QCChart2D for Java
 Two simple rendering speed ups

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
PeterJ Posted - 24 Aug 2010 : 12:37:53
We found two speed up which reduced plot line rendering time in our plots from the order of hundreds of milliseconds to a millisecond or two.

The first was to change the definition of a solid line in ChartAttrribute for [10,0,10,0] to just null. The original definition was the define a solid line as a number of dotted lines with no gap between the dots. Dotted lines are slow for Sun's drawPolyLine

private static float lineStyleData[][] =
{null,{8,4,8,4},{4,4,4,4},{4,2,4,2},{2,2,2,2},{1,1,1,1},{1,2,1,2},{1,4,1,4},{1,8,1,8},{8,4,1,4}};

The second was to turn off antialiasing in ChartView. It would be great to be able to set this option as we're using step plots and anti aliasing is of not benefit. We tried on no-step plots and the results are acceptable. It would be nice if the developer could choose between slight appearance improvement or significant run time.
1   L A T E S T    R E P L I E S    (Newest First)
quinncurtis Posted - 24 Aug 2010 : 15:24:01
Thanks for the stroke information. I can't find anywhere in the Java documentation that BasicStroke can take a null as the dash pattern, but it does seem to work, and speed things up. You can implement this change using the standard library by just creating your own BasicStroke object, and calling the ChartAttribute.setCustomStroke method.

ChartAttribute customattrib = new ChartAttribute(Color.Blue)
BasicStroke bs = new BasicStoke(1);
customattrib.setCustomStroke(bs);

It does look like a good change to make to the standard library.

You can set your own custom rendering hints with a call to the ChartView.setRenderingHints method.

RenderingHints defaultrendering;
RenderingHints renderingHints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

// defaultrendering = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// renderingHints.add(defaultrendering);
defaultrendering = new RenderingHints(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
renderingHints.add(defaultrendering);
defaultrendering = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
renderingHints.add(defaultrendering);
defaultrendering = new RenderingHints(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
renderingHints.add(defaultrendering);
defaultrendering = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
renderingHints.add(defaultrendering);

// defaultrendering = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
// renderingHints.add(defaultrendering);

gWG.setRenderingHints(renderingHints);


We have found that if antialiasing is off, a polygon, and a filled polygon will not match perfectly and leave unfilled pixels. Also, turning antialiasing for text makes the text look really, really, bad.

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07