Connecting Tech Pros Worldwide Forums | Help | Site Map

draw grid lines over an image in Javascript

kaczmar2@hotmail.com
Guest
 
Posts: n/a
#1: Aug 3 '06
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.

Thanks,

Christian


Jonas Geiregat
Guest
 
Posts: n/a
#2: Aug 3 '06

re: draw grid lines over an image in Javascript


kaczmar2@hotmail.com wrote:
Quote:
Hey there,
>
I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay
>
Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.
>
Thanks,
>
Christian
>
I don't think javascript will be able to do the job, but seems possible
with css.
bobzimuta
Guest
 
Posts: n/a
#3: Aug 3 '06

re: draw grid lines over an image in Javascript



kaczmar2@hotmail.com wrote:
Quote:
Hey there,
>
I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay
>
Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.
>
Thanks,
>
Christian
Here's a 'proof of concept' type page - firefox tested only
http://em.hopto.org/code/test/javascript/grid.html

bobzimuta
Guest
 
Posts: n/a
#4: Aug 3 '06

re: draw grid lines over an image in Javascript



kaczmar2@hotmail.com wrote:
Quote:
Hey there,
>
I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay
>
Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.
>
Thanks,
>
Christian
Now that I think of it: best to create a table and overlay it on the
image. You get a nice grid pattern, and it would be easier to work with
if you want to start manipulating the grids or filling them in with
colors. Hope that gives you some ideas.

kaczmar2@hotmail.com
Guest
 
Posts: n/a
#5: Aug 3 '06

re: draw grid lines over an image in Javascript


Thank you very much for the feedback and example.

The grid will be used so that users can align objects correctly on the
underlying image, so two requirements would be to turn the grid "on"
and "off", and set the spacing between the lines. Width and color of
the lines in the grid will stay constant.

Christian


bobzimuta wrote:
Quote:
kaczmar2@hotmail.com wrote:
Quote:
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.

Thanks,

Christian
>
Now that I think of it: best to create a table and overlay it on the
image. You get a nice grid pattern, and it would be easier to work with
if you want to start manipulating the grids or filling them in with
colors. Hope that gives you some ideas.
bobzimuta
Guest
 
Posts: n/a
#6: Aug 3 '06

re: draw grid lines over an image in Javascript



kaczm...@hotmail.com wrote:
Quote:
Thank you very much for the feedback and example.
>
The grid will be used so that users can align objects correctly on the
underlying image, so two requirements would be to turn the grid "on"
and "off", and set the spacing between the lines. Width and color of
the lines in the grid will stay constant.
>
Will you be 'snapping' the objects to the grid? i.e. once an object is
dragged within a couple pixels of a gridline, it is brought up against
it. That would be pretty cool.

kaczmar2@hotmail.com
Guest
 
Posts: n/a
#7: Aug 3 '06

re: draw grid lines over an image in Javascript


Not sure yet :) My immediate task is to come up with a proof of
concept implementation just involving the grid, but that sounds like a
really good idea. Omly two requirements so far: show/hide the grid,
and adjust the spacing of the grid lines.

bobzimuta wrote:
Quote:
kaczm...@hotmail.com wrote:
Quote:
Thank you very much for the feedback and example.

The grid will be used so that users can align objects correctly on the
underlying image, so two requirements would be to turn the grid "on"
and "off", and set the spacing between the lines. Width and color of
the lines in the grid will stay constant.
>
Will you be 'snapping' the objects to the grid? i.e. once an object is
dragged within a couple pixels of a gridline, it is brought up against
it. That would be pretty cool.
PDannyD
Guest
 
Posts: n/a
#8: Aug 3 '06

re: draw grid lines over an image in Javascript


On Thursday 03 August 2006 22:02, kaczmar2@hotmail.com
[kaczmar2@hotmail.com] wrote in message
<1154638940.404912.11110@s13g2000cwa.googlegroups. com>
Quote:
Hey there,
>
I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay
A table with thin cell borders over the top? Or maybe just use <div>
elements to form a grid?

There might be something[1] server-side which you could install that would
render an on-the-fly overlay grid as a transparent GIF/PNG image.
Quote:
Is there a way I can leverage some functionality...<snip>
<big smiley for the following>

I *hate* that use of "leverage". What's wrong with "use"
"Is there a way I can use some functionality..."
or
"Is there some function to give me greater leverage..."

but I would have written the second paragraph like this:
"Is there a built-in javascript function to do this?"

See? Simple, quick, clear.


[1] I have speel chucking switchd om nd ths wurd wasnnt higligted when the
'h' was omited. Odd!
bobzimuta
Guest
 
Posts: n/a
#9: Aug 4 '06

re: draw grid lines over an image in Javascript



PDannyD wrote:
Quote:
There might be something[1] server-side which you could install that would
render an on-the-fly overlay grid as a transparent GIF/PNG image.
Negates the abillity to move the gridlines around

PDannyD
Guest
 
Posts: n/a
#10: Aug 4 '06

re: draw grid lines over an image in Javascript


On Friday 04 August 2006 00:37, bobzimuta [ejmalone@gmail.com] wrote in
message <1154648244.657915.177680@m73g2000cwd.googlegroups .com>
Quote:
>
PDannyD wrote:
Quote:
>There might be something[1] server-side which you could install that
>would render an on-the-fly overlay grid as a transparent GIF/PNG image.
>
Negates the abillity to move the gridlines around
And missed the bit about not wanting to use anything server-side. Doh!
cwdjrxyz
Guest
 
Posts: n/a
#11: Aug 4 '06

re: draw grid lines over an image in Javascript



kaczmar2@hotmail.com wrote:
Quote:
Hey there,
>
I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay
>
Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.
It is quite possible to draw both vertical and horizontal lines using
script to write the necessary CSS. Then the divisions, each with a
unique id, holding the lines can be turned on or off using visibility
as visible or hidden. I have an example that writes extremely fine
lines that can be so controlled, but it is much more elaborate than
what you likely need. Anyway, you can see the page and look at the
source at http://www.cwdjr.info/dhtml/7veilsDance3.html . My lines are
automatically being turned on and off in a sequence to simulate a
curtain pull. You would need to use a button to turn lines on and off
by controlling visibility instead.

Closed Thread