Browse Source

Added isPointInPath() (not yet working)

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

14
src/context2d.cc

@ -79,6 +79,7 @@ Context2d::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "translate", Translate);
NODE_SET_PROTOTYPE_METHOD(t, "transform", Transform);
NODE_SET_PROTOTYPE_METHOD(t, "resetTransform", ResetTransform);
NODE_SET_PROTOTYPE_METHOD(t, "isPointInPath", IsPointInPath);
NODE_SET_PROTOTYPE_METHOD(t, "scale", Scale);
NODE_SET_PROTOTYPE_METHOD(t, "clip", Clip);
NODE_SET_PROTOTYPE_METHOD(t, "fill", Fill);
@ -344,6 +345,19 @@ Context2d::SetLineCap(Local<String> prop, Local<Value> val, const AccessorInfo &
}
}
Handle<Value>
Context2d::IsPointInPath(const Arguments &args) {
HandleScope scope;
if (args[0]->IsNumber() && args[1]->IsNumber()) {
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_t *ctx = context->getContext();
double x = args[0]->NumberValue()
, y = args[1]->NumberValue();
return Boolean::New(cairo_in_fill(ctx, x, y));
}
return False();
}
/*
* Set fill pattern, used internally for fillStyle=
*/

1
src/context2d.h

@ -31,6 +31,7 @@ class Context2d: public node::ObjectWrap {
static Handle<Value> Scale(const Arguments &args);
static Handle<Value> Transform(const Arguments &args);
static Handle<Value> ResetTransform(const Arguments &args);
static Handle<Value> IsPointInPath(const Arguments &args);
static Handle<Value> BeginPath(const Arguments &args);
static Handle<Value> ClosePath(const Arguments &args);
static Handle<Value> Clip(const Arguments &args);

Loading…
Cancel
Save