Struct piet_coregraphics::CoreGraphicsContext
source · pub struct CoreGraphicsContext<'a> { /* private fields */ }Implementations§
source§impl<'a> CoreGraphicsContext<'a>
impl<'a> CoreGraphicsContext<'a>
sourcepub fn new_y_up(
ctx: &mut CGContextRef,
height: f64,
text: Option<CoreGraphicsText>
) -> CoreGraphicsContext<'_>
pub fn new_y_up(
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.
sourcepub fn new_y_down(
ctx: &mut CGContextRef,
text: Option<CoreGraphicsText>
) -> CoreGraphicsContext<'_>
pub fn new_y_down(
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§
source§impl<'a> Drop for CoreGraphicsContext<'a>
impl<'a> Drop for CoreGraphicsContext<'a>
source§impl<'a> RenderContext for CoreGraphicsContext<'a>
impl<'a> RenderContext for CoreGraphicsContext<'a>
§type Text = CoreGraphicsText
type Text = CoreGraphicsText
An associated factory for creating text layouts and related resources.
§type TextLayout = CoreGraphicsTextLayout
type TextLayout = CoreGraphicsTextLayout
The type use to represent text layout objects.
§type Image = CoreGraphicsImage
type Image = CoreGraphicsImage
The associated type of an image.
source§fn gradient(
&mut self,
gradient: impl Into<FixedGradient>
) -> Result<Brush, Error>
fn gradient(
&mut self,
gradient: impl Into<FixedGradient>
) -> Result<Brush, Error>
Create a new gradient brush.
source§fn fill_even_odd(&mut self, shape: impl Shape, brush: &impl IntoBrush<Self>)
fn fill_even_odd(&mut self, shape: impl Shape, brush: &impl IntoBrush<Self>)
Fill a shape, using the even-odd fill rule.
source§fn stroke(&mut self, shape: impl Shape, brush: &impl IntoBrush<Self>, width: f64)
fn stroke(&mut self, shape: impl Shape, brush: &impl IntoBrush<Self>, width: f64)
Stroke a [
Shape], using the default StrokeStyle.source§fn stroke_styled(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<Self>,
width: f64,
style: &StrokeStyle
)
fn stroke_styled(
&mut self,
shape: impl Shape,
brush: &impl IntoBrush<Self>,
width: f64,
style: &StrokeStyle
)
Stroke a [
Shape], providing a custom StrokeStyle.source§fn draw_text(&mut self, layout: &Self::TextLayout, pos: impl Into<Point>)
fn draw_text(&mut self, layout: &Self::TextLayout, pos: impl Into<Point>)
Draw a
TextLayout. Read moresource§fn make_image(
&mut self,
width: usize,
height: usize,
buf: &[u8],
format: ImageFormat
) -> Result<Self::Image, Error>
fn make_image(
&mut self,
width: usize,
height: usize,
buf: &[u8],
format: ImageFormat
) -> Result<Self::Image, Error>
source§fn draw_image(
&mut self,
src_image: &Self::Image,
rect: impl Into<Rect>,
interp: InterpolationMode
)
fn draw_image(
&mut self,
src_image: &Self::Image,
rect: impl Into<Rect>,
interp: InterpolationMode
)
source§fn draw_image_area(
&mut self,
image: &Self::Image,
src_rect: impl Into<Rect>,
dst_rect: impl Into<Rect>,
interp: InterpolationMode
)
fn draw_image_area(
&mut self,
image: &Self::Image,
src_rect: impl Into<Rect>,
dst_rect: impl Into<Rect>,
interp: InterpolationMode
)
source§fn blurred_rect(
&mut self,
rect: Rect,
blur_radius: f64,
brush: &impl IntoBrush<Self>
)
fn blurred_rect(
&mut self,
rect: Rect,
blur_radius: f64,
brush: &impl IntoBrush<Self>
)
Draw a rectangle with Gaussian blur. Read more
source§fn current_transform(&self) -> Affine
fn current_transform(&self) -> Affine
Returns the transformations currently applied to the context.
impl<'a> IntoBrush<CoreGraphicsContext<'a>> for Brush
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CoreGraphicsContext<'a>
impl<'a> !Send for CoreGraphicsContext<'a>
impl<'a> !Sync for CoreGraphicsContext<'a>
impl<'a> Unpin for CoreGraphicsContext<'a>
impl<'a> !UnwindSafe for CoreGraphicsContext<'a>
Blanket Implementations§
source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.