pub struct CGContext { /* private fields */ }CGContext only.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>)
Sourcepub fn scale_ctm(c: Option<&CGContext>, sx: CGFloat, sy: CGFloat)
pub fn scale_ctm(c: Option<&CGContext>, sx: CGFloat, sy: CGFloat)
Coordinate space transformations. *
pub fn translate_ctm(c: Option<&CGContext>, tx: CGFloat, ty: CGFloat)
pub fn rotate_ctm(c: Option<&CGContext>, angle: CGFloat)
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: CGFloat)
pub fn set_line_width(c: Option<&CGContext>, width: CGFloat)
Drawing attribute functions. *
pub fn set_line_cap(c: Option<&CGContext>, cap: CGLineCap)
CGPath only.pub fn set_line_join(c: Option<&CGContext>, join: CGLineJoin)
CGPath only.pub fn set_miter_limit(c: Option<&CGContext>, limit: CGFloat)
Sourcepub unsafe fn set_line_dash(
c: Option<&CGContext>,
phase: CGFloat,
lengths: *const CGFloat,
count: usize,
)
pub unsafe fn set_line_dash( c: Option<&CGContext>, phase: CGFloat, lengths: *const CGFloat, count: usize, )
§Safety
lengths must be a valid pointer or null.
pub fn set_flatness(c: Option<&CGContext>, flatness: CGFloat)
pub fn set_alpha(c: Option<&CGContext>, alpha: CGFloat)
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: CGFloat, y: CGFloat)
pub fn add_line_to_point(c: Option<&CGContext>, x: CGFloat, y: CGFloat)
pub fn add_curve_to_point( c: Option<&CGContext>, cp1x: CGFloat, cp1y: CGFloat, cp2x: CGFloat, cp2y: CGFloat, x: CGFloat, y: CGFloat, )
pub fn add_quad_curve_to_point( c: Option<&CGContext>, cpx: CGFloat, cpy: CGFloat, x: CGFloat, y: CGFloat, )
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: CGFloat, y: CGFloat, radius: CGFloat, start_angle: CGFloat, end_angle: CGFloat, clockwise: c_int, )
pub fn add_arc_to_point( c: Option<&CGContext>, x1: CGFloat, y1: CGFloat, x2: CGFloat, y2: CGFloat, radius: CGFloat, )
pub fn add_path(c: Option<&CGContext>, path: Option<&CGPath>)
CGPath only.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>>
CGPath only.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: CGFloat, )
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>)
CGImage only.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>)
Available on crate feature CGColor only.
pub fn set_fill_color_with_color(c: Option<&CGContext>, color: Option<&CGColor>)
CGColor only.Primitive color functions. *
pub fn set_stroke_color_with_color( c: Option<&CGContext>, color: Option<&CGColor>, )
CGColor only.Sourcepub fn set_fill_color_space(c: Option<&CGContext>, space: Option<&CGColorSpace>)
Available on crate feature CGColorSpace only.
pub fn set_fill_color_space(c: Option<&CGContext>, space: Option<&CGColorSpace>)
CGColorSpace only.Color space functions. *
pub fn set_stroke_color_space( c: Option<&CGContext>, space: Option<&CGColorSpace>, )
CGColorSpace only.Sourcepub unsafe fn set_stroke_color(
c: Option<&CGContext>,
components: *const CGFloat,
)
pub unsafe fn set_stroke_color( c: Option<&CGContext>, components: *const CGFloat, )
§Safety
components must be a valid pointer or null.
Sourcepub unsafe fn set_fill_pattern(
c: Option<&CGContext>,
pattern: Option<&CGPattern>,
components: *const CGFloat,
)
Available on crate feature CGPattern only.
pub unsafe fn set_fill_pattern( c: Option<&CGContext>, pattern: Option<&CGPattern>, components: *const CGFloat, )
CGPattern only.Sourcepub unsafe fn set_stroke_pattern(
c: Option<&CGContext>,
pattern: Option<&CGPattern>,
components: *const CGFloat,
)
Available on crate feature CGPattern only.
pub unsafe fn set_stroke_pattern( c: Option<&CGContext>, pattern: Option<&CGPattern>, components: *const CGFloat, )
CGPattern only.§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: CGFloat, alpha: CGFloat)
pub fn set_gray_fill_color(c: Option<&CGContext>, gray: CGFloat, alpha: CGFloat)
Color convenience functions. *
pub fn set_gray_stroke_color( c: Option<&CGContext>, gray: CGFloat, alpha: CGFloat, )
pub fn set_rgb_fill_color( c: Option<&CGContext>, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, )
pub fn set_rgb_stroke_color( c: Option<&CGContext>, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, )
pub fn set_cmyk_fill_color( c: Option<&CGContext>, cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat, )
pub fn set_cmyk_stroke_color( c: Option<&CGContext>, cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat, )
Sourcepub fn set_rendering_intent(
c: Option<&CGContext>,
intent: CGColorRenderingIntent,
)
Available on crate feature CGColorSpace only.
pub fn set_rendering_intent( c: Option<&CGContext>, intent: CGColorRenderingIntent, )
CGColorSpace only.Rendering intent. *
pub fn set_edr_target_headroom(&self, headroom: c_float) -> bool
pub fn edr_target_headroom(&self) -> c_float
Sourcepub fn draw_image(c: Option<&CGContext>, rect: CGRect, image: Option<&CGImage>)
Available on crate feature CGImage only.
pub fn draw_image(c: Option<&CGContext>, rect: CGRect, image: Option<&CGImage>)
CGImage only.Image functions. *
pub fn draw_tiled_image( c: Option<&CGContext>, rect: CGRect, image: Option<&CGImage>, )
CGImage only.Sourcepub unsafe fn draw_image_applying_tone_mapping(
&self,
r: CGRect,
image: &CGImage,
method: CGToneMapping,
options: Option<&CFDictionary>,
) -> bool
Available on crate features CGImage and CGToneMapping only.
pub unsafe fn draw_image_applying_tone_mapping( &self, r: CGRect, image: &CGImage, method: CGToneMapping, options: Option<&CFDictionary>, ) -> bool
CGImage and CGToneMapping only.§Safety
options generics must be of the correct type.
pub fn content_tone_mapping_info(&self) -> CGContentToneMappingInfo
CGToneMapping only.Sourcepub unsafe fn set_content_tone_mapping_info(
&self,
info: CGContentToneMappingInfo,
)
Available on crate feature CGToneMapping only.
pub unsafe fn set_content_tone_mapping_info( &self, info: CGContentToneMappingInfo, )
CGToneMapping only.§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: CGFloat, color: Option<&CGColor>, )
CGColor only.pub fn set_shadow(c: Option<&CGContext>, offset: CGSize, blur: CGFloat)
pub fn draw_linear_gradient( c: Option<&CGContext>, gradient: Option<&CGGradient>, start_point: CGPoint, end_point: CGPoint, options: CGGradientDrawingOptions, )
CGGradient only.pub fn draw_radial_gradient( c: Option<&CGContext>, gradient: Option<&CGGradient>, start_center: CGPoint, start_radius: CGFloat, end_center: CGPoint, end_radius: CGFloat, options: CGGradientDrawingOptions, )
CGGradient only.pub fn draw_conic_gradient( &self, gradient: Option<&CGGradient>, center: CGPoint, angle: CGFloat, )
CGGradient only.pub fn draw_shading(c: Option<&CGContext>, shading: Option<&CGShading>)
CGShading only.Sourcepub fn set_character_spacing(c: Option<&CGContext>, spacing: CGFloat)
pub fn set_character_spacing(c: Option<&CGContext>, spacing: CGFloat)
Text functions. *
pub fn set_text_position(c: Option<&CGContext>, x: CGFloat, y: CGFloat)
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>)
CGFont only.pub fn set_font_size(c: Option<&CGContext>, size: CGFloat)
Sourcepub unsafe fn show_glyphs_at_positions(
c: Option<&CGContext>,
glyphs: *const CGGlyph,
lpositions: *const CGPoint,
count: usize,
)
Available on crate feature CGFont only.
pub unsafe fn show_glyphs_at_positions( c: Option<&CGContext>, glyphs: *const CGGlyph, lpositions: *const CGPoint, count: usize, )
CGFont only.§Safety
glyphsmust be a valid pointer or null.lpositionsmust be a valid pointer or null.
Sourcepub fn draw_pdf_page(c: Option<&CGContext>, page: Option<&CGPDFPage>)
Available on crate feature CGPDFPage only.
pub fn draw_pdf_page(c: Option<&CGContext>, page: Option<&CGPDFPage>)
CGPDFPage only.PDF functions. *
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 c_char,
size: CGFloat,
text_encoding: CGTextEncoding,
)
👎Deprecated: No longer supported
pub unsafe fn select_font( c: Option<&CGContext>, name: *const c_char, size: CGFloat, text_encoding: CGTextEncoding, )
§Safety
name must be a valid pointer or null.
Sourcepub unsafe fn show_text(
c: Option<&CGContext>,
string: *const c_char,
length: usize,
)
👎Deprecated: No longer supported
pub unsafe fn show_text( c: Option<&CGContext>, string: *const c_char, length: usize, )
§Safety
string must be a valid pointer or null.
Sourcepub unsafe fn show_text_at_point(
c: Option<&CGContext>,
x: CGFloat,
y: CGFloat,
string: *const c_char,
length: usize,
)
👎Deprecated: No longer supported
pub unsafe fn show_text_at_point( c: Option<&CGContext>, x: CGFloat, y: CGFloat, string: *const c_char, length: usize, )
§Safety
string must be a valid pointer or null.
Sourcepub unsafe fn show_glyphs(
c: Option<&CGContext>,
g: *const CGGlyph,
count: usize,
)
👎Deprecated: No longer supportedAvailable on crate feature CGFont only.
pub unsafe fn show_glyphs( c: Option<&CGContext>, g: *const CGGlyph, count: usize, )
CGFont only.§Safety
g must be a valid pointer or null.
Sourcepub unsafe fn show_glyphs_at_point(
c: Option<&CGContext>,
x: CGFloat,
y: CGFloat,
glyphs: *const CGGlyph,
count: usize,
)
👎Deprecated: No longer supportedAvailable on crate feature CGFont only.
pub unsafe fn show_glyphs_at_point( c: Option<&CGContext>, x: CGFloat, y: CGFloat, glyphs: *const CGGlyph, count: usize, )
CGFont only.§Safety
glyphs must be a valid pointer or null.
Sourcepub unsafe fn show_glyphs_with_advances(
c: Option<&CGContext>,
glyphs: *const CGGlyph,
advances: *const CGSize,
count: usize,
)
👎Deprecated: No longer supportedAvailable on crate feature CGFont only.
pub unsafe fn show_glyphs_with_advances( c: Option<&CGContext>, glyphs: *const CGGlyph, advances: *const CGSize, count: usize, )
CGFont only.§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: c_int, )
CGPDFDocument only.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