Type Alias libR_sys::DevDesc

source ·
pub type DevDesc = _DevDesc;
Expand description

——— New (in 1.4.0) device driver structure ——— NOTES:

  1. All locations and dimensions are in device coordinates.
  2. I found this comment in the doc for dev_Open – looks nasty Any known instances of such a thing happening? Should be replaced by a function to query the device for preferred gpars settings? (to be called when the device is initialised)

NOTE that it is perfectly acceptable for this function to set generic graphics parameters too (i.e., override the generic parameter settings which GInit sets up) all at the author’s own risk of course :)

  1. Do we really need dev_StrWidth as well as dev_MetricInfo? I can see the difference between the two – its just a question of whether dev_MetricInfo should just return what dev_StrWidth would give if font metric information is not available. I guess having both allows the developer to decide when to ask for which sort of value, and to decide what to do when font metric information is not available. And why not a dev_StrHeight?
  2. Should “ipr”, “asp”, and “cra” be in the device description? If not, then where? I guess they don’t need to be if no device makes use of them. On the other hand, they would need to be replaced by a device call that R base graphics could use to get enough information to figure them out. (e.g., some sort of dpi() function to complement the size() function.)

Aliased Type§

struct DevDesc {
Show 83 fields pub left: f64, pub right: f64, pub bottom: f64, pub top: f64, pub clipLeft: f64, pub clipRight: f64, pub clipBottom: f64, pub clipTop: f64, pub xCharOffset: f64, pub yCharOffset: f64, pub yLineBias: f64, pub ipr: [f64; 2], pub cra: [f64; 2], pub gamma: f64, pub canClip: Rboolean, pub canChangeGamma: Rboolean, pub canHAdj: i32, pub startps: f64, pub startcol: i32, pub startfill: i32, pub startlty: i32, pub startfont: i32, pub startgamma: f64, pub deviceSpecific: *mut c_void, pub displayListOn: Rboolean, pub canGenMouseDown: Rboolean, pub canGenMouseMove: Rboolean, pub canGenMouseUp: Rboolean, pub canGenKeybd: Rboolean, pub canGenIdle: Rboolean, pub gettingEvent: Rboolean, pub activate: Option<unsafe extern "C" fn(_: *mut _DevDesc)>, pub circle: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub clip: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: f64, _: *mut _DevDesc)>, pub close: Option<unsafe extern "C" fn(_: *mut _DevDesc)>, pub deactivate: Option<unsafe extern "C" fn(_: *mut _DevDesc)>, pub locator: Option<unsafe extern "C" fn(_: *mut f64, _: *mut f64, _: *mut _DevDesc) -> Rboolean>, pub line: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub metricInfo: Option<unsafe extern "C" fn(_: i32, _: *mut R_GE_gcontext, _: *mut f64, _: *mut f64, _: *mut f64, _: *mut _DevDesc)>, pub mode: Option<unsafe extern "C" fn(_: i32, _: *mut _DevDesc)>, pub newPage: Option<unsafe extern "C" fn(_: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub polygon: Option<unsafe extern "C" fn(_: i32, _: *mut f64, _: *mut f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub polyline: Option<unsafe extern "C" fn(_: i32, _: *mut f64, _: *mut f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub rect: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub path: Option<unsafe extern "C" fn(_: *mut f64, _: *mut f64, _: i32, _: *mut i32, _: Rboolean, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub raster: Option<unsafe extern "C" fn(_: *mut u32, _: i32, _: i32, _: f64, _: f64, _: f64, _: f64, _: f64, _: Rboolean, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub cap: Option<unsafe extern "C" fn(_: *mut _DevDesc) -> *mut SEXPREC>, pub size: Option<unsafe extern "C" fn(_: *mut f64, _: *mut f64, _: *mut f64, _: *mut f64, _: *mut _DevDesc)>, pub strWidth: Option<unsafe extern "C" fn(_: *const i8, _: *mut R_GE_gcontext, _: *mut _DevDesc) -> f64>, pub text: Option<unsafe extern "C" fn(_: f64, _: f64, _: *const i8, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub onExit: Option<unsafe extern "C" fn(_: *mut _DevDesc)>, pub getEvent: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *const i8) -> *mut SEXPREC>, pub newFrameConfirm: Option<unsafe extern "C" fn(_: *mut _DevDesc) -> Rboolean>, pub hasTextUTF8: Rboolean, pub textUTF8: Option<unsafe extern "C" fn(_: f64, _: f64, _: *const i8, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub strWidthUTF8: Option<unsafe extern "C" fn(_: *const i8, _: *mut R_GE_gcontext, _: *mut _DevDesc) -> f64>, pub wantSymbolUTF8: Rboolean, pub useRotatedTextInContour: Rboolean, pub eventEnv: *mut SEXPREC, pub eventHelper: Option<unsafe extern "C" fn(_: *mut _DevDesc, _: i32)>, pub holdflush: Option<unsafe extern "C" fn(_: *mut _DevDesc, _: i32) -> i32>, pub haveTransparency: i32, pub haveTransparentBg: i32, pub haveRaster: i32, pub haveCapture: i32, pub haveLocator: i32, pub setPattern: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>, pub releasePattern: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>, pub setClipPath: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>, pub releaseClipPath: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>, pub setMask: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>, pub releaseMask: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>, pub deviceVersion: i32, pub deviceClip: Rboolean, pub defineGroup: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: i32, _: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>, pub useGroup: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut SEXPREC, _: *mut _DevDesc)>, pub releaseGroup: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>, pub stroke: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub fill: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: i32, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub fillStroke: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: i32, _: *mut R_GE_gcontext, _: *mut _DevDesc)>, pub capabilities: Option<unsafe extern "C" fn(_: *mut SEXPREC) -> *mut SEXPREC>, pub glyph: Option<unsafe extern "C" fn(_: i32, _: *mut i32, _: *mut f64, _: *mut f64, _: *mut SEXPREC, _: f64, _: i32, _: f64, _: *mut _DevDesc)>, pub reserved: [i8; 64],
}

Fields§

§left: f64

left raster coordinate

§right: f64

right raster coordinate

§bottom: f64

bottom raster coordinate

§top: f64

top raster coordinate

§clipLeft: f64

R only has the notion of a rectangular clipping region

§clipRight: f64§clipBottom: f64§clipTop: f64§xCharOffset: f64

x character addressing offset - unused

§yCharOffset: f64

y character addressing offset

§yLineBias: f64

1/2 interline space as frac of line height

§ipr: [f64; 2]

Inches per raster; [0]=x, [1]=y

§cra: [f64; 2]

Character size in rasters; [0]=x, [1]=y

§gamma: f64

(initial) Device Gamma Correction

§canClip: Rboolean

Device-level clipping

§canChangeGamma: Rboolean

can the gamma factor be modified?

§canHAdj: i32

Can do at least some horiz adjust of text 0 = none, 1 = {0,0.5,1}, 2 = [0,1]

§startps: f64

Device initial settings / /* These are things that the device must set up when it is created. The graphics system can modify them and track current values,

§startcol: i32

sets par(“fg”), par(“col”) and gpar(“col”)

§startfill: i32

sets par(“bg”) and gpar(“fill”)

§startlty: i32§startfont: i32§startgamma: f64§deviceSpecific: *mut c_void

pointer to device specific parameters

§displayListOn: Rboolean

toggle for initial display list status

§canGenMouseDown: Rboolean

can the device generate mousedown events

§canGenMouseMove: Rboolean

can the device generate mousemove events

§canGenMouseUp: Rboolean

can the device generate mouseup events

§canGenKeybd: Rboolean

can the device generate keyboard events

§canGenIdle: Rboolean

can the device generate idle events

§gettingEvent: Rboolean

This is set while getGraphicsEvent is actively looking for events

§activate: Option<unsafe extern "C" fn(_: *mut _DevDesc)>§circle: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§clip: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: f64, _: *mut _DevDesc)>§close: Option<unsafe extern "C" fn(_: *mut _DevDesc)>§deactivate: Option<unsafe extern "C" fn(_: *mut _DevDesc)>§locator: Option<unsafe extern "C" fn(_: *mut f64, _: *mut f64, _: *mut _DevDesc) -> Rboolean>§line: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§metricInfo: Option<unsafe extern "C" fn(_: i32, _: *mut R_GE_gcontext, _: *mut f64, _: *mut f64, _: *mut f64, _: *mut _DevDesc)>§mode: Option<unsafe extern "C" fn(_: i32, _: *mut _DevDesc)>§newPage: Option<unsafe extern "C" fn(_: *mut R_GE_gcontext, _: *mut _DevDesc)>§polygon: Option<unsafe extern "C" fn(_: i32, _: *mut f64, _: *mut f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§polyline: Option<unsafe extern "C" fn(_: i32, _: *mut f64, _: *mut f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§rect: Option<unsafe extern "C" fn(_: f64, _: f64, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§path: Option<unsafe extern "C" fn(_: *mut f64, _: *mut f64, _: i32, _: *mut i32, _: Rboolean, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§raster: Option<unsafe extern "C" fn(_: *mut u32, _: i32, _: i32, _: f64, _: f64, _: f64, _: f64, _: f64, _: Rboolean, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§cap: Option<unsafe extern "C" fn(_: *mut _DevDesc) -> *mut SEXPREC>§size: Option<unsafe extern "C" fn(_: *mut f64, _: *mut f64, _: *mut f64, _: *mut f64, _: *mut _DevDesc)>§strWidth: Option<unsafe extern "C" fn(_: *const i8, _: *mut R_GE_gcontext, _: *mut _DevDesc) -> f64>§text: Option<unsafe extern "C" fn(_: f64, _: f64, _: *const i8, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§onExit: Option<unsafe extern "C" fn(_: *mut _DevDesc)>§getEvent: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *const i8) -> *mut SEXPREC>

device_getEvent is no longer used, but the slot is kept for back compatibility of the structure.

§newFrameConfirm: Option<unsafe extern "C" fn(_: *mut _DevDesc) -> Rboolean>§hasTextUTF8: Rboolean

and strWidthUTF8

§textUTF8: Option<unsafe extern "C" fn(_: f64, _: f64, _: *const i8, _: f64, _: f64, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§strWidthUTF8: Option<unsafe extern "C" fn(_: *const i8, _: *mut R_GE_gcontext, _: *mut _DevDesc) -> f64>§wantSymbolUTF8: Rboolean§useRotatedTextInContour: Rboolean

Is rotated text good enough to be preferable to Hershey in contour labels? Old default was FALSE.

§eventEnv: *mut SEXPREC

This is an environment holding event handlers.

§eventHelper: Option<unsafe extern "C" fn(_: *mut _DevDesc, _: i32)>§holdflush: Option<unsafe extern "C" fn(_: *mut _DevDesc, _: i32) -> i32>§haveTransparency: i32

1 = no, 2 = yes

§haveTransparentBg: i32

1 = no, 2 = fully, 3 = semi

§haveRaster: i32

1 = no, 2 = yes, 3 = except for missing values

§haveCapture: i32

1 = no, 2 = yes

§haveLocator: i32

1 = no, 2 = yes

§setPattern: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>§releasePattern: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>§setClipPath: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>§releaseClipPath: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>§setMask: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>§releaseMask: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>§deviceVersion: i32

This should match R_GE_version, BUT it does not have to. It give the graphics engine a chance to work with graphics device packages BEFORE they update to changes in R_GE_version.

§deviceClip: Rboolean

This can be used to OVERRIDE canClip so that graphics engine leaves ALL clipping to the graphics device

§defineGroup: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: i32, _: *mut SEXPREC, _: *mut _DevDesc) -> *mut SEXPREC>§useGroup: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut SEXPREC, _: *mut _DevDesc)>§releaseGroup: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut _DevDesc)>§stroke: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§fill: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: i32, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§fillStroke: Option<unsafe extern "C" fn(_: *mut SEXPREC, _: i32, _: *mut R_GE_gcontext, _: *mut _DevDesc)>§capabilities: Option<unsafe extern "C" fn(_: *mut SEXPREC) -> *mut SEXPREC>§glyph: Option<unsafe extern "C" fn(_: i32, _: *mut i32, _: *mut f64, _: *mut f64, _: *mut SEXPREC, _: f64, _: i32, _: f64, _: *mut _DevDesc)>§reserved: [i8; 64]

Area for future expansion. By zeroing this, devices are more likely to work if loaded into a later version of R than that they were compiled under.