diff --git a/R/hexagon.R b/R/hexagon.R index 29a3d8c..31e0f11 100644 --- a/R/hexagon.R +++ b/R/hexagon.R @@ -51,14 +51,27 @@ open_device <- function(file_path, resolution = 300) { stop("Argument 'resolution' must be a numeric value.", call. = FALSE) } - grDevices::png( - filename = file_path, - width = 4.39, - height = 5.08, - units = "cm", - res = resolution, - bg = "transparent" - ) + if (.Platform[["OS.type"]] == "windows") { + grDevices::png( + filename = file_path, + width = 4.39, + height = 5.08, + units = "cm", + res = resolution, + bg = "transparent", + type = "cairo", + antialias = "none" + ) + } else { + grDevices::png( + filename = file_path, + width = 4.39, + height = 5.08, + units = "cm", + res = resolution, + bg = "transparent" + ) + } } diff --git a/README.md b/README.md index 4b1076c..4fea869 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![R-CMD-check](https://github.com/matt-dray/gex/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/matt-dray/gex/actions/workflows/R-CMD-check.yaml) +[![Blog posts](https://img.shields.io/badge/rostrum.blog-posts-008900?labelColor=000000&logo=data%3Aimage%2Fgif%3Bbase64%2CR0lGODlhEAAQAPEAAAAAABWCBAAAAAAAACH5BAlkAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAC55QkISIiEoQQQgghRBBCiCAIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAAh%2BQQJZAACACwAAAAAEAAQAAAC55QkIiESIoQQQgghhAhCBCEIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAA7)](https://www.rostrum.blog/index.html#category=gex) ## What @@ -95,13 +96,15 @@ That creates this absolutely stunning demo sticker, written to the specified `fi Note that you can't rely on plot-window previews when you're developing your sticker (they lie). You must inspect the generated PNG file instead. -From R, you could do this with a `system()` call: +You could do this with a `system()` call from R: ``` r # Open the PNG hex image for inspection system(paste("open", temp_path)) ``` +Try `start` rather than `open` on Windows. + ## Related For more established hex-making tools with R, try: