Struct CGContext

Source
pub struct CGContext(/* private fields */);

Implementations§

Source§

impl CGContext

Source

pub fn new_bitmap_context( width: size_t, height: size_t, bits_per_component: size_t, bytes_per_row: size_t, space: Option<&CGColorSpace>, bitmap_info: u32, ) -> Option<Self>

Source

pub unsafe fn new_bitmap_context_with_data( data: &mut [u8], width: size_t, height: size_t, bits_per_component: size_t, bytes_per_row: size_t, space: Option<&CGColorSpace>, bitmap_info: u32, ) -> Option<Self>

Source

pub fn new_bitmap_context_with_bitmap_data( bitmap_data: Box<Box<dyn BitmapData>>, bits_per_component: size_t, space: Option<&CGColorSpace>, bitmap_info: u32, ) -> Option<Self>

Source

pub fn new_image(&self) -> Option<CGImage>

Source

pub fn data(&mut self) -> &mut [u8]

Source

pub fn width(&self) -> usize

Source

pub fn height(&self) -> usize

Source

pub fn bits_per_component(&self) -> usize

Source

pub fn bits_per_pixel(&self) -> usize

Source

pub fn bytes_per_row(&self) -> usize

Source

pub fn color_space(&self) -> CGColorSpace

Source

pub fn alpha_info(&self) -> CGImageAlphaInfo

Source

pub fn bitmap_info(&self) -> CGBitmapInfo

Source§

impl CGContext

Source

pub fn save_state(&self)

Source

pub fn restore_state(&self)

Source

pub fn scale(&self, sx: CGFloat, sy: CGFloat)

Source

pub fn translate(&self, tx: CGFloat, ty: CGFloat)

Source

pub fn rotate(&self, angle: CGFloat)

Source

pub fn concat_ctm(&self, transform: CGAffineTransform)

Source

pub fn get_ctm(&self) -> CGAffineTransform

Source

pub fn set_line_width(&self, width: CGFloat)

Source

pub fn set_line_cap(&self, cap: CGLineCap)

Source

pub fn set_line_join(&self, join: CGLineJoin)

Source

pub fn set_line_dash(&self, phase: CGFloat, lengths: &[CGFloat])

Source

pub fn set_miter_limit(&self, limit: CGFloat)

Source

pub fn set_flatness(&self, flatness: CGFloat)

Source

pub fn set_alpha(&self, alpha: CGFloat)

Source

pub fn set_blend_mode(&self, mode: CGBlendMode)

Source

pub fn begin_path(&self)

Source

pub fn close_path(&self)

Source

pub fn move_to_point(&self, x: CGFloat, y: CGFloat)

Source

pub fn add_line_to_point(&self, x: CGFloat, y: CGFloat)

Source

pub fn add_curve_to_point( &self, cp1x: CGFloat, cp1y: CGFloat, cp2x: CGFloat, cp2y: CGFloat, x: CGFloat, y: CGFloat, )

Source

pub fn add_quad_curve_to_point( &self, cpx: CGFloat, cpy: CGFloat, x: CGFloat, y: CGFloat, )

Source

pub fn add_rect(&self, rect: CGRect)

Source

pub fn add_rects(&self, rects: &[CGRect])

Source

pub fn add_lines(&self, points: &[CGPoint])

Source

pub fn add_ellipse_in_rect(&self, rect: CGRect)

Source

pub fn add_arc( &self, x: CGFloat, y: CGFloat, radius: CGFloat, start_angle: CGFloat, end_angle: CGFloat, clockwise: bool, )

Source

pub fn add_arc_to_point( &self, x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat, radius: CGFloat, )

Source

pub fn add_path(&self, path: &CGPath)

Source

pub fn replace_path_with_stroked_path(&self)

Source

pub fn is_path_empty(&self) -> bool

Source

pub fn get_path_current_point(&self) -> CGPoint

Source

pub fn get_path_bounding_box(&self) -> CGRect

Source

pub fn copy_path(&self) -> Option<CGPath>

Source

pub fn path_contains_point( &self, point: CGPoint, mode: CGPathDrawingMode, ) -> bool

Source

pub fn draw_path(&self, mode: CGPathDrawingMode)

Source

pub fn fill_path(&self)

