Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > drawing in javascript

Reply
Thread Tools

drawing in javascript

 
 
David Landy
Guest
Posts: n/a
 
      10-13-2003
how can i create an inline color image in javascript? the code snippet
below (which was posted on this group in 2000) shows how to do a
single-bit image -- how can this be extended to eg 8-bit color depth?

thanks for any help you can give.

david

> <script language="javascript">
> <!--
> var trash = "#define a_width 16\n#define a_height 16\nstatic "+
> "char a_bits[] = {0x00,0x01,0xe0,0x0f,0x10,0x10,0xf8,0x3f,"+
> "0x10,0x10,0x50,0x15,0x50,0x15,0x50,0x15,0x50,0x15 ,"+
> "0x50,0x15,0x50,0x15,0x50,0x15,0x50,0x15,0x10,0x10 ,"+
> "0xe0,0x0f,0x00,0x00};";
> // -->
> </script>
> </head>
> <body>
> <img src="javascript:trash" alt="">
> ...it's just a small trashcan .
> </body>
>
> chan555
>
>

 
Reply With Quote
 
 
 
 
Toby A Inkster
Guest
Posts: n/a
 
      10-13-2003
David Landy wrote:

> how can i create an inline color image in javascript?


What browsers is it important for this to work in? If IE isn't important,
perhaps the "data:" URL scheme might be your friend. For example:

<a href="data:text/plain,Hello%20World">greeting</a>

See http://www.ietf.org/rfc/rfc2397.txt for more details.

If this on its own isn't an option (for example, IE support is required),
it is probably possible to use the above scheme and then use some
JavaScript to decode the "data:" URL and display it in Internet Explorer.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?id=132

 
Reply With Quote
 
 
 
 
David Landy
Guest
Posts: n/a
 
      10-14-2003
Many thanks Toby.

Sadly IE is my main target audience

Any idea how to decode the data: and turn it into an image source?

David.

Toby A Inkster <(E-Mail Removed)> wrote in message news:<(E-Mail Removed) >...
> David Landy wrote:
>
> > how can i create an inline color image in javascript?

>
> What browsers is it important for this to work in? If IE isn't important,
> perhaps the "data:" URL scheme might be your friend. For example:
>
> <a href="data:text/plain,Hello%20World">greeting</a>
>
> See http://www.ietf.org/rfc/rfc2397.txt for more details.
>
> If this on its own isn't an option (for example, IE support is required),
> it is probably possible to use the above scheme and then use some
> JavaScript to decode the "data:" URL and display it in Internet Explorer.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Guide to the standard library? Library for drawing in GUIs?drawing inbrowsers? defn noob Java 1 06-28-2008 02:50 AM
JavaScript / For painting or drawing - anything out there like this? julierbriggs@gmail.com Javascript 9 06-13-2006 03:28 AM
funny drawing software:ScreenPen,drawing directly on screen! yyzzbb@sina.com Digital Photography 0 02-04-2006 12:31 AM
System.Drawing For Drawing Text Images jjbutera@hotmail.com ASP .Net 1 01-09-2006 09:55 PM
drawing vector lines with javascript Stefan Burger Javascript 8 06-27-2003 05:27 PM



Advertisments