pub struct DeviceDescriptor {
    pub(crate) left: f64,
    pub(crate) right: f64,
    pub(crate) bottom: f64,
    pub(crate) top: f64,
    pub(crate) ipr: [f64; 2],
    pub(crate) cra: [f64; 2],
    pub(crate) startps: f64,
    pub(crate) startcol: Color,
    pub(crate) startfill: Color,
    pub(crate) startlty: LineType,
    pub(crate) startfont: FontFace,
}
Expand description

A builder of libR_sys::DevDesc.

Fields§

§left: f64§right: f64§bottom: f64§top: f64§ipr: [f64; 2]§cra: [f64; 2]§startps: f64§startcol: Color§startfill: Color§startlty: LineType§startfont: FontFace

Implementations§

source§

impl DeviceDescriptor

source

pub fn new() -> Self

source

pub fn device_size(self, left: f64, right: f64, bottom: f64, top: f64) -> Self

Sets the device sizes (unit: point).

If not specified, the following numbers (7 inches square, following the R Internals’ convetion) will be used.

  • left: 0
  • right: 7 inches * points per inch = 7 * 72
  • bottom: 0
  • top: 7 inches * points per inch = 7 * 72

Please note that, depending on the the coordinate system of the device, left might be larger than right, or bottom larger than top (for example, in SVG, the origin is at the top left corner).

source

pub fn ipr(self, ipr: [f64; 2]) -> Self

Sets inches per raster unit (i.e. point). Note that most of the cases, there’s no need to change this value.

A point is usually 1/72 (the default value), but another value can be specified here to scale the device. The first element is width, the second is height.

source

pub fn cra(self, cra: [f64; 2]) -> Self

Sets the font size (unit: point). Note that most of the cases, there’s no need to change this value.

The first element is width, the second is height. If not specified, [0.9 * 12.0, 1.2 * 12.0], which is suggested by the R Internals as “a good choice” will be used (12 point is the usual default for graphics devices).

source

pub fn startps(self, startps: f64) -> Self

Sets the initial value of pointsize.

If not specified, 12, which is the usual default for graphics devices, will be used.

source

pub fn startcol(self, startcol: Color) -> Self

Sets the initial value of colour.

If not specified, black (0x000000) will be used.

source

pub fn startfill(self, startfill: Color) -> Self

Sets the initial value of fill.

If not specified, white (0xffffff) will be used.

source

pub fn startlty(self, startlty: LineType) -> Self

Sets the initial value of line type.

If not specified, LineType::Solid will be used.

source

pub fn startfont(self, startfont: FontFace) -> Self

Sets the initial value of font face.

If not specified, FontFace::Plain will be used.

Trait Implementations§

source§

impl Default for DeviceDescriptor

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.