Source

pub fn eo_fill_path(&self)

Source

pub fn stroke_path(&self)

Source

pub fn fill_rect(&self, rect: CGRect)

Source

pub fn fill_rects(&self, rects: &[CGRect])

Source

pub fn stroke_rect(&self, rect: CGRect)

Source

pub fn stroke_rect_with_width(&self, rect: CGRect, width: CGFloat)

Source

pub fn clear_rect(&self, rect: CGRect)

Source

pub fn fill_ellipse_in_rect(&self, rect: CGRect)

Source

pub fn stroke_ellipse_in_rect(&self, rect: CGRect)

Source

pub fn stroke_line_segments(&self, points: &[CGPoint])

Source

pub fn clip(&self)

Source

pub fn eo_clip(&self)

Source

pub fn reset_clip(&self)

Source

pub fn clip_to_mask(&self, rect: CGRect, image: &CGImage)

Source

pub fn clip_bounding_box(&self) -> CGRect

Source

pub fn clip_to_rect(&self, rect: CGRect)

Source

pub fn clip_to_rects(&self, rects: &[CGRect])

Source

pub fn set_fill_color(&self, color: &CGColor)

Source

pub fn set_stroke_color(&self, color: &CGColor)

Source

pub fn set_fill_color_space(&self, space: &CGColorSpace)

Source

pub fn set_stroke_color_space(&self, space: &CGColorSpace)

Source

pub unsafe fn set_fill_pattern( &self, pattern: &CGPattern, components: &[CGFloat], )

Source

pub unsafe fn set_stroke_pattern( &self, pattern: &CGPattern, components: &[CGFloat], )

Source

pub fn set_pattern_phase(&self, phase: CGSize)

Source

pub fn set_gray_fill_color(&self, gray: CGFloat, alpha: CGFloat)

Source

pub fn set_gray_stroke_color(&self, gray: CGFloat, alpha: CGFloat)

Source

pub fn set_rgb_fill_color( &self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, )

Source

pub fn set_rgb_stroke_color( &self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, )

Source

pub fn set_cmyk_fill_color( &self, cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat, )

Source

pub fn set_cmyk_stroke_color( &self, cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat, )

Source

pub fn set_rendering_intent(&self, intent: CGColorRenderingIntent)

Source

pub fn draw_image(&self, rect: CGRect, image: &CGImage)

Source

pub fn draw_tiled_image(&self, rect: CGRect, image: &CGImage)

Source

pub fn get_interpolation_quality(&self) -> CGInterpolationQuality

Source

pub fn set_interpolation_quality(&self, quality: CGInterpolationQuality)

Source

pub fn draw_linear_gradient( &self, gradient: &CGGradient, start_point: CGPoint, end_point: CGPoint, options: CGGradientDrawingOptions, )

Source

pub fn draw_radial_gradient( &self, gradient: &CGGradient, start_center: CGPoint, start_radius: CGFloat, end_center: CGPoint, end_radius: CGFloat, options: CGGradientDrawingOptions, )

Source

pub fn set_shadow(&self, offset: CGSize, blur: CGFloat)

Source

pub fn set_shadow_with_color( &self, offset: CGSize, blur: CGFloat, color: &CGColor, )

Source

pub fn draw_shading(&self, shading: &CGShading)

Source

pub fn set_font(&self, font: &CGFont)

Source

pub fn set_font_size(&self, size: CGFloat)

Source

pub fn set_text_matrix(&self, t: &CGAffineTransform)

Source

pub fn set_text_drawing_mode(&self, mode: CGTextDrawingMode)

Source

pub fn set_text_position(&self, x: CGFloat, y: CGFloat)

Source

pub fn set_allows_font_smoothing(&self, allows_font_smoothing: bool)

Source

pub fn set_should_smooth_fonts(&self, should_smooth_fonts: bool)

Source

pub fn set_allows_antialiasing(&self, allows_antialiasing: bool)

Source

pub fn set_should_antialias(&self, should_antialias: bool)

Source

pub fn set_allows_font_subpixel_quantization( &self, allows_font_subpixel_quantization: bool, )

Source

pub fn set_should_subpixel_quantize_fonts( &self, should_subpixel_quantize_fonts: bool, )

Source

