Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Walter Zorn JS graphics library drawing not only axis aligned ellipse? 1

Status
Not open for further replies.

mellthy

Programmer
Dec 6, 2001
17
CZ
Hello,

I'm experimenting with Walter Zorn's graphics library ( I wonder if there is a way how to draw ellipses that are not axis aligned. I've found a demo of rotation there too ( but looking into the code didn't give me an impression I could rotate ellipses.

Am I blind or just plain stupid?

Thanks for your opininons,
Mellthy
 
The demo is blanking out the previous shape and re-drawing it each frame with new parameters. So, could you not just do the same with your ellipse (i.e. draw it in the same place with your BG colour, and then in whatever FG colour you want but with new X- and Y-radii)?

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi

Dan, I think you misunderstood the requirement. Mellthy wants a rotated ellipsis. So the angle between the [red]ellipsis[/red]'s [green]axis[/green] and the coordinate system [blue]axis[/blue] is not multiple of 90.

[tt]
[blue]|[/blue] [green]/[/green]
[red]_,---.[/red]
[red],'[/red] [blue]|[/blue] [green]/[/green] [red]'.[/red]
[red]/[/red] [blue]|[/blue][green]/[/green] [red]|[/red]
[blue]--[/blue][red]/[/red][blue]----+----[/blue][red]/[/red][blue]--[/blue]
[red]|[/red] [green]/[/green][blue]|[/blue] [red]/[/red]
[red]`.[/red] [green]/[/green] [blue]|[/blue][red]_.'[/red]
[red]`---'[/red]
[green]/[/green] [blue]|[/blue]
[/tt]

As far as I saw, jsGraphics is not able to do that by default.

Feherke.
 
Hmm.. would it be possible to do it by breaking down the ellipse into smaller arcs and drawing those?

You'd have to calculate the start and end angles, etc, yourself... but it might just work.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi

About 5-6 minutes both. ( The first one was too small... )

Well, I was close to suggest to draw it by "pixels", like I did it long time ago in Turbo Pascal... But I found no PutPixel in this library. Is over-optimized for efficient use of [tt]div[/tt]s.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top