[Lazarus] Fuzzy translations ignored

Bart bartjunk64 at gmail.com
Thu Sep 18 16:00:20 CEST 2014


On 9/18/14, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:

> Are you saying, that Canvas.Pie is broken?

Since I am unfamilliar with graphics and I did not get how to use
Canvas.Pie, I tried to "emulate" it myself.

I calcuate where the lines need to be drawn using basic goniometry,
then fill in the sections I created with FloodFill.
I couldn't get a grip on Canvas.Pie, Canvas.Arc, Canvas.RadialPie etc. etc.

If Canavs.Pie is the way to go, then all the better.

However, how to do that then?

I start of with a circle with radius Radius, and with origo Origo (TPoint).

Now if I want to draw a Pie-slice of fraction X, starting from the X-axis:
(OrigoX+Radius, Origo.Y)
and going counter clockwise to:
(Origo.X + Round(Cos(X * (2 * pi)) * Radius, Origo.Y - Round(Sin(X *
(2 * pi)) * Radius)

what do I need to do to make that work using Canvas.Pie
And the same Q for a fraction Y, starting of from section X?

PS. You'll note the code for the GraphStat form is rather clumsy.
Currently I'm about to convert it by using a ListView with an
ImageList and create Bitmap's at runtime.
This will make anchoring/aligning that much easier.

Bart




More information about the Lazarus mailing list