Код:
<!DOCTYPE HTML> <html lang="en"> <head> <title>ColorTransform Example</title> <meta charset="utf-8"> <link rel="stylesheet" href="css/global.css" type="text/css" /> <script type="text/javascript" src="js/Point.js"></script> <script type="text/javascript" src="js/Rectangle.js"></script> <script type="text/javascript" src="js/Matrix.js"></script> <script type="text/javascript" src="js/ColorTransform.js"></script> <script type="text/javascript" src="js/BitmapData.js"></script> <script> function init() { bmd = document.getElementById("canvas").bitmapData; bikes = new Image(); bikes.src = "res/bikes.png"; bmd.draw(bikes); colorTrans = new ColorTransform(1, 0, 1, 1, 180); rect = new Rectangle(20, 20, 100, 100); bmd.colorTransform(rect, colorTrans); }; </script> </head> <body onload="init();"> <div id="container"> <div id="example-container"> <div id="example"> <canvas id="canvas" width="300" height="300"></canvas><br> </div> <div id="code"> <pre>bmd = document.getElementById("canvas").bitmapData; bikes = new Image(); bikes.src = "res/bikes.png"; bmd.draw(bikes); colorTrans = new ColorTransform(1, 0, 1, 1, 180); rect = new Rectangle(20, 20, 100, 100); bmd.colorTransform(rect, colorTrans); </pre> </div> </div> <div class="break"><img src="res/break.gif"></div> <div id="links"> <ul> <li><a href="index.html">back</a></li> </ul> </div> </div> </body> </html>