pub fn set_allows_font_subpixel_positioning( &self, allows_font_subpixel_positioning: bool, )

Source

pub fn set_should_subpixel_position_fonts( &self, should_subpixel_position_fonts: bool, )

Source

pub fn set_font_smoothing_style(&self, style: i32)

Source

pub fn show_glyphs_at_positions( &self, glyphs: &[CGGlyph], positions: &[CGPoint], )

Source

pub fn begin_transparency_layer( &self, aux_info: Option<&CFDictionary<CFString, CFType>>, )

Source

pub fn flush(&self)

Source

pub fn synchronize(&self)

Source

pub fn begin_page(&self, media_box: &CGRect)

Source

pub fn end_page(&self)

Source

pub fn begin_transparency_layer_with_rect( &self, rect: CGRect, aux_info: Option<&CFDictionary<CFString, CFType>>, )

Source

pub fn end_transparency_layer(&self)

Source

pub fn get_user_space_to_device_space_transform(&self) -> CGAffineTransform

Source

pub fn convert_point_to_device_space(&self, point: CGPoint) -> CGPoint

Source

pub fn convert_point_to_user_space(&self, point: CGPoint) -> CGPoint

Source

pub fn convert_size_to_device_space(&self, size: CGSize) -> CGSize

Source

pub fn convert_size_to_user_space(&self, size: CGSize) -> CGSize

Source

pub fn convert_rect_to_device_space(&self, rect: CGRect) -> CGRect

Source

pub fn convert_rect_to_user_space(&self, rect: CGRect) -> CGRect

Source§

impl CGContext

Source

pub fn draw_layer_in_rect(&self, layer: &CGLayer, rect: CGRect)

Source

pub fn draw_layer_at_point(&self, layer: &CGLayer, point: CGPoint)

Trait Implementations§

Source§

impl Clone for CGContext

Source§

fn clone(&self) -> CGContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CGContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CGContext

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for CGContext

Source§

fn eq(&self, other: &CGContext) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TCFType for CGContext

Source§

type Ref = *mut __CGContext

The reference type wrapped inside this type.
Source§

fn as_concrete_TypeRef(&self) -> CGContextRef

Returns the object as its concrete TypeRef.
Source§

unsafe fn wrap_under_get_rule(reference: CGContextRef) -> Self

Returns an instance of the object, wrapping the underlying CFTypeRef subclass. Use this when following Core Foundation’s “Get Rule”. The reference count is bumped.
Source§

fn as_CFTypeRef(&self) -> CFTypeRef

Returns the object as a raw CFTypeRef. The reference count is not adjusted.
Source§

unsafe fn wrap_under_create_rule(reference: CGContextRef) -> Self

Returns an instance of the object, wrapping the underlying CFTypeRef subclass. Use this when following Core Foundation’s “Create Rule”. The reference count is not bumped.
Source§

fn type_id() -> CFTypeID

Returns the type ID for this class.
Source§

fn as_CFType(&self) -> CFType

Returns the object as a wrapped CFType. The reference count is incremented by one.
Source§

fn into_CFType(self) -> CFType
where Self: Sized,

Returns the object as a wrapped CFType. Consumes self and avoids changing the reference count.
Source§

fn retain_count(&self) -> isize

Returns the reference count of the object. It is unwise to do anything other than test whether the return value of this method is greater than zero.
Source§

fn type_of(&self) -> usize

Returns the type ID of this object.
Source§

fn show(&self)

Writes a debugging version of this object on standard error.
Source§

fn instance_of<OtherCFType>(&self) -> bool
where OtherCFType: TCFType,

Returns true if this value is an instance of another type.
Source§

impl<'a> ToVoid<CGContext> for &'a CGContext

Source§

impl ToVoid<CGContext> for CGContextRef

Source§

impl ToVoid<CGContext> for CGContext

Source§

impl ConcreteCFType for CGContext

Source§

impl Eq for CGContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromMutVoid for T
where T: TCFType,

Source§

unsafe fn from_mut_void<'a>(x: *mut c_void) -> ItemMutRef<'a, T>

Source§

impl<T> FromVoid for T
where T: TCFType,

Source§

unsafe fn from_void<'a>(x: *const c_void) -> ItemRef<'a, T>

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,