Browse Source

Added scale()

v1.x
Tj Holowaychuk 14 years ago
parent
commit
757d4968bc
  1. 15
      src/context2d.cc
  2. 1
      src/context2d.h

15
src/context2d.cc

@ -88,6 +88,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, "scale", Scale);
NODE_SET_PROTOTYPE_METHOD(t, "fill", Fill);
NODE_SET_PROTOTYPE_METHOD(t, "stroke", Stroke);
NODE_SET_PROTOTYPE_METHOD(t, "fillRect", FillRect);
@ -385,6 +386,20 @@ Context2d::Translate(const Arguments &args) {
return Undefined();
}
/*
* Scale transformation.
*/
Handle<Value>
Context2d::Scale(const Arguments &args) {
HandleScope scope;
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_scale(context->getContext()
, args[0]->IsNumber() ? args[0]->NumberValue() : 0
, args[1]->IsNumber() ? args[1]->NumberValue() : 0);
return Undefined();
}
/*
* Fill the shape.
*/

1
src/context2d.h

@ -25,6 +25,7 @@ class Context2d: public node::ObjectWrap {
static Handle<Value> Restore(const Arguments &args);
static Handle<Value> Rotate(const Arguments &args);
static Handle<Value> Translate(const Arguments &args);
static Handle<Value> Scale(const Arguments &args);
static Handle<Value> BeginPath(const Arguments &args);
static Handle<Value> ClosePath(const Arguments &args);
static Handle<Value> Fill(const Arguments &args);

Loading…
Cancel
Save