From f9a86ff46cc0ceac95421a6a0dece71f9d5db08d Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 29 Oct 2016 13:44:48 -0400 Subject: [PATCH] Add support for CGContextSetTextDrawingMode --- src/context.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/context.rs b/src/context.rs index 9cdd522..0fcb5e9 100644 --- a/src/context.rs +++ b/src/context.rs @@ -15,6 +15,17 @@ use std::mem; use std::ptr; use std::slice; +#[repr(C)] +pub enum CGTextDrawingMode { + CGTextFill, + CGTextStroke, + CGTextFillStroke, + CGTextInvisible, + CGTextFillClip, + CGTextStrokeClip, + CGTextClip +} + #[repr(C)] pub struct __CGContext; @@ -149,6 +160,12 @@ impl CGContext { CGContextSetShouldAntialias(self.as_concrete_TypeRef(), should_antialias) } } + + pub fn set_text_drawing_mode(&self, mode: CGTextDrawingMode) { + unsafe { + CGContextSetTextDrawingMode(self.as_concrete_TypeRef(), mode) + } + } } #[link(name = "ApplicationServices", kind = "framework")] @@ -170,6 +187,7 @@ extern { fn CGContextSetShouldSmoothFonts(c: CGContextRef, shouldSmoothFonts: bool); fn CGContextSetAllowsAntialiasing(c: CGContextRef, allowsAntialiasing: bool); fn CGContextSetShouldAntialias(c: CGContextRef, shouldAntialias: bool); + fn CGContextSetTextDrawingMode(c: CGContextRef, mode: CGTextDrawingMode); fn CGContextSetRGBFillColor(context: CGContextRef, red: CGFloat, green: CGFloat,