Bug 15006 - antialias="none" does not work with bitmap file output using quartz
antialias="none" does not work with bitmap file output using quartz
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Graphics
R 2.15.1
All Mac OS X v10.7
: P5 minor
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-30 23:51 UTC by Winston Chang
Modified: 2012-08-02 08:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Winston Chang 2012-07-30 23:51:59 UTC
Here is some code that demonstrates:

    png('test.png', type="quartz", antialias="none")
    curve(sin, 0, 10)
    dev.off()


The output is still antialiased.

The problem seems to be within the png() function, in these lines:

    antialias <- match(d$antialias, aa.cairo)
    if (type == "quartz" && capabilities("aqua")) {
        width <- g$width/ifelse(is.na(res), 72, res)
        height <- g$height/ifelse(is.na(res), 72, res)
        invisible(.External(CQuartz, "png", path.expand(filename), 
            width, height, pointsize, d$family, antialias != 
                "none", TRUE, "", bg, "white", if (is.na(res)) NULL else res))
    }


At the start of this, d$antialias is "none". The first line sets antialias to the number 2. Then the external CQuartz function is called and compares antialias (which is a number) to "none".

I think the solution is to replace the antialias!="none" with d$antialias!="none".
Comment 1 Winston Chang 2012-07-30 23:52:41 UTC
Similar code appears in bmp, tiff, jpeg, and probably others.