pub struct Device {
inner: pGEDevDesc,
}
Fields§
§inner: pGEDevDesc
Implementations§
Source§impl Device
impl Device
Sourcepub fn device_number(&self) -> i32
pub fn device_number(&self) -> i32
Get the device number for this device.
Sourcepub fn get_device(number: i32) -> Result<Device>
pub fn get_device(number: i32) -> Result<Device>
Get a device by number.
Sourcepub fn from_device_coords(&self, value: (f64, f64), from: Unit) -> (f64, f64)
pub fn from_device_coords(&self, value: (f64, f64), from: Unit) -> (f64, f64)
Convert device coordinates into a specified unit. This is usually done by the API.
Sourcepub fn to_device_coords(&self, value: (f64, f64), to: Unit) -> (f64, f64)
pub fn to_device_coords(&self, value: (f64, f64), to: Unit) -> (f64, f64)
Convert a specified unit coordinates into device coordinates. This is usually done by the API.
Sourcepub fn from_device_wh(&self, value: (f64, f64), from: Unit) -> (f64, f64)
pub fn from_device_wh(&self, value: (f64, f64), from: Unit) -> (f64, f64)
Convert device width/height coordinates into a specified unit. This is usually done by the API.
Sourcepub fn to_device_wh(&self, value: (f64, f64), to: Unit) -> (f64, f64)
pub fn to_device_wh(&self, value: (f64, f64), to: Unit) -> (f64, f64)
Convert a specified unit width/height coordinates into device coordinates. This is usually done by the API.
Sourcepub fn line(&self, from: (f64, f64), to: (f64, f64), gc: &Context)
pub fn line(&self, from: (f64, f64), to: (f64, f64), gc: &Context)
Draw a stroked line. gc.color() is the stroke color.
Sourcepub fn polyline<T: IntoIterator<Item = (f64, f64)>>(
&self,
coords: T,
gc: &Context,
)
pub fn polyline<T: IntoIterator<Item = (f64, f64)>>( &self, coords: T, gc: &Context, )
Draw a stroked/filled polyline. gc.color() is the stroke color. The input is anything yielding (x,y) coordinate pairs. Polylines are not closed.
Sourcepub fn polygon<T: IntoIterator<Item = (f64, f64)>>(
&self,
coords: T,
gc: &Context,
)
pub fn polygon<T: IntoIterator<Item = (f64, f64)>>( &self, coords: T, gc: &Context, )
Draw a stroked/filled polygon. gc.color() is the stroke color. The input is anything yielding (x,y) coordinate pairs. Polygons are closed.
Sourcepub fn circle(&self, center: (f64, f64), radius: f64, gc: &Context)
pub fn circle(&self, center: (f64, f64), radius: f64, gc: &Context)
Draw a stroked/filled circle. gc.color() is the stroke color. gc.fill() is the fill color.
Sourcepub fn rect(&self, from: (f64, f64), to: (f64, f64), gc: &Context)
pub fn rect(&self, from: (f64, f64), to: (f64, f64), gc: &Context)
Draw a stroked/filled axis-aligned rectangle. gc.color() is the stroke color. gc.fill() is the fill color.
Sourcepub fn path<T: IntoIterator<Item = impl IntoIterator<Item = (f64, f64)>>>(
&self,
coords: T,
winding: bool,
gc: &Context,
)
pub fn path<T: IntoIterator<Item = impl IntoIterator<Item = (f64, f64)>>>( &self, coords: T, winding: bool, gc: &Context, )
Draw a path with multiple segments. gc.color() is the stroke color. gc.fill() is the fill color. The input is an interator of iterators yielding (x,y) pairs.
Sourcepub fn capture(&self) -> Robj
pub fn capture(&self) -> Robj
Screen capture. Returns an integer matrix representing pixels if it is able.
Sourcepub fn raster<T: AsRef<[u32]>>(
&self,
raster: Raster<T>,
pos: (f64, f64),
size: (f64, f64),
angle: f64,
interpolate: bool,
gc: &Context,
)
pub fn raster<T: AsRef<[u32]>>( &self, raster: Raster<T>, pos: (f64, f64), size: (f64, f64), angle: f64, interpolate: bool, gc: &Context, )
Draw a bitmap.
Sourcepub fn text<T: AsRef<str>>(
&self,
pos: (f64, f64),
text: T,
center: (f64, f64),
rot: f64,
gc: &Context,
)
pub fn text<T: AsRef<str>>( &self, pos: (f64, f64), text: T, center: (f64, f64), rot: f64, gc: &Context, )
Draw a text string starting at pos. TODO: do we need to convert units?
Sourcepub fn symbol(&self, pos: (f64, f64), symbol: i32, size: f64, gc: &Context)
pub fn symbol(&self, pos: (f64, f64), symbol: i32, size: f64, gc: &Context)
Draw a special symbol centered on pos. See https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/points.html
Sourcepub fn char_metric(&self, c: char, gc: &Context) -> TextMetric
pub fn char_metric(&self, c: char, gc: &Context) -> TextMetric
Get the metrics for a single unicode codepoint.
Sourcepub fn text_width<T: AsRef<str>>(&self, text: T, gc: &Context) -> f64
pub fn text_width<T: AsRef<str>>(&self, text: T, gc: &Context) -> f64
Get the width of a unicode string.
Sourcepub fn text_height<T: AsRef<str>>(&self, text: T, gc: &Context) -> f64
pub fn text_height<T: AsRef<str>>(&self, text: T, gc: &Context) -> f64
Get the height of a unicode string.
Sourcepub fn text_metric<T: AsRef<str>>(&self, text: T, gc: &Context) -> TextMetric
pub fn text_metric<T: AsRef<str>>(&self, text: T, gc: &Context) -> TextMetric
Get the metrics for a unicode string.
Sourcepub fn math_text_width(&self, expr: &Robj, gc: &Context) -> f64
pub fn math_text_width(&self, expr: &Robj, gc: &Context) -> f64
Get the width of a mathematical expression.
Sourcepub fn math_text_height(&self, expr: &Robj, gc: &Context) -> f64
pub fn math_text_height(&self, expr: &Robj, gc: &Context) -> f64
Get the height of a mathematical expression.
Sourcepub fn math_text_metric(&self, expr: &Robj, gc: &Context) -> TextMetric
pub fn math_text_metric(&self, expr: &Robj, gc: &Context) -> TextMetric
Get the metrics for a mathematical expression.
Trait Implementations§
impl StructuralPartialEq for Device
Auto Trait Implementations§
impl Freeze for Device
impl RefUnwindSafe for Device
impl !Send for Device
impl !Sync for Device
impl Unpin for Device
impl UnwindSafe for Device
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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