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); }