Page 1 of 1

Path of canvas

Posted: Thu Sep 01, 2016 11:11 pm
by [-hh]
Is there a way to get (the instructions of) "the current path of this canvas"?
So that the following is possible

Code: Select all

constrainPathToRect(my bounds,the current path of this canvas)

Re: Path of canvas

Posted: Fri Sep 02, 2016 3:55 pm
by peter-b
I don't think it's currently available. Can you give an example of what problem you would be able to solve using this that could not otherwise be handled a different way?

Re: Path of canvas

Posted: Fri Sep 02, 2016 4:45 pm
by [-hh]
I'm building a LCDscroller widget, just like the HTML5 example.
Currently I'm transforming non-linear (for example to a sine wave) a set of points by

Code: Select all

[*] add circle path centered at point transformLCD(pX, pY) with radius tRadius to this canvas
and the problem is to fit this path to the current bounds of the widget or to resize the widget correspondingly so that nothing is cropped by its bounds.
[Computing the 'geometric extents' costs too much time.]

The line [*] above is my trial to have "markers" like in LC script.

Re: Path of canvas

Posted: Fri Sep 02, 2016 5:00 pm
by peter-b
When I have this problem, I normally transform the canvas (using "scale tCanvas by tScale" and "translate tCanvas by tVector") so that the area I intend to draw into has unit height and width and located at the origin. Then it is very easy to position and scale your graphics correctly!