gboy: Game Boy image simulator

Description Usage Arguments Details Value

View source: R/g-boy.R

Description

gboy() attempts to simulate how an image would look if displayed on the original (1989) Game Boy screen.

Usage

1
2
3
4
5
6
7
gboy(
  file,
  res = 160,
  crop = TRUE,
  ncols = 4,
  cols = c("#0f380f", "#306230", "#8bac0f", "#9bbc0f")
)

Arguments

file

Path to image file or array returned by png::readPNG() or read::JPEG{}

res

Horizontal resolution of output (default = 160). Vertical resolution will be computed to match the output aspect ratio. Set to NULL for original image horizontal resolution.

crop

Should the image be cropped to match the original Game Boy screen aspect ratio (default = TRUE)

ncols

The number of 'greenscale' colours to use (default = 4, the original Game Boy specification)

cols

The colours used to create a fill gradient (passed to ggplot2::scale_fill_gradientn()) defaults to an approximation of the original Game Boy shades of green

Details

By default, images are cropped (centered) to maintain the original Game Boy screen aspect ratio and pixel numbers (height/width = 140/160).

Value

A ggplot2 plot


cj-holmes/gameboyr documentation built on Aug. 30, 2020, 12:02 a.m.