s-u / Cairo

R graphics device using cairo graphics library for creating high-quality output
12 stars 10 forks source link

Cairo device renders no graphics when interpolate is set to TRUE on function grid.raster() and rasterImage() #8

Closed chinqw closed 1 month ago

chinqw commented 10 years ago

When using grid.raster() or rasterImage to render a PNG image through Cairo device, interpolate must be set to FALSE. Otherwise, no graphics is rendered.

-- create an png file R> png() R> plot(1:10) R> dev.off() R> grid.raster(readPNG("Rplot001.png"))

-- render png image with interpolate = TRUE to a png file plot_cairo.png R> Cairo(file = "plot_cairo.png") R> grid.raster(readPNG("Rplot001.png"), interpolate=TRUE) R> dev.off()

-- render png image with interpolate = FALSE to a png file plot_cairo_no_interp.png R> Cairo(file = "plot_cairo_no_interp.png") R> grid.raster(readPNG("Rplot001.png"), interpolate=FALSE) R> dev.off()

R> grid.raster(readPNG("plot_cairo.png")) # no graphic on the plot R> grid.raster(readPNG("plot_cairo_no_interp.png")) # graphic is rendered on the plot

Other graphics devices, e.g., X11, png, work with no issue on interpolate argument setting.

s-u commented 1 month ago

Cannot reproduce - works fine for me in current versions of R and Cairo. If still relevant, please include sesisonInfo() and OS info.