[−][src]Struct plotters::drawing::DrawingArea
The abstraction of a drawing area. Plotters uses drawing area as the fundamental abstraction for the high level drawing API. The major functionality provided by the drawing area is 1. Layout specification - Split the parent drawing area into sub-drawing-areas 2. Coordinate Translation - Allows guest coordinate system attached and used for drawing. 3. Element based drawing - drawing area provides the environment the element can be drawn onto it.
Methods
impl<DB: DrawingBackend, X: Ranged, Y: Ranged> DrawingArea<DB, RangedCoord<X, Y>>
[src]
pub fn draw_mesh<DrawFunc>(
&self,
draw_func: DrawFunc,
y_count_max: usize,
x_count_max: usize
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>> where
DrawFunc: FnMut(&mut DB, MeshLine<X, Y>) -> Result<(), DrawingErrorKind<DB::ErrorType>>,
[src]
&self,
draw_func: DrawFunc,
y_count_max: usize,
x_count_max: usize
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>> where
DrawFunc: FnMut(&mut DB, MeshLine<X, Y>) -> Result<(), DrawingErrorKind<DB::ErrorType>>,
Draw the mesh on a area
pub fn get_x_range(&self) -> Range<X::ValueType>
[src]
Get the range of X of the guest coordinate for current drawing area
pub fn get_y_range(&self) -> Range<Y::ValueType>
[src]
Get the range of Y of the guest coordinate for current drawing area
pub fn get_x_axis_pixel_range(&self) -> Range<i32>
[src]
pub fn get_y_axis_pixel_range(&self) -> Range<i32>
[src]
impl<DB: DrawingBackend, CT: CoordTranslate> DrawingArea<DB, CT>
[src]
pub fn get_base_pixel(&self) -> BackendCoord
[src]
Get the left upper conner of this area in the drawing backend
pub fn strip_coord_spec(&self) -> DrawingArea<DB, Shift>
[src]
Strip the applied coordinate specification and returns a shift-based drawing area
pub fn dim_in_pixel(&self) -> (u32, u32)
[src]
Get the area dimension in pixel
pub fn relative_to_height(&self, p: f64) -> f64
[src]
Compute the relative size based on the drawing area's height
pub fn relative_to_width(&self, p: f64) -> f64
[src]
Compute the relative size based on the drawing area's width
pub fn get_pixel_range(&self) -> (Range<i32>, Range<i32>)
[src]
Get the pixel range of this area
pub fn fill<ColorType: Color>(
&self,
color: &ColorType
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
[src]
&self,
color: &ColorType
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
Fill the entire drawing area with a color
pub fn draw_pixel<ColorType: Color>(
&self,
pos: CT::From,
color: &ColorType
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
[src]
&self,
pos: CT::From,
color: &ColorType
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
Draw a single pixel
pub fn present(&self) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
[src]
Present all the pending changes to the backend
pub fn draw<'a, E>(
&self,
element: &'a E
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>> where
&'a E: PointCollection<'a, CT::From>,
E: Drawable<DB>,
[src]
&self,
element: &'a E
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>> where
&'a E: PointCollection<'a, CT::From>,
E: Drawable<DB>,
Draw an high-level element
pub fn map_coordinate(&self, coord: &CT::From) -> BackendCoord
[src]
Map coordinate to the backend coordinate
pub fn estimate_text_size(
&self,
text: &str,
font: &FontDesc
) -> Result<(u32, u32), DrawingAreaErrorKind<DB::ErrorType>>
[src]
&self,
text: &str,
font: &FontDesc
) -> Result<(u32, u32), DrawingAreaErrorKind<DB::ErrorType>>
Estimate the dimension of the text if drawn on this drawing area. We can't get this directly from the font, since the drawing backend may or may not follows the font configuration. In terminal, the font family will be dropped. So the size of the text is drawing area related.
text
: The text we want to estimatefont
: The font spec in which we want to draw the text- return: The size of the text if drawn on this area
impl<DB: DrawingBackend> DrawingArea<DB, Shift>
[src]
pub fn shrink<A: SizeDesc, B: SizeDesc, C: SizeDesc, D: SizeDesc>(
self,
left_upper: (A, B),
dimension: (C, D)
) -> DrawingArea<DB, Shift>
[src]
self,
left_upper: (A, B),
dimension: (C, D)
) -> DrawingArea<DB, Shift>
Shrink the region, note all the locations are in guest coordinate
pub fn apply_coord_spec<CT: CoordTranslate>(
&self,
coord_spec: CT
) -> DrawingArea<DB, CT>
[src]
&self,
coord_spec: CT
) -> DrawingArea<DB, CT>
Apply a new coord transformation object and returns a new drawing area
pub fn margin<ST: SizeDesc, SB: SizeDesc, SL: SizeDesc, SR: SizeDesc>(
&self,
top: ST,
bottom: SB,
left: SL,
right: SR
) -> DrawingArea<DB, Shift>
[src]
&self,
top: ST,
bottom: SB,
left: SL,
right: SR
) -> DrawingArea<DB, Shift>
Create a margin for the given drawing area and returns the new drawing area
pub fn split_vertically<S: SizeDesc>(&self, y: S) -> (Self, Self)
[src]
Split the drawing area vertically
pub fn split_horizontally<S: SizeDesc>(&self, x: S) -> (Self, Self)
[src]
Split the drawing area horizontally
pub fn split_evenly(&self, (row, col): (usize, usize)) -> Vec<Self>
[src]
Split the drawing area evenly
pub fn split_by_breakpoints<XSize: SizeDesc, YSize: SizeDesc, XS: AsRef<[XSize]>, YS: AsRef<[YSize]>>(
&self,
xs: XS,
ys: YS
) -> Vec<Self>
[src]
&self,
xs: XS,
ys: YS
) -> Vec<Self>
Split the drawing area into a grid with specified breakpoints on both X axis and Y axis
pub fn titled<'a, S: Into<TextStyle<'a>>>(
&self,
text: &str,
style: S
) -> Result<Self, DrawingAreaErrorKind<DB::ErrorType>>
[src]
&self,
text: &str,
style: S
) -> Result<Self, DrawingAreaErrorKind<DB::ErrorType>>
Draw a title of the drawing area and return the remaining drawing area
pub fn draw_text(
&self,
text: &str,
style: &TextStyle,
pos: BackendCoord
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
[src]
&self,
text: &str,
style: &TextStyle,
pos: BackendCoord
) -> Result<(), DrawingAreaErrorKind<DB::ErrorType>>
Draw text on the drawing area
impl<DB: DrawingBackend, CT: CoordTranslate> DrawingArea<DB, CT>
[src]
pub fn into_coord_spec(self) -> CT
[src]
pub fn as_coord_spec(&self) -> &CT
[src]
Trait Implementations
impl<DB: DrawingBackend, CT: CoordTranslate + Clone> Clone for DrawingArea<DB, CT>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<DB: DrawingBackend> From<DB> for DrawingArea<DB, Shift>
[src]
impl<'a, DB: DrawingBackend> From<&'a Rc<RefCell<DB>>> for DrawingArea<DB, Shift>
[src]
Auto Trait Implementations
impl<DB, CT> !Send for DrawingArea<DB, CT>
impl<DB, CT> Unpin for DrawingArea<DB, CT> where
CT: Unpin,
CT: Unpin,
impl<DB, CT> !Sync for DrawingArea<DB, CT>
impl<DB, CT> !UnwindSafe for DrawingArea<DB, CT>
impl<DB, CT> !RefUnwindSafe for DrawingArea<DB, CT>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,