From b55674f65b23a4f18f629e2204301e884ea26036 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 3 Jan 2019 20:14:40 -0500 Subject: [PATCH] Add bindings for CGContextClearRect --- core-graphics/src/context.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core-graphics/src/context.rs b/core-graphics/src/context.rs index 1d73c23..7dafdd2 100644 --- a/core-graphics/src/context.rs +++ b/core-graphics/src/context.rs @@ -248,6 +248,12 @@ impl CGContextRef { } } + pub fn clear_rect(&self, rect: CGRect) { + unsafe { + CGContextClearRect(self.as_ptr(), rect) + } + } + pub fn draw_image(&self, rect: CGRect, image: &CGImage) { unsafe { CGContextDrawImage(self.as_ptr(), rect, image.as_ptr()); @@ -382,6 +388,8 @@ extern { blue: CGFloat, alpha: CGFloat); fn CGContextSetGrayFillColor(context: ::sys::CGContextRef, gray: CGFloat, alpha: CGFloat); + fn CGContextClearRect(context: ::sys::CGContextRef, + rect: CGRect); fn CGContextFillRect(context: ::sys::CGContextRef, rect: CGRect); fn CGContextDrawImage(c: ::sys::CGContextRef, rect: CGRect, image: ::sys::CGImageRef);