473,841 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

draw grid lines over an image in Javascript

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

Aug 3 '06 #1
10 10387
ka******@hotmai l.com wrote:
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.
Aug 3 '06 #2

ka******@hotmai l.com wrote:
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

Aug 3 '06 #3

ka******@hotmai l.com wrote:
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.

Aug 3 '06 #4
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:
ka******@hotmai l.com wrote:
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.
Aug 3 '06 #5

kaczm...@hotmai l.com wrote:
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.

Aug 3 '06 #6
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:
kaczm...@hotmai l.com wrote:
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.
Aug 3 '06 #7
On Thursday 03 August 2006 22:02, ka******@hotmai l.com
[ka******@hotmai l.com] wrote in message
<11************ *********@s13g2 000cwa.googlegr oups.com>
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.
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!
Aug 3 '06 #8

PDannyD wrote:
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

Aug 3 '06 #9
On Friday 04 August 2006 00:37, bobzimuta [ej******@gmail. com] wrote in
message <11************ **********@m73g 2000cwd.googleg roups.com>
>
PDannyD wrote:
>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!
Aug 4 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
30755
by: R | last post by:
Hello everybody! I'm newbie to JavaScript and I have a basic question. I have X and Y coordinates of A and B points. How can I draw a line connecting A and B? thanks in advance cheers
21
3085
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do it using DirectX. I downloaded already the DSK etc, but I can't find how I need to draw an image on a given position. I don't need stuff to write advanced 3D-games, just painting that image. Can anybody help me with this? I'm already looking for...
11
14904
by: srinivas | last post by:
Hi all, I have one requirement.Is there any way to create a line graph using javascript.If it is please send me the sample code.But the thing is it should work in all browsers. Thanks, Srinivas
8
1273
by: Frank | last post by:
Hello, I have a form in which I draw a grid in the paint event. Works fine, except when using the scrollbars. Autoscroll is switched on, I use doublebuffering and userpaint and AllPaintingInWmPaint are true. When using the scrollbars sometimes some lines are not drawn or drawn twice. The gridlines distort in the scrolled region. As far as I can tell the clipregion is the whole window, so that can't be it. Besides, it only goes wrong when...
3
7647
by: kaczmar2 | last post by:
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. Two requirements would be to:
1
4355
by: zxo102 | last post by:
Hi everyone, I have tried two days to figure out how to draw the image in wx.BufferedDC on the page created by AddPage of wx.Notebook but still got no clue. The attached example works fine. If I click the menu "Draw" --"New Drawing". The image with wx.BufferedDC/wx.BufferedPaintDC can move around on the frame. But If I uncomment those three commented lines in "class TestFrame" to add a new page (from wx.Notebook) with a tag and modify...
4
5456
by: sagar | last post by:
Hello Friends, I am working on a web application in which I have a map loaded on the page and I am required to dynamically draw points, lines, curves on the map to show a location, road etc. Kindly tell me if these is a javascript/ajax library/tool to perform such actions.
6
8000
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data, call determined functions, and edit the data already present What will you need to use the grid? A table with standard markup and an ID to call the script that will turn the table into a grid Parameters: tabelaID => id of the table that will...
5
9981
by: gaya3 | last post by:
Hi, can anyone find error in the following example <%@ include file="JspBean.jsp" %> <%@ page import="java.util.*"%> <html> <head> <%
0
9865
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9706
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10927
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10303
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7025
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5691
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5880
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4082
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.