pub struct CGContext(/* private fields */);
Implementations§
Source§impl CGContext
impl CGContext
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>
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>
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>
pub fn new_image(&self) -> Option<CGImage>
pub fn data(&mut self) -> &mut [u8] ⓘ
pub fn width(&self) -> usize
pub fn height(&self) -> usize
pub fn bits_per_component(&self) -> usize
pub fn bits_per_pixel(&self) -> usize
pub fn bytes_per_row(&self) -> usize
pub fn color_space(&self) -> CGColorSpace
pub fn alpha_info(&self) -> CGImageAlphaInfo
pub fn bitmap_info(&self) -> CGBitmapInfo
Source§impl CGContext
impl CGContext
pub fn save_state(&self)
pub fn restore_state(&self)
pub fn scale(&self, sx: CGFloat, sy: CGFloat)
pub fn translate(&self, tx: CGFloat, ty: CGFloat)
pub fn rotate(&self, angle: CGFloat)
pub fn concat_ctm(&self, transform: CGAffineTransform)
pub fn get_ctm(&self) -> CGAffineTransform
pub fn set_line_width(&self, width: CGFloat)
pub fn set_line_cap(&self, cap: CGLineCap)
pub fn set_line_join(&self, join: CGLineJoin)
pub fn set_line_dash(&self, phase: CGFloat, lengths: &[CGFloat])
pub fn set_miter_limit(&self, limit: CGFloat)
pub fn set_flatness(&self, flatness: CGFloat)
pub fn set_alpha(&self, alpha: CGFloat)
pub fn set_blend_mode(&self, mode: CGBlendMode)
pub fn begin_path(&self)
pub fn close_path(&self)
pub fn move_to_point(&self, x: CGFloat, y: CGFloat)
pub fn add_line_to_point(&self, x: CGFloat, y: CGFloat)
pub fn add_curve_to_point( &self, cp1x: CGFloat, cp1y: CGFloat, cp2x: CGFloat, cp2y: CGFloat, x: CGFloat, y: CGFloat, )
pub fn add_quad_curve_to_point( &self, cpx: CGFloat, cpy: CGFloat, x: CGFloat, y: CGFloat, )
pub fn add_rect(&self, rect: CGRect)
pub fn add_rects(&self, rects: &[CGRect])
pub fn add_lines(&self, points: &[CGPoint])
pub fn add_ellipse_in_rect(&self, rect: CGRect)
pub fn add_arc( &self, x: CGFloat, y: CGFloat, radius: CGFloat, start_angle: CGFloat, end_angle: CGFloat, clockwise: bool, )
pub fn add_arc_to_point( &self, x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat, radius: CGFloat, )
pub fn add_path(&self, path: &CGPath)
pub fn replace_path_with_stroked_path(&self)
pub fn is_path_empty(&self) -> bool
pub fn get_path_current_point(&self) -> CGPoint
pub fn get_path_bounding_box(&self) -> CGRect
pub fn copy_path(&self) -> Option<CGPath>
pub fn path_contains_point( &self, point: CGPoint, mode: CGPathDrawingMode, ) -> bool
pub fn draw_path(&self, mode: CGPathDrawingMode)
pub fn fill_path(&self)
pub fn eo_fill_path(&self)
pub fn stroke_path(&self)
pub fn fill_rect(&self, rect: CGRect)
pub fn fill_rects(&self, rects: &[CGRect])
pub fn stroke_rect(&self, rect: CGRect)
pub fn stroke_rect_with_width(&self, rect: CGRect, width: CGFloat)
pub fn clear_rect(&self, rect: CGRect)
pub fn fill_ellipse_in_rect(&self, rect: CGRect)
pub fn stroke_ellipse_in_rect(&self, rect: CGRect)
pub fn stroke_line_segments(&self, points: &[CGPoint])
pub fn clip(&self)
pub fn eo_clip(&self)
pub fn reset_clip(&self)
pub fn clip_to_mask(&self, rect: CGRect, image: &CGImage)
pub fn clip_bounding_box(&self) -> CGRect
pub fn clip_to_rect(&self, rect: CGRect)
pub fn clip_to_rects(&self, rects: &[CGRect])
pub fn set_fill_color(&self, color: &CGColor)
pub fn set_stroke_color(&self, color: &CGColor)
pub fn set_fill_color_space(&self, space: &CGColorSpace)
pub fn set_stroke_color_space(&self, space: &CGColorSpace)
pub unsafe fn set_fill_pattern( &self, pattern: &CGPattern, components: &[CGFloat], )
pub unsafe fn set_stroke_pattern( &self, pattern: &CGPattern, components: &[CGFloat], )
pub fn set_pattern_phase(&self, phase: CGSize)
pub fn set_gray_fill_color(&self, gray: CGFloat, alpha: CGFloat)
pub fn set_gray_stroke_color(&self, gray: CGFloat, alpha: CGFloat)
pub fn set_rgb_fill_color( &self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, )
pub fn set_rgb_stroke_color( &self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, )
pub fn set_cmyk_fill_color( &self, cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat, )
pub fn set_cmyk_stroke_color( &self, cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat, )
pub fn set_rendering_intent(&self, intent: CGColorRenderingIntent)
pub fn draw_image(&self, rect: CGRect, image: &CGImage)
pub fn draw_tiled_image(&self, rect: CGRect, image: &CGImage)
pub fn get_interpolation_quality(&self) -> CGInterpolationQuality
pub fn set_interpolation_quality(&self, quality: CGInterpolationQuality)
pub fn draw_linear_gradient( &self, gradient: &CGGradient, start_point: CGPoint, end_point: CGPoint, options: CGGradientDrawingOptions, )
pub fn draw_radial_gradient( &self, gradient: &CGGradient, start_center: CGPoint, start_radius: CGFloat, end_center: CGPoint, end_radius: CGFloat, options: CGGradientDrawingOptions, )
pub fn set_shadow(&self, offset: CGSize, blur: CGFloat)
pub fn set_shadow_with_color( &self, offset: CGSize, blur: CGFloat, color: &CGColor, )
pub fn draw_shading(&self, shading: &CGShading)
pub fn set_font(&self, font: &CGFont)
pub fn set_font_size(&self, size: CGFloat)
pub fn set_text_matrix(&self, t: &CGAffineTransform)
pub fn set_text_drawing_mode(&self, mode: CGTextDrawingMode)
pub fn set_text_position(&self, x: CGFloat, y: CGFloat)
pub fn set_allows_font_smoothing(&self, allows_font_smoothing: bool)
pub fn set_should_smooth_fonts(&self, should_smooth_fonts: bool)
pub fn set_allows_antialiasing(&self, allows_antialiasing: bool)
pub fn set_should_antialias(&self, should_antialias: bool)
pub fn set_allows_font_subpixel_quantization( &self, allows_font_subpixel_quantization: bool, )
pub fn set_should_subpixel_quantize_fonts( &self, should_subpixel_quantize_fonts: bool, )
pub fn set_allows_font_subpixel_positioning( &self, allows_font_subpixel_positioning: bool, )
pub fn set_should_subpixel_position_fonts( &self, should_subpixel_position_fonts: bool, )
pub fn set_font_smoothing_style(&self, style: i32)
pub fn show_glyphs_at_positions( &self, glyphs: &[CGGlyph], positions: &[CGPoint], )
pub fn begin_transparency_layer( &self, aux_info: Option<&CFDictionary<CFString, CFType>>, )
pub fn flush(&self)
pub fn synchronize(&self)
pub fn begin_page(&self, media_box: &CGRect)
pub fn end_page(&self)
pub fn begin_transparency_layer_with_rect( &self, rect: CGRect, aux_info: Option<&CFDictionary<CFString, CFType>>, )
pub fn end_transparency_layer(&self)
pub fn get_user_space_to_device_space_transform(&self) -> CGAffineTransform
pub fn convert_point_to_device_space(&self, point: CGPoint) -> CGPoint
pub fn convert_point_to_user_space(&self, point: CGPoint) -> CGPoint
pub fn convert_size_to_device_space(&self, size: CGSize) -> CGSize
pub fn convert_size_to_user_space(&self, size: CGSize) -> CGSize
pub fn convert_rect_to_device_space(&self, rect: CGRect) -> CGRect
pub fn convert_rect_to_user_space(&self, rect: CGRect) -> CGRect
Trait Implementations§
Source§impl TCFType for CGContext
impl TCFType for CGContext
Source§type Ref = *mut __CGContext
type Ref = *mut __CGContext
The reference type wrapped inside this type.
Source§fn as_concrete_TypeRef(&self) -> CGContextRef
fn as_concrete_TypeRef(&self) -> CGContextRef
Returns the object as its concrete
TypeRef
.Source§unsafe fn wrap_under_get_rule(reference: CGContextRef) -> Self
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
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
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 as_CFType(&self) -> CFType
fn as_CFType(&self) -> CFType
Returns the object as a wrapped
CFType
. The reference count is incremented by one.Source§fn into_CFType(self) -> CFTypewhere
Self: Sized,
fn into_CFType(self) -> CFTypewhere
Self: Sized,
Returns the object as a wrapped
CFType
. Consumes self and avoids changing the reference
count.Source§fn retain_count(&self) -> isize
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 instance_of<OtherCFType>(&self) -> boolwhere
OtherCFType: TCFType,
fn instance_of<OtherCFType>(&self) -> boolwhere
OtherCFType: TCFType,
Returns
true
if this value is an instance of another type.impl ConcreteCFType for CGContext
impl Eq for CGContext
Auto Trait Implementations§
impl Freeze for CGContext
impl RefUnwindSafe for CGContext
impl !Send for CGContext
impl !Sync for CGContext
impl Unpin for CGContext
impl UnwindSafe for CGContext
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