Browse Source

Conditionally support cairo 1.10.0 operators

v1.x
Tj Holowaychuk 15 years ago
parent
commit
faec4aeece
  1. 2
      Readme.md
  2. 16
      src/CanvasRenderingContext2d.cc

2
Readme.md

@ -11,7 +11,7 @@
$ npm install canvas
If not previously installed, you will want to install the [cairo graphics library](http://cairographics.org/download/) version _>= 1.10.0_ first using the package manager available to you, or [building from source](https://github.com/LearnBoost/node-canvas/wiki/_pages).
If not previously installed, you will want to install the [cairo graphics library](http://cairographics.org/download/) version _>= 1.8.6_ first using the package manager available to you, or [building from source](https://github.com/LearnBoost/node-canvas/wiki/_pages).
## Screencasts

16
src/CanvasRenderingContext2d.cc

@ -432,9 +432,11 @@ Context2d::GetGlobalCompositeOperation(Local<String> prop, const AccessorInfo &i
return String::NewSymbol("destination-over");
case CAIRO_OPERATOR_LIGHTEN:
return String::NewSymbol("lighter");
// Non-standard
// supported by resent versions of cairo
#if CAIRO_VERSION_MINOR >= 10
case CAIRO_OPERATOR_DARKEN:
return String::NewSymbol("darkler");
// Non-standard
case CAIRO_OPERATOR_MULTIPLY:
return String::NewSymbol("multiply");
case CAIRO_OPERATOR_SCREEN:
@ -453,6 +455,7 @@ Context2d::GetGlobalCompositeOperation(Local<String> prop, const AccessorInfo &i
return String::NewSymbol("hsl-color");
case CAIRO_OPERATOR_HSL_LUMINOSITY:
return String::NewSymbol("hsl-luminosity");
#endif
default:
return String::NewSymbol("source-over");
}
@ -469,10 +472,6 @@ Context2d::SetGlobalCompositeOperation(Local<String> prop, Local<Value> val, con
String::AsciiValue type(val->ToString());
if (0 == strcmp("xor", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_XOR);
}else if (0 == strcmp("lighter", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_LIGHTEN);
}else if (0 == strcmp("darker", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_DARKEN);
} else if (0 == strcmp("source-atop", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_ATOP);
} else if (0 == strcmp("source-in", *type)) {
@ -487,7 +486,13 @@ Context2d::SetGlobalCompositeOperation(Local<String> prop, Local<Value> val, con
cairo_set_operator(ctx, CAIRO_OPERATOR_DEST_OUT);
} else if (0 == strcmp("destination-over", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_DEST_OVER);
} else if (0 == strcmp("lighter", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_LIGHTEN);
// Non-standard
// supported by resent versions of cairo
#if CAIRO_VERSION_MINOR >= 10
} else if (0 == strcmp("darker", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_DARKEN);
} else if (0 == strcmp("multiply", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_MULTIPLY);
} else if (0 == strcmp("screen", *type)) {
@ -506,6 +511,7 @@ Context2d::SetGlobalCompositeOperation(Local<String> prop, Local<Value> val, con
cairo_set_operator(ctx, CAIRO_OPERATOR_HSL_COLOR);
} else if (0 == strcmp("hsl-luminosity", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_HSL_LUMINOSITY);
#endif
} else {
cairo_set_operator(ctx, CAIRO_OPERATOR_OVER);
}

Loading…
Cancel
Save