Browse Source

Added CanvasGradient::constructor

v1.x
Tj Holowaychuk 14 years ago
parent
commit
7371fd0050
  1. 10
      src/CanvasGradient.cc
  2. 1
      src/CanvasGradient.h

10
src/CanvasGradient.cc

@ -15,12 +15,12 @@
void
Gradient::Initialize(Handle<Object> target) {
HandleScope scope;
Local<FunctionTemplate> t = FunctionTemplate::New(Gradient::New);
t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(String::NewSymbol("CanvasGradient"));
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Gradient::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("CanvasGradient"));
NODE_SET_PROTOTYPE_METHOD(t, "addColorStopRGBA", AddColorStopRGBA);
target->Set(String::NewSymbol("CanvasGradient"), t->GetFunction());
NODE_SET_PROTOTYPE_METHOD(constructor, "addColorStopRGBA", AddColorStopRGBA);
target->Set(String::NewSymbol("CanvasGradient"), constructor->GetFunction());
}
/*

1
src/CanvasGradient.h

@ -18,6 +18,7 @@ class Gradient: public node::ObjectWrap {
Gradient(double x0, double y0, double x1, double y1);
Gradient(double x0, double y0, double r0, double x1, double y1, double r1);
inline cairo_pattern_t *pattern(){ return _pattern; }
static Persistent<FunctionTemplate> constructor;
private:
~Gradient();

Loading…
Cancel
Save