In principle Adobe Illustrator can export to SVG and you could try
converting the exported SVG to HTML Canvas. I don't know of any
automated tools to do the SVG to Canvas translation but I wouldn't be
surprised if they exist. You could write a perl script to help you do
it for certain cases.

For example, consider the triangle SVG example at
http://www.w3schools.com/svg/svg_path.asp . SVG draws the triangle as
a path represented by the string "M250 150 L150 350 L350 350 Z". There
are four SVG commands in this path (each letter in the path indicates
a command). Breaking this up into the analogous HTML Canvas commands
gives:

"M250 150" = moveTo(250,150)
"L150 350" = lineTo(150, 350)
"L350 350" = lineTo(350, 350)
"Z" = fill();

Here's the full implementation of the w3schools triangle SVG example
in HTML Canvas:

<html>
  <head>
    <title>Canvas triangle</title>
    <script type="text/javascript">
      function drawShape(){

        // Get canvas context
        var canvas = document.getElementById('example');
        var ctx = canvas.getContext('2d');

        // Draw triangle
        ctx.beginPath();
        ctx.moveTo(250, 150);
        ctx.lineTo(150,350);
        ctx.lineTo(350, 350);
        ctx.fill();
        }
    </script>
  </head>
  <body onload="drawShape();">
      <canvas id="example" width="400" height="400"></canvas>
  </body>
</html>

Hope this helps.

Best,
Ishan

On Jan 28, 2008 4:47 PM, Eric Chamberlain <[EMAIL PROTECTED]> wrote:
>
> I'm coming across a lot of documentation that says to use canvas to
> make icons instead of using images, but nothing explains how to easily
> create those icons.  Coding them by hand sounds way too much like the
> old school Apple Logo days.
>
>
> How are people generating those icons?  Are there any tools that can
> convert from Illustrator, gif, or png to canvas?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to