extendr_api::graphics::device_descriptor

Struct DeviceDescriptor

Source
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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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>,

Source§

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.