W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2014

Re: [whatwg] add to canvas api

From: <bernhard.buecherl@gmail.com>
Date: Mon, 19 May 2014 10:53:40 +0000
Message-ID: <5379e5b4.02b40e0a.676b.ffff8011@mx.google.com>
To: Emanuel Allen <emanuelallen@hotmail.com>
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>
I don’t think this would be necessary, since the canvas api has paths which can be used for all these scenarios.





For example a circle can be easily created with:

context.beginPath( );

context.moveTo( x - radius, y - radius );

context.arc( radius, radius, radius, 0, 2*Math.PI, false );

context.closePath( );




Every polygon can be defined using the path functions moveTo and lineTo ( and arc/arcTo for rounded edges ), so i don’t think this would be necessary in the specs.

But you can create a polygon function easily using the functions above and use it in your code.




If you are looking for writing this using html (-tags), you can use SVG which support polygon, circle, rect,…




-----

Bernhard Bücherl 

@bbuecherl  



Von: Emanuel Allen
Gesendet: ‎Sonntag‎, ‎18‎. ‎Mai‎ ‎2014 ‎07‎:‎52‎:‎28
An: whatwg@whatwg.org





the tag element area have this: rect - rectangular hotspot you can define
the size and placement of circle - circular hotspot that you can define the
size and placement of poly - polygonal hotspot for creating many sided
custom shapes 

I want to request that they add a least two things to the canvas; the poly(x
location, y location, addSideSize, addSideSize, , etc...); 

this will allow for all geometrical figure with three or more sides, a
polygon. Here a least of names for some polygons. A least up to icosagon;
20sides. 3 triangle, trigon 4 quadrilateral, tetragon 5 pentagon 6 hexagon 7
heptagon 8 octagon 9 nonagon, enneagon 10 decagon 11 hendecagon 12
dodecagon, duodecagon 13 triskaidecagon, tridecagon 14 tetrakaidecagon,
tetradecagon 15 pentadecagon 16 hexadecagon 17 heptadecagon 18 octadecagon
19 enneadecagon 20 icosagon 

And a attribute for all corner to be rounded:               

rect.rou(x position, y position, width, height, angle degree); or better
yet, to use a element that is already exists: ploy.arc(position x, position
y, width, height, angle); When I think about it, should add two more at the
end; degree for ploy poly(x location, y location, addSideSize, addSideSise,
, etc...); poly.arc(x location, y location, addSideSize, addSideSize,
arcDegree); how would this work? the last number will automatically to
converted to an arc number for all angle, unless another number is added to
the polygon, then it will be move back again, to that last number. 

I'mma learn PI, math.PI, I have already went over it, but I have head back
to it, for to know how to utilize it for the canvas, I see that a lot of
example use it for the arc, and etc. But I feel that, add this, will make it
more easy for those who want to add different size shape without going into
math. 

If you could send me the link to where I can request for this, my
appreciation to you sir. 

... and it wouldn't hurt to just add a circle: circ. circ(x, y, radius);
Just to make things more easy, I mean, they have all these other tags that
is so close to meaning the same thing, add these two plus attribute of the
they have "arc" I feel would add to it. Plus just adding the ploy element,
would add majority of the shape, even if they stop it at icosagon(20 side).
That would be great. 

 

I was trying to make it as an utility function myself... but I need more
knowledge... no I need more experience and knowledge.... I want to make this
myself. I want to contribute it myself as a prototype instead of just
posting this to be made. I don't want to give queries words, nor
suggestions, but code... I'm still a novice... But not for long.
Received on Monday, 19 May 2014 11:06:57 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:28 UTC