Browse Source

Added "darker" composite op

v1.x
Tj Holowaychuk 14 years ago
parent
commit
31ad265650
  1. 2
      Readme.md
  2. 4
      src/CanvasRenderingContext2d.cc
  3. 9
      test/public/tests.js

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.8.6_ 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.10.0_ first using the package manager available to you, or [building from source](https://github.com/LearnBoost/node-canvas/wiki/_pages).
## Screencasts

4
src/CanvasRenderingContext2d.cc

@ -448,7 +448,9 @@ Context2d::SetGlobalCompositeOperation(Local<String> prop, Local<Value> val, con
if (0 == strcmp("xor", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_XOR);
}else if (0 == strcmp("lighter", *type)) {
cairo_set_operator(ctx, CAIRO_OPERATOR_ADD);
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)) {

9
test/public/tests.js

@ -919,6 +919,15 @@ tests['globalCompositeOperation lighter'] = function(ctx){
ctx.fill();
};
tests['globalCompositeOperation darker'] = function(ctx){
ctx.fillStyle = 'blue';
ctx.fillRect(0,0,100,100);
ctx.globalCompositeOperation = 'darker';
ctx.fillStyle = 'red';
ctx.arc(80,80,50,0,Math.PI * 2);
ctx.fill();
};
tests['shadowBlur'] = function(ctx){
ctx.fillRect(150,10,20,20);

Loading…
Cancel
Save