Trait embedded_graphics::image::ImageDrawable [−][src]
pub trait ImageDrawable: OriginDimensions { type Color: PixelColor; fn draw<D>(&self, target: &mut D) -> Result<(), <D as DrawTarget>::Error>
where
D: DrawTarget<Color = Self::Color>; fn draw_sub_image<D>(
&self,
target: &mut D,
area: &Rectangle
) -> Result<(), <D as DrawTarget>::Error>
where
D: DrawTarget<Color = Self::Color>; }
Expand description
Image drawable.
ImageDrawable
is implemented for types that contains image information, which makes them
usable with the Image
object.
The methods in this trait shouldn’t be called directly by user code. Instead the object
that implements ImageDrawable
should be wrapped in an Image
object.
Implementing ImageDrawable
All image drawables are positioned at the origin and need to implement OriginDimensions
, in
addition to this trait, to define their dimensions.
Associated Types
type Color: PixelColor
[src]
type Color: PixelColor
[src]The color type.
Required methods
fn draw<D>(&self, target: &mut D) -> Result<(), <D as DrawTarget>::Error> where
D: DrawTarget<Color = Self::Color>,
[src]
fn draw<D>(&self, target: &mut D) -> Result<(), <D as DrawTarget>::Error> where
D: DrawTarget<Color = Self::Color>,
[src]Draws the entire image to the target.
This method shouldn’t be called directly by user code. Use an Image
object instead.
Implementation notes
The implementation of this method must draw the image inside the bounding box defined by
the OriginDimensions
trait implementation. This means that the top left corner is at the
origin and no drawing operations outside the bounding box are allowed.
fn draw_sub_image<D>(
&self,
target: &mut D,
area: &Rectangle
) -> Result<(), <D as DrawTarget>::Error> where
D: DrawTarget<Color = Self::Color>,
[src]
fn draw_sub_image<D>(
&self,
target: &mut D,
area: &Rectangle
) -> Result<(), <D as DrawTarget>::Error> where
D: DrawTarget<Color = Self::Color>,
[src]Draws a part of the image to the target.
This method shouldn’t be called directly by user code. Use a SubImage
object instead.
Implementation notes
The implementation of this method must draw the image inside the given area
.
It must be ensured that no drawing operation outside this Rectangle
occur.
Implementors
impl<'a, C, BO> ImageDrawable for ImageRaw<'a, C, BO> where
C: PixelColor + From<<C as PixelColor>::Raw>,
BO: ByteOrder,
RawDataSlice<'a, C::Raw, BO>: IntoIterator<Item = C::Raw>,
[src]
impl<'a, C, BO> ImageDrawable for ImageRaw<'a, C, BO> where
C: PixelColor + From<<C as PixelColor>::Raw>,
BO: ByteOrder,
RawDataSlice<'a, C::Raw, BO>: IntoIterator<Item = C::Raw>,
[src]