This project is read-only.
Project Description
A basic HTML 5 canvas drawing library for those familiar with the java.awt.Graphics class in Java. It also comes with a JavaScript implementation of the game Breakout to demonstrate using the library.

Various utility methods will be added to this library over time to abstract away the low-level drawing methods found in HTML 5 canvas. Feel free to make requests to improve this library.

See here for my diagramming tool built using this library.

Breakout Demo Included

Sample Usage
<!DOCTYPE html>
   <title>Canvas Toolkit Demo</title>
   <script type="text/javascript" src="canvastoolkit-1.0.0.js"></script>
   <script type="text/javascript">
      function drawShapes() {
         var g = new ctk.Graphics("myCanvas");
         // Draw a filled blue rectangle
         g.fillRect(10, 10, 40, 20);

         // Draw filled a black circle (face outline)
         g.fillCircle(128, 98, 42);

         // Draw filled a yellow circle (face)
         g.fillCircle(130, 100, 40);

         // Draw two unfilled a black circles (eyes)
         g.drawCircle(155, 120, 5);
         g.drawCircle(180, 120, 5);
         // Draw a black line (mouth)
         g.drawLine(150, 155, 190, 155);
<body onload="drawShapes();">
   <canvas id="myCanvas" width="400" height="300" style="background-color: #ffffff; border: solid 1px #000000;"></canvas>


Last edited Aug 4, 2012 at 2:33 PM by TonyO, version 12