|
|
@ -84,6 +84,7 @@ Context2d::Initialize(Handle<Object> target) { |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "restore", Restore); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "rotate", Rotate); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "translate", Translate); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "transform", Transform); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "scale", Scale); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "fill", Fill); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "stroke", Stroke); |
|
|
@ -363,6 +364,29 @@ Context2d::Rotate(const Arguments &args) { |
|
|
|
return Undefined(); |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
* Transform. |
|
|
|
*/ |
|
|
|
|
|
|
|
Handle<Value> |
|
|
|
Context2d::Transform(const Arguments &args) { |
|
|
|
HandleScope scope; |
|
|
|
|
|
|
|
cairo_matrix_t matrix; |
|
|
|
cairo_matrix_init(&matrix |
|
|
|
, args[0]->IsNumber() ? args[0]->NumberValue() : 0 |
|
|
|
, args[1]->IsNumber() ? args[1]->NumberValue() : 0 |
|
|
|
, args[2]->IsNumber() ? args[2]->NumberValue() : 0 |
|
|
|
, args[3]->IsNumber() ? args[3]->NumberValue() : 0 |
|
|
|
, args[4]->IsNumber() ? args[4]->NumberValue() : 0 |
|
|
|
, args[5]->IsNumber() ? args[5]->NumberValue() : 0); |
|
|
|
|
|
|
|
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This()); |
|
|
|
cairo_transform(context->getContext(), &matrix); |
|
|
|
|
|
|
|
return Undefined(); |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
* Translate transformation. |
|
|
|
*/ |
|
|
|