Mastodon
Programmierung

Bezier curves

Bezier curves Kurven füllen von Polygonen

When I try this…

[code lang=”delphi”]var
p: array[0..20] of TPoint;
begin
canvas.MoveTo(50, 10);
p[0].x := 10;
p[0].y := 10;
p[1].x := 50;
p[1].y := 100;
p[2].x := 10;
p[2].y := 100;
canvas.Brush.Style := bsSolid;
canvas.brush.color := clBlack;
canvas.PolyBezierTo(slice(p, 3));
end;
[/code]

it draws an bezier line (like method TCanvas.polyline), but i want a solid
object (like TCanvas.polygon), without afterwards filling it. Is that
possible?

Well, the code you posted doesn’t create a closed path, so I’m not
sure how you want it to be “filled.” In general, you can do this:

1) Before drawing your curve:

BeginPath(Canvas.Handle);

2) After drawing your curve:

CloseFigure(Canvas.Handle);
EndPath(Canvas.Handle);
StrokeAndFillPath(Canvas.Handle);

-Steve

[tags]Delphi, Graphic[/tags]

0 Kommentare zu “Bezier curves

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.