Browse Source

Fixed color support

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

14
src/context2d.cc

@ -18,9 +18,9 @@ using namespace node;
*/ */
#define RGBA(_,R,G,B,A) \ #define RGBA(_,R,G,B,A) \
_.r = R; \ _.r = R / 255 * 1; \
_.g = G; \ _.g = G / 255 * 1; \
_.b = B; \ _.b = B / 255 * 1; \
_.a = A; \ _.a = A; \
/* /*
@ -61,10 +61,10 @@ using namespace node;
return ThrowException(Exception::TypeError(String::New("b required"))); \ return ThrowException(Exception::TypeError(String::New("b required"))); \
if (!args[3]->IsNumber()) \ if (!args[3]->IsNumber()) \
return ThrowException(Exception::TypeError(String::New("alpha required"))); \ return ThrowException(Exception::TypeError(String::New("alpha required"))); \
int r = args[0]->Int32Value(); \ float r = args[0]->Int32Value(); \
int g = args[1]->Int32Value(); \ float g = args[1]->Int32Value(); \
int b = args[2]->Int32Value(); \ float b = args[2]->Int32Value(); \
double a = args[3]->NumberValue(); float a = args[3]->NumberValue();
/* /*
* Initialize Context2d. * Initialize Context2d.

3
src/context2d.h

@ -11,8 +11,7 @@
#include "canvas.h" #include "canvas.h"
typedef struct { typedef struct {
unsigned char r, g, b; float r, g, b, a;
double a;
} rgba_t; } rgba_t;
class Context2d: public node::ObjectWrap { class Context2d: public node::ObjectWrap {

Loading…
Cancel
Save