Permalink
Browse files

Add constants

  • Loading branch information...
taggon
taggon committed Mar 4, 2010
1 parent 9bc54d7 commit 227e4f98c3881a0d95a311ac3be9c9fa3488bcc5
Showing with 21 additions and 11 deletions.
  1. +21 −11 gd_bindings.cc
View
@@ -108,13 +108,27 @@ using namespace node;
delete[] data; \
return scope.Close(result);
+#define COLOR_ANTIALIASED gdAntiAliased
+#define COLOR_BRUSHED gdBrushed
+#define COLOR_STYLED gdStyled
+#define COLOR_STYLEDBRUSHED gdStyledBrushed
+#define COLOR_TITLED gdTiled
+#define COLOR_TRANSPARENT gdTransparent
+
class Gd
{
public:
static void Init(Handle<Object> target)
{
HandleScope scope;
+ NODE_DEFINE_CONSTANT(target, COLOR_ANTIALIASED);
+ NODE_DEFINE_CONSTANT(target, COLOR_BRUSHED);
+ NODE_DEFINE_CONSTANT(target, COLOR_STYLED);
+ NODE_DEFINE_CONSTANT(target, COLOR_STYLEDBRUSHED);
+ NODE_DEFINE_CONSTANT(target, COLOR_TITLED);
+ NODE_DEFINE_CONSTANT(target, COLOR_TRANSPARENT);
+
NODE_SET_METHOD(target, "create", ImageCreate);
NODE_SET_METHOD(target, "createTrueColor", ImageCreateTrueColor);
NODE_SET_METHOD(target, "createFromJpeg", CreateFromJpeg);
@@ -132,15 +146,11 @@ class Gd
NODE_SET_METHOD(target, "trueColor", TrueColor);
NODE_SET_METHOD(target, "trueColorAlpha", TrueColorAlpha);
+
Image::Init(target);
}
protected:
- static Handle<Value> GetImageInfo (const Arguments& args)
- {
- return Undefined();
- }
-
static Handle<Value> ImageCreate (const Arguments& args)
{
REQ_INT_ARG(0, width);
@@ -567,8 +577,8 @@ class Gd
String::New("Arguments 0 must be an array")));
}
- Local<String> x = String::New("x");
- Local<String> y = String::New("y");
+ Local<String> x = String::NewSymbol("x");
+ Local<String> y = String::NewSymbol("y");
Local<Array> array = Local<Array>::Cast(args[0]);
int len = array->Length(), _len = 0;
@@ -603,8 +613,8 @@ class Gd
String::New("Arguments 0 must be an array")));
}
- Local<String> x = String::New("x");
- Local<String> y = String::New("y");
+ Local<String> x = String::NewSymbol("x");
+ Local<String> y = String::NewSymbol("y");
Local<Array> array = Local<Array>::Cast(args[0]);
int len = array->Length(), _len = 0;
@@ -639,8 +649,8 @@ class Gd
String::New("Arguments 0 must be an array")));
}
- Local<String> x = String::New("x");
- Local<String> y = String::New("y");
+ Local<String> x = String::NewSymbol("x");
+ Local<String> y = String::NewSymbol("y");
Local<Array> array = Local<Array>::Cast(args[0]);
int len = array->Length(), _len = 0;

0 comments on commit 227e4f9

Please sign in to comment.