Loading ...
Sorry, an error occurred while loading the content.

Creating Custom Canvas Contexts

Expand Messages
  • canvasgame
    I have worked out how to create your own custom contexts. My code is very robust, it makes no variable pollution as everything is local to an anonymous
    Message 1 of 1 , Jan 2, 2006
    • 0 Attachment
      I have worked out how to create your own custom contexts. My code is
      very robust, it makes no variable pollution as everything is local to
      an anonymous function, and the interface is exactly the same as the
      local 2d context.

      Here is the code:
      http://www.random.abrahamjoffe.com.au/public/JavaScripts/canvas/tutorial2.htm

      The context can be called like:

      var ctx=canvas.getContext('graph');

      Then you can create a plethora of methods and properties so that you
      can do things like:

      ctx.addEntry('January', 145);

      And that could perhaps draw a bar onto a bar graph or whatever you like.

      Let me know if my commenting makes it clear enough and if you find any
      sections that could be done simpler.
    Your message has been successfully submitted and would be delivered to recipients shortly.