[−]Struct druid::piet::CoreGraphicsContext
Implementations
impl<'a> CoreGraphicsContext<'a>
pub fn new_y_up(
ctx: &mut CGContextRef,
height: f64,
text: Option<CoreGraphicsText>
) -> CoreGraphicsContext<'_>
ctx: &mut CGContextRef,
height: f64,
text: Option<CoreGraphicsText>
) -> CoreGraphicsContext<'_>
Create a new context with the y-origin at the top-left corner.
This is not the default for CoreGraphics; but it is the defualt for piet. To map between the two coordinate spaces you must also pass an explicit height argument.
The optional text
argument can be a reuseable CoreGraphicsText
struct;
a new one will be constructed if None
is passed.
pub fn new_y_down(
ctx: &mut CGContextRef,
text: Option<CoreGraphicsText>
) -> CoreGraphicsContext<'_>
ctx: &mut CGContextRef,
text: Option<CoreGraphicsText>
) -> CoreGraphicsContext<'_>
Create a new context with the y-origin at the bottom right corner.
This is the default for core graphics, but not for piet.
The optional text
argument can be a reuseable CoreGraphicsText
struct;
a new one will be constructed if None
is passed.
Trait Implementations
impl<'a> Drop for CoreGraphicsContext<'a>
pub fn drop(&mut self)
impl<'a> IntoBrush<CoreGraphicsContext<'a>> for Brush
pub fn make_brush(
&'b self,
_piet: &mut CoreGraphicsContext<'_>,
_bbox: impl FnOnce() -> Rect
) -> Cow<'b, Brush>
&'b self,
_piet: &mut CoreGraphicsContext<'_>,
_bbox: impl FnOnce() -> Rect
) -> Cow<'b, Brush>
impl<'a> RenderContext for CoreGraphicsContext<'a>
type Brush = Brush
The type of a "brush". Read more
type Text = CoreGraphicsText
An associated factory for creating text layouts and related resources.
type TextLayout = CoreGraphicsTextLayout
type Image = CoreGraphicsImage
The associated type of an image.
pub fn clear(&mut self, color: Color)
pub fn solid_brush(&mut self, color: Color) -> Brush
pub fn gradient(
&mut self,
gradient: impl Into<FixedGradient>
) -> Result<Brush, Error>
&mut self,
gradient: impl Into<FixedGradient>
) -> Result<Brush, Error>
pub fn fill(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>
)
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>
)
Fill a shape.
pub fn fill_even_odd(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>
)
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>
)
pub fn clip(&mut self, shape: impl Shape)
pub fn stroke(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>,
width: f64
)
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>,
width: f64
)
pub fn stroke_styled(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>,
width: f64,
style: &StrokeStyle
)
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>,
width: f64,
style: &StrokeStyle
)
pub fn text(&mut self) -> &mut <CoreGraphicsContext<'a> as RenderContext>::Text
pub fn draw_text(
&mut self,
layout: &<CoreGraphicsContext<'a> as RenderContext>::TextLayout,
pos: impl Into<Point>
)
&mut self,
layout: &<CoreGraphicsContext<'a> as RenderContext>::TextLayout,
pos: impl Into<Point>
)
pub fn save(&mut self) -> Result<(), Error>
pub fn restore(&mut self) -> Result<(), Error>
pub fn finish(&mut self) -> Result<(), Error>
pub fn transform(&mut self, transform: Affine)
pub fn make_image(
&mut self,
width: usize,
height: usize,
buf: &[u8],
format: ImageFormat
) -> Result<<CoreGraphicsContext<'a> as RenderContext>::Image, Error>
&mut self,
width: usize,
height: usize,
buf: &[u8],
format: ImageFormat
) -> Result<<CoreGraphicsContext<'a> as RenderContext>::Image, Error>
pub fn draw_image(
&mut self,
image: &<CoreGraphicsContext<'a> as RenderContext>::Image,
rect: impl Into<Rect>,
interp: InterpolationMode
)
&mut self,
image: &<CoreGraphicsContext<'a> as RenderContext>::Image,
rect: impl Into<Rect>,
interp: InterpolationMode
)
pub fn draw_image_area(
&mut self,
image: &<CoreGraphicsContext<'a> as RenderContext>::Image,
src_rect: impl Into<Rect>,
dst_rect: impl Into<Rect>,
_interp: InterpolationMode
)
&mut self,
image: &<CoreGraphicsContext<'a> as RenderContext>::Image,
src_rect: impl Into<Rect>,
dst_rect: impl Into<Rect>,
_interp: InterpolationMode
)
pub fn blurred_rect(
&mut self,
rect: Rect,
blur_radius: f64,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>
)
&mut self,
rect: Rect,
blur_radius: f64,
brush: &impl IntoBrush<CoreGraphicsContext<'a>>
)
pub fn current_transform(&self) -> Affine
pub fn status(&mut self) -> Result<(), Error>
pub fn with_save(
&mut self,
f: impl FnOnce(&mut Self) -> Result<(), Error>
) -> Result<(), Error>
&mut self,
f: impl FnOnce(&mut Self) -> Result<(), Error>
) -> Result<(), Error>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for CoreGraphicsContext<'a>
[src]
impl<'a> !Send for CoreGraphicsContext<'a>
[src]
impl<'a> !Sync for CoreGraphicsContext<'a>
[src]
impl<'a> Unpin for CoreGraphicsContext<'a>
[src]
impl<'a> !UnwindSafe for CoreGraphicsContext<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
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.
pub 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>,