Browse Source

Added miterLimit accessor

v1.x
Tj Holowaychuk 14 years ago
parent
commit
d3c75234f7
  1. 21
      src/context2d.cc
  2. 2
      src/context2d.h

21
src/context2d.cc

@ -97,6 +97,7 @@ Context2d::Initialize(Handle<Object> 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<Value>
Context2d::GetMiterLimit(Local<String> prop, const AccessorInfo &info) {
Context2d *context = ObjectWrap::Unwrap<Context2d>(info.This());
return Number::New(cairo_get_miter_limit(context->getContext()));
}
/*
* Set miter limit.
*/
void
Context2d::SetMiterLimit(Local<String> prop, Local<Value> val, const AccessorInfo &info) {
Context2d *context = ObjectWrap::Unwrap<Context2d>(info.This());
cairo_set_miter_limit(context->getContext(), val->NumberValue());
}
/*
* Get line width.
*/

2
src/context2d.h

@ -34,9 +34,11 @@ class Context2d: public node::ObjectWrap {
static Handle<Value> StrokeRect(const Arguments &args);
static Handle<Value> ClearRect(const Arguments &args);
static Handle<Value> Arc(const Arguments &args);
static Handle<Value> GetMiterLimit(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetLineCap(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetLineJoin(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetLineWidth(Local<String> prop, const AccessorInfo &info);
static void SetMiterLimit(Local<String> prop, Local<Value> val, const AccessorInfo &info);
static void SetLineCap(Local<String> prop, Local<Value> val, const AccessorInfo &info);
static void SetLineJoin(Local<String> prop, Local<Value> val, const AccessorInfo &info);
static void SetLineWidth(Local<String> prop, Local<Value> val, const AccessorInfo &info);

Loading…
Cancel
Save