Recent

Author Topic: Vector graphics floodfill algorithms  (Read 1675 times)

circular

  • Hero Member
  • *****
  • Posts: 3828
    • Personal webpage
Re: Vector graphics floodfill algorithms
« Reply #15 on: May 22, 2022, 06:34:58 pm »
You're welcome.

By the way, to rotate the points you can use unit BGRATransform to create affine matrices that you can apply to arrays of TPointF.
Conscience is the debugger of the mind

zamtmn

  • Sr. Member
  • ****
  • Posts: 486
Re: Vector graphics floodfill algorithms
« Reply #16 on: May 22, 2022, 06:51:51 pm »
There will be no problems with transformations.
I thought that this topic already has a lot of solutions, as it is for raster. and I was surprised when I didn't find anything on the first try

BobDog

  • Sr. Member
  • ****
  • Posts: 265
Re: Vector graphics floodfill algorithms
« Reply #17 on: May 22, 2022, 08:01:21 pm »

I noticed a couple of hints in my code, so I repaired them.
What will be your graphics method to plot these lines once you have sorted out an algorithm?
I more or less use the Windows console for simple graphics in freepascal.
I tend just to write plain code (no projects) in Geany, I don't go through the process of creating a library (unit) on the fly. I avoid those complications. I only use Lazarus for testing, it is very good at giving warnings and hints.

zamtmn

  • Sr. Member
  • ****
  • Posts: 486
Re: Vector graphics floodfill algorithms
« Reply #18 on: May 22, 2022, 08:07:55 pm »
>>What will be your graphics method to plot these lines once you have sorted out an algorithm?
OpenGL or GDI
it for zcad https://forum.lazarus.freepascal.org/index.php/topic,16665.0.html

BobDog

  • Sr. Member
  • ****
  • Posts: 265
Re: Vector graphics floodfill algorithms
« Reply #19 on: May 22, 2022, 08:51:45 pm »

Thanks, I see your project. I ran a couple of samples in zcad.exe.
Looks very neat.



ADMGNS

  • New Member
  • *
  • Posts: 30
  • keep it simple and smart
Re: Vector graphics floodfill algorithms
« Reply #20 on: May 28, 2022, 01:42:05 am »
hello

have you tried "point in polygon" ways? you know, it's a kind of solution for irregular polygon filling..

pls see the attachment

regs

zamtmn

  • Sr. Member
  • ****
  • Posts: 486
Re: Vector graphics floodfill algorithms
« Reply #21 on: June 01, 2022, 08:21:10 am »
ADMGNS
thanks, it's a little different

Seenkao
>>First, if this happens separately, then it will be necessary to dock the pattern with each other
Everything turned out to be much simpler than it seems at first glance. Nothing needs to be dock-connect-attach. For example, in the picture it seems that this is a complex pattern, but in fact it is just a set of dotted lines at different angles with different steps

ADMGNS

  • New Member
  • *
  • Posts: 30
  • keep it simple and smart
Re: Vector graphics floodfill algorithms
« Reply #22 on: June 01, 2022, 10:12:04 pm »
hello again..

in my example code, you can see a line below...

imgDraw.Canvas.Pixels[x, y] := imgPattern.Canvas.Pixels[x, y];

so, if you have a bitmap that made of a tiled pattern, you can copy the pixels from this bitmap into the polygon using "point in polygon" methods.. and, as a result, you can get a pattern filled polygon..

i know, this is a very simple, even maybe a primitive approach.

if we talk more wideview angle, we must define a record that consists of (multi)shapes (ie, ellipses, polygons, arcs etc) and some statues, ie including or excluding, and also color/stroke/pattern etc features.. as you know, this is a REGION logic supported many graphics libraries.. anyway..

regs

 

TinyPortal © 2005-2018