### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Painting polygons on the Canvas  (Read 810 times)

#### wp

• Hero Member
• Posts: 8264
##### Painting polygons on the Canvas
« on: December 25, 2020, 01:57:42 pm »
I wrote a wiki article about drawing special polygons (self-intersecting, holes), it took me some time to find this out and maybe it is interesting to somebody out there: https://wiki.freepascal.org/Graphics_-_Working_with_TCanvas#Drawing_a_polygon
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### Handoko

• Hero Member
• Posts: 4140
• My goal: build my own game engine using Lazarus
##### Re: Painting polygons on the Canvas
« Reply #1 on: December 25, 2020, 02:00:31 pm »
Thank you.

#### circular

• Hero Member
• Posts: 3679
##### Re: Painting polygons on the Canvas
« Reply #2 on: December 25, 2020, 04:47:01 pm »
Interesting.
Conscience is the debugger of the mind

#### winni

• Hero Member
• Posts: 2280
##### Re: Painting polygons on the Canvas
« Reply #3 on: December 25, 2020, 10:08:25 pm »
Hi!

wp 's article was realy necessary.

But if you have to work with a lot of polygones - like map drawing - I would adwise the use of the BGRAbitmapPack.

With only one BGRAbitmap.DrawPolyGoneAntiAlias you can draw a MultiPolygon in one job.
You only have to separate the different polygons with a const named EmptyPointF

You can draw polygones and polygone holes in one job. The first have to be in the one direction of rotation, the second in the other. That's all.

On the pagan winter solstice feast of the old Rome.

Winni

#### lucamar

• Hero Member
• Posts: 3758
##### Re: Painting polygons on the Canvas
« Reply #4 on: December 25, 2020, 11:09:46 pm »
On the pagan winter solstice feast of the old Rome.

O.T. but ... no. It's the old roman Festival of Mithras, not the solstice. Romans stopped celebrating the solstice (as a public feast) early after the foundation of Rome and where it existed it was in fact a week centered around the solstice itself (~ December 21st) so by the 25th it used to be already winding down. A friend who is a Dr. in History put me to rights, at long length  (shepherd kings <mumble, mumble> first republic <mumble, mumble> Silas <more mumble, mumble>), about that some years/xmases ago so I pass it on whenever I can

Note also that calling pagan a feast of old Rome is somewhat misleading, since they were the ones who "invented" the word (after a similar Grrek term, IIRC) to refer to any not-really-a-citizen (of Rome), in the first place

Ok, let's get back On-Topic
« Last Edit: December 25, 2020, 11:11:53 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!)
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

#### winni

• Hero Member
• Posts: 2280
##### Re: Painting polygons on the Canvas
« Reply #5 on: December 25, 2020, 11:39:54 pm »
Hi!

Yes- writing in a language that is not mine. Trouble.

Mithras feast. But it was around the winter solstice.
Remember that the calendar was not as exact as today.
And the party was allways done on 25th of December.

Remember that the Julian Calendar was introduced something around 45 BC including
the leap year. With 0.001 year error. That took another 1600 years to make it exact.

And about Mithras: This divinity has a big history in Persia and came with Alexander to Greece. And then to Rome. To make it short.

Winni