draw lines and clear incorrect lines

19 views
Skip to first unread message

want to do graphics

unread,
Apr 30, 2007, 12:34:28 PM4/30/07
to google-excanvas
Hi group,

I am using very much to design couple of tools.

I have following couple of unsolved issues, could any one of please
suggest an appropraite solution to overcome this problem:
1) When user selects a protractor tool to measure the angles, the
protractor image is displayed on to the screen in a canvas. Now, user
can move it around the screen and rotate it 360 degrees. The problem I
have here is, when I move the protractor to a location where a
triangle(or some geometrical figure) image or drawing is shown on the
screen and then try to rotate it to adjust the angle, the protractor
is moved to the center of screen. I want the protractor to rotate
where I placed it.

2) Any performance tips that help me do good graphics with canvas.
Most of the tools I develop are user interactive.

3) Another issue I have is, I use mouse to draw lines on canvas. Now I
should be able to erase the wrongly or improperly drawn lines. I have
tried to do this erasing of lines in following two ways:
a) User select the line to delete and clicks on delete, then I will
draw another line with rgb(255,255,255), but the black line behind
this white line is shown and it is not neat.
b) When ever user wants to delete a line, am redrawing the canvas
with the rest of the lines.

4) I want to draw circl/arcs with ease.

Please add your suggestions ASAP.

Thank you

Glen Murphy

unread,
May 1, 2007, 12:43:32 PM5/1/07
to google-...@googlegroups.com
> 1) When user selects a protractor tool to measure the angles, the
> protractor image is displayed on to the screen in a canvas. Now, user
> can move it around the screen and rotate it 360 degrees. The problem I
> have here is, when I move the protractor to a location where a
> triangle(or some geometrical figure) image or drawing is shown on the
> screen and then try to rotate it to adjust the angle, the protractor
> is moved to the center of screen. I want the protractor to rotate
> where I placed it.

I'm not really sure how to help you here - it just sounds like a
geometry problem.

> 2) Any performance tips that help me do good graphics with canvas.
> Most of the tools I develop are user interactive.

excanvas isn't very fast, its performance characteristics are very
different to those of canvas in Firefox and Safari. I don't think
we've ever done profiling of what is and isn't fast.

> 3) Another issue I have is, I use mouse to draw lines on canvas. Now I
> should be able to erase the wrongly or improperly drawn lines. I have
> tried to do this erasing of lines in following two ways:
> a) User select the line to delete and clicks on delete, then I will
> draw another line with rgb(255,255,255), but the black line behind
> this white line is shown and it is not neat.
> b) When ever user wants to delete a line, am redrawing the canvas
> with the rest of the lines.

The canvas element is a bitmap drawing surface, so it's not really
suited to vector-style drawing operations. (b) Is what you want to do,
though.

> 4) I want to draw circl/arcs with ease.

Can you describe your problems with the arc() method?

want to do graphics

unread,
May 2, 2007, 10:36:19 AM5/2/07
to google-excanvas
Thank you for your reply Glen.

1) I will mail you at gl...@glenmurphy.com, the canvas js file I used
to rotate protractor or any image. This js file is a modification of
one of the examples provided by excanvas.
I hope you understood my first problem of rotating protractor or
any image where I moved to.
2) Regarding drawing arcs or circles:
Basically user should be able to draw circles and arcs on the canvas
i.e., using mouse user should be able to draw these things, i.e., we
need to provide a compass like thing which can be used to set RADIUS
of circle or arc and then rotate it to draw circle/arc. It is most
like you want to draw some circle/arc and circles can be drawn one
upon another and venn diagrams.

You can provide any thought which can used to easily do the above
metioned thing with canvas.

Let me know if you need any info.

Thank You,
Shravan
====================

Reply all
Reply to author
Forward
0 new messages