471,350 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

drawing pictures

Hi Folks

Is it possible to draw pictures with Javascript? I would like to draw a
poly something (i.e. a shape with coordinates). It is for a mouse-over
effect to highlight certain areas on a map.

TIA

- Nicolaas
Jul 23 '05 #1
4 2202
WindAndWaves wrote:
Hi Folks
Does that mean that it has finally occurred to you that Indian mystics
are maybe not the best people to be addressing javascript questions to?
Is it possible to draw pictures with Javascript?
Yes (in the sense that various host provide scriptable facilities that
will allow the drawing of pictures. For example, PhotoShop (from version
7) can be scripted with ECMAScript, but SVG UAs and plugins are also
often scriptable).
I would like to draw a poly something (i.e. a shape with
coordinates). It is for a mouse-over effect to highlight
certain areas on a map.


So you are probably talking about an HTML UA context, where drawing
polly shapes may be a matter of creating and positioning hundreds
(potentially thousands) of CSS positioned DIV elements. That can be done
but don't expect the results to be quick (or the required code to be
small and simple).

You might like to take a look at the JS vector graphics library at:-

<URL; http://www.walterzorn.com >

Richard.
Jul 23 '05 #2
WindAndWaves wrote on 21 dec 2004 in comp.lang.javascript:
Is it possible to draw pictures with Javascript? I would like to draw a
poly something (i.e. a shape with coordinates). It is for a mouse-over
effect to highlight certain areas on a map.


<http://groups-
beta.google.com/group/comp.lang.java.javascript/msg/c446f72161568698>

<http://devrijehuisarts.org/test/jsgraph.asp>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #3
JRS: In article <cq*******************@news.demon.co.uk>, dated Tue, 21
Dec 2004 23:26:03, seen in news:comp.lang.javascript, Richard Cornford
<Ri*****@litotes.demon.co.uk> posted :

So you are probably talking about an HTML UA context, where drawing
polly shapes may be a matter of creating and positioning hundreds
(potentially thousands) of CSS positioned DIV elements. That can be done
but don't expect the results to be quick (or the required code to be
small and simple).

Let there be created, preferably in the public domain, images of
squares. Let there be sets of squares, of side 16 32 64 128 256 pixels.
Let each set consist of the 256 squares with all combinations of "radii"
on and off. Let a radius be a 1px-wide black line from the centre to a
corner or side mid-point of a white square.

Name them with computable names including the size and a binary encoding
of the radii used.

ISTM that quite a lot of diagramming could be done by filling a
borderless, etc., Table with such images. A preliminary test indicates
so, except that it might be better to use sides of 2^n+1 or 2^n-1, to
help diagonals. have the same visual weight as other lines.

Those figures would tend to get cached. Special figures could be used
for particular parts of diagrams. When the diagram was hand-coded,
colspan rowspan and image height/width control might help.

It would not be the equivalent of proper graphics, but it should compete
with ASCII art for line diagrams. It could be output by program from a
diagram in some other form.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/> Update hope?
Jul 23 '05 #4
On Tue, 21 Dec 2004 23:26:03 -0000, "Richard Cornford"
<Ri*****@litotes.demon.co.uk> wrote:
Yes (in the sense that various host provide scriptable facilities that
will allow the drawing of pictures. For example, PhotoShop (from version
7) can be scripted with ECMAScript, but SVG UAs and plugins are also
often scriptable).


SVG is probably a good choice for the OP. There's already plenty of
examples that do it. off the top of my head www.onemag.org does it,
but so do lots of others.

Jim.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tomi Holger Engdahl | last post: by
9 posts views Thread by Steve Long | last post: by
reply views Thread by Hakan Andersson | last post: by
10 posts views Thread by James Stroud | last post: by
3 posts views Thread by =?Utf-8?B?ZGV2ZWxvcHNj?= | last post: by
reply views Thread by desturrr | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.