From b459976fc82cafbfded2a17a6162ad7a3815db4d Mon Sep 17 00:00:00 2001 From: Mason Chang Date: Mon, 9 Jan 2017 17:18:21 -0800 Subject: [PATCH] Add CGContextFillRect to CGContext --- Cargo.toml | 2 +- src/context.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fe3186f..fef99bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "core-graphics" description = "Bindings to Core Graphics for OS X" homepage = "https://github.com/servo/core-graphics-rs" repository = "https://github.com/servo/core-graphics-rs" -version = "0.4.2" +version = "0.4.3" authors = ["The Servo Project Developers"] license = "MIT / Apache-2.0" diff --git a/src/context.rs b/src/context.rs index 0854e3d..ffb8a16 100644 --- a/src/context.rs +++ b/src/context.rs @@ -14,6 +14,7 @@ use libc::{c_void, size_t}; use std::mem; use std::ptr; use std::slice; +use geometry::CGRect; #[repr(C)] pub enum CGTextDrawingMode { @@ -190,6 +191,12 @@ impl CGContext { CGContextSetTextDrawingMode(self.as_concrete_TypeRef(), mode) } } + + pub fn fill_rect(&self, rect: CGRect) { + unsafe { + CGContextFillRect(self.as_concrete_TypeRef(), rect) + } + } } #[link(name = "ApplicationServices", kind = "framework")] @@ -225,5 +232,7 @@ extern { green: CGFloat, blue: CGFloat, alpha: CGFloat); + fn CGContextFillRect(context: CGContextRef, + rect: CGRect); }