Add CGContextFillRect to CGContext

This commit is contained in:
Mason Chang
2017-01-09 17:18:21 -08:00
parent a950da1c7e
commit b459976fc8
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -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"
+9
View File
@@ -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);
}