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 default for piet. To map between the two coordinate spaces you must also pass an explicit height argument.
The optional text
argument can be a reusable 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 reusable 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>
Source§type Text = CoreGraphicsText
type Text = CoreGraphicsText
An associated factory for creating text layouts and related resources.
Source§type TextLayout = CoreGraphicsTextLayout
type TextLayout = CoreGraphicsTextLayout
The type use to represent text layout objects.
Source§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_with_stride(
&mut self,
width: usize,
height: usize,
stride: usize,
buf: &[u8],
format: ImageFormat,
) -> Result<Self::Image, Error>
fn make_image_with_stride( &mut self, width: usize, height: usize, stride: 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> Freeze for CoreGraphicsContext<'a>
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> 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
Mutably borrows from an owned value. Read more
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.