Browse Source

Added clip()

v1.x
Tj Holowaychuk 15 years ago
parent
commit
11c5ab2804
  1. 18
      src/context2d.cc
  2. 1
      src/context2d.h

18
src/context2d.cc

@ -80,6 +80,7 @@ Context2d::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "transform", Transform); NODE_SET_PROTOTYPE_METHOD(t, "transform", Transform);
NODE_SET_PROTOTYPE_METHOD(t, "resetTransform", ResetTransform); NODE_SET_PROTOTYPE_METHOD(t, "resetTransform", ResetTransform);
NODE_SET_PROTOTYPE_METHOD(t, "scale", Scale); NODE_SET_PROTOTYPE_METHOD(t, "scale", Scale);
NODE_SET_PROTOTYPE_METHOD(t, "clip", Clip);
NODE_SET_PROTOTYPE_METHOD(t, "fill", Fill); NODE_SET_PROTOTYPE_METHOD(t, "fill", Fill);
NODE_SET_PROTOTYPE_METHOD(t, "stroke", Stroke); NODE_SET_PROTOTYPE_METHOD(t, "stroke", Stroke);
NODE_SET_PROTOTYPE_METHOD(t, "fillRect", FillRect); NODE_SET_PROTOTYPE_METHOD(t, "fillRect", FillRect);
@ -549,7 +550,20 @@ Context2d::Scale(const Arguments &args) {
} }
/* /*
* Fill the shape. * Use path as clipping region.
*/
Handle<Value>
Context2d::Clip(const Arguments &args) {
HandleScope scope;
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_t *ctx = context->getContext();
cairo_clip_preserve(ctx);
return Undefined();
}
/*
* Fill the path.
*/ */
Handle<Value> Handle<Value>
@ -563,7 +577,7 @@ Context2d::Fill(const Arguments &args) {
} }
/* /*
* Stroke the shape. * Stroke the path.
*/ */
Handle<Value> Handle<Value>

1
src/context2d.h

@ -33,6 +33,7 @@ class Context2d: public node::ObjectWrap {
static Handle<Value> ResetTransform(const Arguments &args); static Handle<Value> ResetTransform(const Arguments &args);
static Handle<Value> BeginPath(const Arguments &args); static Handle<Value> BeginPath(const Arguments &args);
static Handle<Value> ClosePath(const Arguments &args); static Handle<Value> ClosePath(const Arguments &args);
static Handle<Value> Clip(const Arguments &args);
static Handle<Value> Fill(const Arguments &args); static Handle<Value> Fill(const Arguments &args);
static Handle<Value> Stroke(const Arguments &args); static Handle<Value> Stroke(const Arguments &args);
static Handle<Value> SetSource(const Arguments &args); static Handle<Value> SetSource(const Arguments &args);

Loading…
Cancel
Save