Auto merge of #288 - jrmuizel:path, r=jdm

Add some minimal bindings for constructing a path

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/288)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo
2019-01-04 17:23:24 -05:00
committed by GitHub
+47
View File
@@ -286,12 +286,45 @@ impl CGContextRef {
}
}
pub fn add_curve_to_point(&self,
cp1x: CGFloat,
cp1y: CGFloat,
cp2x: CGFloat,
cp2y: CGFloat,
x: CGFloat,
y: CGFloat) {
unsafe {
CGContextAddCurveToPoint(self.as_ptr(),
cp1x, cp1y,
cp2x, cp2y,
x, y);
}
}
pub fn add_line_to_point(&self, x: CGFloat, y: CGFloat) {
unsafe {
CGContextAddLineToPoint(self.as_ptr(), x, y);
}
}
pub fn begin_path(&self) {
unsafe {
CGContextBeginPath(self.as_ptr());
}
}
pub fn close_path(&self) {
unsafe {
CGContextClosePath(self.as_ptr());
}
}
pub fn move_to_point(&self, x: CGFloat, y: CGFloat) {
unsafe {
CGContextMoveToPoint(self.as_ptr(), x, y);
}
}
pub fn fill_path(&self) {
unsafe {
CGContextFillPath(self.as_ptr());
@@ -450,7 +483,21 @@ extern {
fn CGContextSetMiterLimit(c: ::sys::CGContextRef, limit: CGFloat);
fn CGContextAddPath(c: ::sys::CGContextRef, path: ::sys::CGPathRef);
fn CGContextAddCurveToPoint(c: ::sys::CGContextRef,
cp1x: CGFloat,
cp1y: CGFloat,
cp2x: CGFloat,
cp2y: CGFloat,
x: CGFloat,
y: CGFloat);
fn CGContextAddLineToPoint(c: ::sys::CGContextRef,
x: CGFloat,
y: CGFloat);
fn CGContextBeginPath(c: ::sys::CGContextRef);
fn CGContextClosePath(c: ::sys::CGContextRef);
fn CGContextMoveToPoint(c: ::sys::CGContextRef,
x: CGFloat,
y: CGFloat);
fn CGContextFillPath(c: ::sys::CGContextRef);
fn CGContextStrokePath(c: ::sys::CGContextRef);
fn CGContextSetRGBFillColor(context: ::sys::CGContextRef,