Baldwin Computer Science

  1. WEB hosting
  2. Web design and Implementation
  3. Software development
  4. Linux Distributions
  5. Complete Systems
  1. Pay Bill
  2. Help Desk
WEB pages
  1. Bill Baldwin
  2. W. Allan Baldwin
  1. About us
  2. History
  3. Past Projects
  4. Resume
  5. Careers
  6. Contact Us

The Draw Library

I saw the canvas tag in HTML 5.0 which was interesting because I had been looking for this sort of a tag when I was writing the code for my graphics display for my author WEB site. Because I didn't have this tag, I had to write a CGI program which generated the graphic, and, since panning and scaling is allowed, the page had to be reloaded for each click. On a high speed line this is an annoyance, on a dial-up line this would make the WEB page unworkable (and there are still some dial-up lines).

If I had had the canvas tag, the information needed to draw the page could be down loaded, and the image drawn and scaled locally. I did this for a demonstration (which has never been presented). (This site will use the canvas tag if the browser supports it and the user requests it. If the browser does not support the canvas tag, or the user request not to [see the upper left hand corner] then a CGI program generates the same thing. Internet Explorer does not support the canvas tag to my knowledge, although firefox 3.0 does.) I was interested in something like the canvas tag so that I could make the download faster, and the scaling would be instantaneous.

In the demonstration I mentioned above, the CGI program was required to draw the image in the case where the canvas tag didn't exist. Therefore, I decided to write a graphics package for the CGI program that mimicked the capabilities of the canvas tag as much as possible so that writing the CGI program would not require me to start from scratch.

This library is the result. Most of the classes have been set up to mimic exactly what the canvas uses.

This library is not finished by any means. I will work on it as time and energy allow. Also, if I need to complete parts of it to satisfy some job, it could be finished quite rapidly.

The classes are:

This is the heart of the system. It contains the image which can be exported into a String so that the user can either write it to a file, or send it to the Internet directly. It corresponds to the Canvas tag.
This is derived from the Library class in the Utility library, and is used to check the version number of the library. See the Utilities library for a more complete explanation.
This is a class which is extracted from the Canvas class, and is used to draw on the canvas. This contains the actual draw instructions, most of which are not implemented.
This is the fill style for the background and the foreground of the image. It allows the user to either use an image or a color. I think it also allows a color gradient, but I'm not sure. That has not been implemented, and it will if the fillstyle object connected with the canvas tag does.
This allows the user to define a gradient. That is, when a gradient is used to fill an area, the area starts out in one color and fades into another. This is not implemented.
This is an image. As I recall, this is not implemented at all, but the canvas type called for it, so I made provisions.
Similarly for this class.
And this class.

©2008, Baldwin Computer Science

About us | Legal | Careers | Contact us |  Home4