pub struct CGContext { /* private fields */ }Expand description
Implementations§
Source§impl CGContext
impl CGContext
Sourcepub fn save_g_state(c: Option<&CGContext>)
pub fn save_g_state(c: Option<&CGContext>)
Graphics state functions. *
pub fn restore_g_state(c: Option<&CGContext>)
pub fn translate_ctm(c: Option<&CGContext>, tx: f64, ty: f64)
pub fn rotate_ctm(c: Option<&CGContext>, angle: f64)
pub fn concat_ctm(c: Option<&CGContext>, transform: CGAffineTransform)
pub fn ctm(c: Option<&CGContext>) -> CGAffineTransform
Sourcepub fn set_line_width(c: Option<&CGContext>, width: f64)
pub fn set_line_width(c: Option<&CGContext>, width: f64)
Drawing attribute functions. *
pub fn set_line_cap(c: Option<&CGContext>, cap: CGLineCap)
pub fn set_line_join(c: Option<&CGContext>, join: CGLineJoin)
pub fn set_miter_limit(c: Option<&CGContext>, limit: f64)
Sourcepub unsafe fn set_line_dash(
c: Option<&CGContext>,
phase: f64,
lengths: *const f64,
count: usize,
)
pub unsafe fn set_line_dash( c: Option<&CGContext>, phase: f64, lengths: *const f64, count: usize, )
§Safety
lengths must be a valid pointer or null.
pub fn set_flatness(c: Option<&CGContext>, flatness: f64)
pub fn set_alpha(c: Option<&CGContext>, alpha: f64)
pub fn set_blend_mode(c: Option<&CGContext>, mode: CGBlendMode)
Sourcepub fn begin_path(c: Option<&CGContext>)
pub fn begin_path(c: Option<&CGContext>)
Path construction functions. *
pub fn move_to_point(c: Option<&CGContext>, x: f64, y: f64)
pub fn add_line_to_point(c: Option<&CGContext>, x: f64, y: f64)
pub fn add_curve_to_point( c: Option<&CGContext>, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64, )
pub fn add_quad_curve_to_point( c: Option<&CGContext>, cpx: f64, cpy: f64, x: f64, y: f64, )
pub fn close_path(c: Option<&CGContext>)
Sourcepub fn add_rect(c: Option<&CGContext>, rect: CGRect)
pub fn add_rect(c: Option<&CGContext>, rect: CGRect)
Path construction convenience functions. *
Sourcepub unsafe fn add_rects(
c: Option<&CGContext>,
rects: *const CGRect,
count: usize,
)
pub unsafe fn add_rects( c: Option<&CGContext>, rects: *const CGRect, count: usize, )
§Safety
rects must be a valid pointer or null.
Sourcepub unsafe fn add_lines(
c: Option<&CGContext>,
points: *const CGPoint,
count: usize,
)
pub unsafe fn add_lines( c: Option<&CGContext>, points: *const CGPoint, count: usize, )
§Safety
points must be a valid pointer or null.
pub fn add_ellipse_in_rect(c: Option<&CGContext>, rect: CGRect)
pub fn add_arc( c: Option<&CGContext>, x: f64, y: f64, radius: f64, start_angle: f64, end_angle: f64, clockwise: i32, )
pub fn add_arc_to_point( c: Option<&CGContext>, x1: f64, y1: f64, x2: f64, y2: f64, radius: f64, )
pub fn add_path(c: Option<&CGContext>, path: Option<&CGPath>)
pub fn replace_path_with_stroked_path(c: Option<&CGContext>)
Sourcepub fn is_path_empty(c: Option<&CGContext>) -> bool
pub fn is_path_empty(c: Option<&CGContext>) -> bool
Path information functions. *
pub fn path_current_point(c: Option<&CGContext>) -> CGPoint
pub fn path_bounding_box(c: Option<&CGContext>) -> CGRect
pub fn path(c: Option<&CGContext>) -> Option<CFRetained<CGPath>>
pub fn path_contains_point( c: Option<&CGContext>, point: CGPoint, mode: CGPathDrawingMode, ) -> bool
Sourcepub fn draw_path(c: Option<&CGContext>, mode: CGPathDrawingMode)
pub fn draw_path(c: Option<&CGContext>, mode: CGPathDrawingMode)
Path drawing functions. *
pub fn eo_fill_path(c: Option<&CGContext>)
pub fn stroke_path(c: Option<&CGContext>)
pub fn fill_rect(c: Option<&CGContext>, rect: CGRect)
Sourcepub unsafe fn fill_rects(
c: Option<&CGContext>,
rects: *const CGRect,
count: usize,
)
pub unsafe fn fill_rects( c: Option<&CGContext>, rects: *const CGRect, count: usize, )
§Safety
rects must be a valid pointer or null.
pub fn stroke_rect(c: Option<&CGContext>, rect: CGRect)
pub fn stroke_rect_with_width(c: Option<&CGContext>, rect: CGRect, width: f64)
pub fn clear_rect(c: Option<&CGContext>, rect: CGRect)
pub fn fill_ellipse_in_rect(c: Option<&CGContext>, rect: CGRect)
pub fn stroke_ellipse_in_rect(c: Option<&CGContext>, rect: CGRect)
Sourcepub unsafe fn stroke_line_segments(
c: Option<&CGContext>,
points: *const CGPoint,
count: usize,
)
pub unsafe fn stroke_line_segments( c: Option<&CGContext>, points: *const CGPoint, count: usize, )
§Safety
points must be a valid pointer or null.
pub fn eo_clip(c: Option<&CGContext>)
pub fn reset_clip(&self)
pub fn clip_to_mask(c: Option<&CGContext>, rect: CGRect, mask: Option<&CGImage>)
pub fn clip_bounding_box(c: Option<&CGContext>) -> CGRect
Sourcepub fn clip_to_rect(c: Option<&CGContext>, rect: CGRect)
pub fn clip_to_rect(c: Option<&CGContext>, rect: CGRect)
Clipping convenience functions. *
Sourcepub unsafe fn clip_to_rects(
c: Option<&CGContext>,
rects: NonNull<CGRect>,
count: usize,
)
pub unsafe fn clip_to_rects( c: Option<&CGContext>, rects: NonNull<CGRect>, count: usize, )
§Safety
rects must be a valid pointer.
Sourcepub fn set_fill_color_with_color(c: Option<&CGContext>, color: Option<&CGColor>)
pub fn set_fill_color_with_color(c: Option<&CGContext>, color: Option<&CGColor>)
Primitive color functions. *
pub fn set_stroke_color_with_color( c: Option<&CGContext>, color: Option<&CGColor>, )
Sourcepub fn set_fill_color_space(c: Option<&CGContext>, space: Option<&CGColorSpace>)
pub fn set_fill_color_space(c: Option<&CGContext>, space: Option<&CGColorSpace>)
Color space functions. *
pub fn set_stroke_color_space( c: Option<&CGContext>, space: Option<&CGColorSpace>, )
Sourcepub unsafe fn set_stroke_color(c: Option<&CGContext>, components: *const f64)
pub unsafe fn set_stroke_color(c: Option<&CGContext>, components: *const f64)
§Safety
components must be a valid pointer or null.
Sourcepub unsafe fn set_fill_pattern(
c: Option<&CGContext>,
pattern: Option<&CGPattern>,
components: *const f64,
)
pub unsafe fn set_fill_pattern( c: Option<&CGContext>, pattern: Option<&CGPattern>, components: *const f64, )
Sourcepub unsafe fn set_stroke_pattern(
c: Option<&CGContext>,
pattern: Option<&CGPattern>,
components: *const f64,
)
pub unsafe fn set_stroke_pattern( c: Option<&CGContext>, pattern: Option<&CGPattern>, components: *const f64, )
§Safety
components must be a valid pointer or null.
pub fn set_pattern_phase(c: Option<&CGContext>, phase: CGSize)
Sourcepub fn set_gray_fill_color(c: Option<&CGContext>, gray: f64, alpha: f64)
pub fn set_gray_fill_color(c: Option<&CGContext>, gray: f64, alpha: f64)
Color convenience functions. *
pub fn set_gray_stroke_color(c: Option<&CGContext>, gray: f64, alpha: f64)
pub fn set_rgb_fill_color( c: Option<&CGContext>, red: f64, green: f64, blue: f64, alpha: f64, )
pub fn set_rgb_stroke_color( c: Option<&CGContext>, red: f64, green: f64, blue: f64, alpha: f64, )
pub fn set_cmyk_fill_color( c: Option<&CGContext>, cyan: f64, magenta: f64, yellow: f64, black: f64, alpha: f64, )
pub fn set_cmyk_stroke_color( c: Option<&CGContext>, cyan: f64, magenta: f64, yellow: f64, black: f64, alpha: f64, )
Sourcepub fn set_rendering_intent(
c: Option<&CGContext>,
intent: CGColorRenderingIntent,
)
pub fn set_rendering_intent( c: Option<&CGContext>, intent: CGColorRenderingIntent, )
Rendering intent. *
pub fn set_edr_target_headroom(&self, headroom: f32) -> bool
pub fn edr_target_headroom(&self) -> f32
Sourcepub fn draw_image(c: Option<&CGContext>, rect: CGRect, image: Option<&CGImage>)
pub fn draw_image(c: Option<&CGContext>, rect: CGRect, image: Option<&CGImage>)
Image functions. *
pub fn draw_tiled_image( c: Option<&CGContext>, rect: CGRect, image: Option<&CGImage>, )
Sourcepub unsafe fn draw_image_applying_tone_mapping(
&self,
r: CGRect,
image: &CGImage,
method: CGToneMapping,
options: Option<&CFDictionary>,
) -> bool
pub unsafe fn draw_image_applying_tone_mapping( &self, r: CGRect, image: &CGImage, method: CGToneMapping, options: Option<&CFDictionary>, ) -> bool
§Safety
options generics must be of the correct type.
pub fn content_tone_mapping_info(&self) -> CGContentToneMappingInfo
Sourcepub unsafe fn set_content_tone_mapping_info(
&self,
info: CGContentToneMappingInfo,
)
pub unsafe fn set_content_tone_mapping_info( &self, info: CGContentToneMappingInfo, )
§Safety
info struct field 2 must be a valid pointer or null.
pub fn interpolation_quality(c: Option<&CGContext>) -> CGInterpolationQuality
pub fn set_interpolation_quality( c: Option<&CGContext>, quality: CGInterpolationQuality, )
pub fn set_shadow_with_color( c: Option<&CGContext>, offset: CGSize, blur: f64, color: Option<&CGColor>, )
pub fn set_shadow(c: Option<&CGContext>, offset: CGSize, blur: f64)
pub fn draw_linear_gradient( c: Option<&CGContext>, gradient: Option<&CGGradient>, start_point: CGPoint, end_point: CGPoint, options: CGGradientDrawingOptions, )
pub fn draw_radial_gradient( c: Option<&CGContext>, gradient: Option<&CGGradient>, start_center: CGPoint, start_radius: f64, end_center: CGPoint, end_radius: f64, options: CGGradientDrawingOptions, )
pub fn draw_conic_gradient( &self, gradient: Option<&CGGradient>, center: CGPoint, angle: f64, )
pub fn draw_shading(c: Option<&CGContext>, shading: Option<&CGShading>)
Sourcepub fn set_character_spacing(c: Option<&CGContext>, spacing: f64)
pub fn set_character_spacing(c: Option<&CGContext>, spacing: f64)
Text functions. *
pub fn set_text_position(c: Option<&CGContext>, x: f64, y: f64)
pub fn text_position(c: Option<&CGContext>) -> CGPoint
pub fn set_text_matrix(c: Option<&CGContext>, t: CGAffineTransform)
pub fn text_matrix(c: Option<&CGContext>) -> CGAffineTransform
pub fn set_text_drawing_mode(c: Option<&CGContext>, mode: CGTextDrawingMode)
pub fn set_font(c: Option<&CGContext>, font: Option<&CGFont>)
pub fn set_font_size(c: Option<&CGContext>, size: f64)
Sourcepub unsafe fn show_glyphs_at_positions(
c: Option<&CGContext>,
glyphs: *const u16,
lpositions: *const CGPoint,
count: usize,
)
pub unsafe fn show_glyphs_at_positions( c: Option<&CGContext>, glyphs: *const u16, lpositions: *const CGPoint, count: usize, )
§Safety
glyphsmust be a valid pointer or null.lpositionsmust be a valid pointer or null.
pub fn end_page(c: Option<&CGContext>)
pub fn flush(c: Option<&CGContext>)
pub fn synchronize(c: Option<&CGContext>)
pub fn synchronize_attributes(&self)
pub fn set_should_antialias(c: Option<&CGContext>, should_antialias: bool)
pub fn set_allows_antialiasing(c: Option<&CGContext>, allows_antialiasing: bool)
pub fn set_should_smooth_fonts(c: Option<&CGContext>, should_smooth_fonts: bool)
pub fn set_allows_font_smoothing( c: Option<&CGContext>, allows_font_smoothing: bool, )
pub fn set_should_subpixel_position_fonts( c: Option<&CGContext>, should_subpixel_position_fonts: bool, )
pub fn set_allows_font_subpixel_positioning( c: Option<&CGContext>, allows_font_subpixel_positioning: bool, )
pub fn set_should_subpixel_quantize_fonts( c: Option<&CGContext>, should_subpixel_quantize_fonts: bool, )
pub fn set_allows_font_subpixel_quantization( c: Option<&CGContext>, allows_font_subpixel_quantization: bool, )
Sourcepub unsafe fn begin_transparency_layer(
c: Option<&CGContext>,
auxiliary_info: Option<&CFDictionary>,
)
pub unsafe fn begin_transparency_layer( c: Option<&CGContext>, auxiliary_info: Option<&CFDictionary>, )
Sourcepub unsafe fn begin_transparency_layer_with_rect(
c: Option<&CGContext>,
rect: CGRect,
aux_info: Option<&CFDictionary>,
)
pub unsafe fn begin_transparency_layer_with_rect( c: Option<&CGContext>, rect: CGRect, aux_info: Option<&CFDictionary>, )
§Safety
aux_info generics must be of the correct type.
pub fn end_transparency_layer(c: Option<&CGContext>)
Sourcepub fn user_space_to_device_space_transform(
c: Option<&CGContext>,
) -> CGAffineTransform
pub fn user_space_to_device_space_transform( c: Option<&CGContext>, ) -> CGAffineTransform
User space to device space tranformations. *
pub fn convert_point_to_device_space( c: Option<&CGContext>, point: CGPoint, ) -> CGPoint
pub fn convert_point_to_user_space( c: Option<&CGContext>, point: CGPoint, ) -> CGPoint
pub fn convert_size_to_device_space( c: Option<&CGContext>, size: CGSize, ) -> CGSize
pub fn convert_size_to_user_space(c: Option<&CGContext>, size: CGSize) -> CGSize
pub fn convert_rect_to_device_space( c: Option<&CGContext>, rect: CGRect, ) -> CGRect
pub fn convert_rect_to_user_space(c: Option<&CGContext>, rect: CGRect) -> CGRect
Sourcepub unsafe fn select_font(
c: Option<&CGContext>,
name: *const i8,
size: f64,
text_encoding: CGTextEncoding,
)
👎Deprecated: No longer supported
pub unsafe fn select_font( c: Option<&CGContext>, name: *const i8, size: f64, text_encoding: CGTextEncoding, )
§Safety
name must be a valid pointer or null.
Sourcepub unsafe fn show_text(c: Option<&CGContext>, string: *const i8, length: usize)
👎Deprecated: No longer supported
pub unsafe fn show_text(c: Option<&CGContext>, string: *const i8, length: usize)
§Safety
string must be a valid pointer or null.
Sourcepub unsafe fn show_text_at_point(
c: Option<&CGContext>,
x: f64,
y: f64,
string: *const i8,
length: usize,
)
👎Deprecated: No longer supported
pub unsafe fn show_text_at_point( c: Option<&CGContext>, x: f64, y: f64, string: *const i8, length: usize, )
§Safety
string must be a valid pointer or null.
Sourcepub unsafe fn show_glyphs(c: Option<&CGContext>, g: *const u16, count: usize)
👎Deprecated: No longer supported
pub unsafe fn show_glyphs(c: Option<&CGContext>, g: *const u16, count: usize)
§Safety
g must be a valid pointer or null.
Sourcepub unsafe fn show_glyphs_at_point(
c: Option<&CGContext>,
x: f64,
y: f64,
glyphs: *const u16,
count: usize,
)
👎Deprecated: No longer supported
pub unsafe fn show_glyphs_at_point( c: Option<&CGContext>, x: f64, y: f64, glyphs: *const u16, count: usize, )
§Safety
glyphs must be a valid pointer or null.
Sourcepub unsafe fn show_glyphs_with_advances(
c: Option<&CGContext>,
glyphs: *const u16,
advances: *const CGSize,
count: usize,
)
👎Deprecated: No longer supported
pub unsafe fn show_glyphs_with_advances( c: Option<&CGContext>, glyphs: *const u16, advances: *const CGSize, count: usize, )
§Safety
glyphsmust be a valid pointer or null.advancesmust be a valid pointer or null.
pub fn draw_pdf_document( c: Option<&CGContext>, rect: CGRect, document: Option<&CGPDFDocument>, page: i32, )
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
Attempt to downcast the type to that of type T.
This is the reference-variant. Use CFRetained::downcast if you
want to convert a retained type. See also ConcreteType for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumbers, small CFStrings etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX in that case.
Trait Implementations§
Source§impl ConcreteType for CGContext
impl ConcreteType for CGContext
Source§impl RefEncode for CGContext
impl RefEncode for CGContext
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for CGContext
impl Type for CGContext
Source§fn retain(&self) -> CFRetained<Self> ⓘwhere
Self: Sized,
fn retain(&self) -> CFRetained<Self> ⓘwhere
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
core-foundation crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
core-foundation crate. Read more