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
impl DeviceDescriptor
pub fn new() -> Self
Sourcepub fn device_size(self, left: f64, right: f64, bottom: f64, top: f64) -> Self
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
: 0right
: 7 inches * points per inch =7 * 72
bottom
: 0top
: 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).
Sourcepub fn ipr(self, ipr: [f64; 2]) -> Self
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.
Sourcepub fn cra(self, cra: [f64; 2]) -> Self
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).
Sourcepub fn startps(self, startps: f64) -> Self
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.
Sourcepub fn startcol(self, startcol: Color) -> Self
pub fn startcol(self, startcol: Color) -> Self
Sets the initial value of colour.
If not specified, black (0x000000
) will be used.
Sourcepub fn startfill(self, startfill: Color) -> Self
pub fn startfill(self, startfill: Color) -> Self
Sets the initial value of fill.
If not specified, white (0xffffff
) will be used.
Sourcepub fn startlty(self, startlty: LineType) -> Self
pub fn startlty(self, startlty: LineType) -> Self
Sets the initial value of line type.
If not specified, LineType::Solid will be used.
Sourcepub fn startfont(self, startfont: FontFace) -> Self
pub fn startfont(self, startfont: FontFace) -> Self
Sets the initial value of font face.
If not specified, FontFace::Plain will be used.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeviceDescriptor
impl RefUnwindSafe for DeviceDescriptor
impl Send for DeviceDescriptor
impl Sync for DeviceDescriptor
impl Unpin for DeviceDescriptor
impl UnwindSafe for DeviceDescriptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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