gujjula / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

Make pixel-alignment optional #324

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The current implementation of alignment of plots to pixels is clever, but it 
would be great to make it optional. The current system produces better-looking 
static plots, but upon moving and zooming the lines and symbols jump a bit. 

Also, for plots that are smooth (e.g. math functions) and are line- or 
fill-only, the edge is extremely jagged, and the disabling of alignment fixes 
that.

The implementation for scatterplots should be rather simple:

- Add a BOOL property alignsPointsToPixels or similar to CPTScatterPlot and 
CPTPlotSymbol
- Change a single line in the implementation of CPTScatterPlot: 
[self alignViewPointsToUserSpace:viewPoints withContent:theContext 
drawPointFlags:drawPointFlags]

to 

if (self.alignsPointsToPixels)
    [self alignViewPointsToUserSpace:viewPoints withContent:theContext drawPointFlags:drawPointFlags]

- Change a single line in the implementation of CPTPlotSymbol:
CGPoint origin = CGPointMake(round(center.x - layerSize.width / 2.0), 
round(center.y - layerSize.height / 2.0));

to

CGPoint origin = CGPointMake(center.x - layerSize.width / 2.0, center.y - 
layerSize.height / 2.0);
if (self.alignsPointsToPixels) {
    origin.x = round(origin.x);
    origin.y = round(origin.y);
}   

- Maybe also add a mechanism for changes of the property on the plot to 
propagate to it's symbols

Original issue reported on code.google.com by sergiy.p...@gmail.com on 26 Aug 2011 at 9:33

GoogleCodeExporter commented 9 years ago
I think the jumping is related to issue #323. Let's fix that one first and see 
if it addresses this issue, too.

Original comment by eskr...@mac.com on 28 Aug 2011 at 6:56

GoogleCodeExporter commented 9 years ago
I will implement this property for all plot types. The default will be YES so 
the behavior of older apps does not change.

Original comment by eskr...@mac.com on 4 Sep 2011 at 3:03

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 93c02a031488.

Original comment by eskr...@mac.com on 5 Sep 2011 at 3:22