From d3c75234f76df88eabf11ac22afa3c89b5ae7904 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Wed, 29 Sep 2010 14:02:44 -0700 Subject: [PATCH] Added miterLimit accessor --- src/context2d.cc | 21 +++++++++++++++++++++ src/context2d.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/context2d.cc b/src/context2d.cc index 307b297..415d79e 100644 --- a/src/context2d.cc +++ b/src/context2d.cc @@ -97,6 +97,7 @@ Context2d::Initialize(Handle target) { NODE_SET_PROTOTYPE_METHOD(t, "arc", Arc); NODE_SET_PROTOTYPE_METHOD(t, "setFillRGBA", SetFillRGBA); NODE_SET_PROTOTYPE_METHOD(t, "setStrokeRGBA", SetStrokeRGBA); + proto->SetAccessor(String::NewSymbol("miterLimit"), GetMiterLimit, SetMiterLimit); proto->SetAccessor(String::NewSymbol("lineWidth"), GetLineWidth, SetLineWidth); proto->SetAccessor(String::NewSymbol("lineCap"), GetLineCap, SetLineCap); proto->SetAccessor(String::NewSymbol("lineJoin"), GetLineJoin, SetLineJoin); @@ -135,6 +136,26 @@ Context2d::~Context2d() { cairo_destroy(_context); } +/* + * Get miter limit. + */ + +Handle +Context2d::GetMiterLimit(Local prop, const AccessorInfo &info) { + Context2d *context = ObjectWrap::Unwrap(info.This()); + return Number::New(cairo_get_miter_limit(context->getContext())); +} + +/* + * Set miter limit. + */ + +void +Context2d::SetMiterLimit(Local prop, Local val, const AccessorInfo &info) { + Context2d *context = ObjectWrap::Unwrap(info.This()); + cairo_set_miter_limit(context->getContext(), val->NumberValue()); +} + /* * Get line width. */ diff --git a/src/context2d.h b/src/context2d.h index b53211f..8c33d53 100644 --- a/src/context2d.h +++ b/src/context2d.h @@ -34,9 +34,11 @@ class Context2d: public node::ObjectWrap { static Handle StrokeRect(const Arguments &args); static Handle ClearRect(const Arguments &args); static Handle Arc(const Arguments &args); + static Handle GetMiterLimit(Local prop, const AccessorInfo &info); static Handle GetLineCap(Local prop, const AccessorInfo &info); static Handle GetLineJoin(Local prop, const AccessorInfo &info); static Handle GetLineWidth(Local prop, const AccessorInfo &info); + static void SetMiterLimit(Local prop, Local val, const AccessorInfo &info); static void SetLineCap(Local prop, Local val, const AccessorInfo &info); static void SetLineJoin(Local prop, Local val, const AccessorInfo &info); static void SetLineWidth(Local prop, Local val, const AccessorInfo &info);