[seed] Add tests for (unimplemented) compositing operators in seed canvas



commit ab31fe85466d51dad60adc4b32d06f07bf5cc2e5
Author: Robert Carr <racarr mireia (none)>
Date:   Tue Apr 14 03:29:01 2009 -0400

    Add tests for (unimplemented) compositing operators in seed canvas
---
 modules/canvas/run-tests.js |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/modules/canvas/run-tests.js b/modules/canvas/run-tests.js
index e692b15..07228ce 100755
--- a/modules/canvas/run-tests.js
+++ b/modules/canvas/run-tests.js
@@ -372,10 +372,35 @@ function test9(ctx)
   ctx.fill();
 }
 
+var compositeTypes = [
+  'source-over','source-in','source-out','source-atop',
+  'destination-over','destination-in','destination-out','destination-atop',
+  'lighter','darker','copy','xor'
+];
+function test17(ctx){
+  for (var i=0;i<4;i++){
+    for (var j = 0;j<4;j++){
+        // draw rectangle
+      ctx.fillStyle = "#09f";
+      ctx.fillRect(70*i,70*j,40,40);
+      
+      // set composite property
+      ctx.globalCompositeOperation = compositeTypes[i*4+j];
+      
+      // draw circle
+      ctx.fillStyle = "#f30";
+      ctx.beginPath();
+      ctx.arc(35+70*i,35+70*j,17,0,Math.PI*2,true);
+      ctx.fill();
+	}
+  }
+}
+
+
 tests = [test1, test2, test3, test4,
 	 test5, test6, test7, test8,
 	 test9, test10, test11, test12,
-	 test13, test14, test15, test16];
+	 test13, test14, test15, test16, test17];
 
 ctx = new Canvas.PDFCanvas("tests.pdf", 500, 500);
 for (test in tests)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]