ClosePath
Vector graphics, Path definition and drawing
Popis
Closes the current sub-path of the path that was started by StartPath. A straight line is drawn from the current point back to the path's starting point, ensuring the figure is a single closed shape rather than two end points connected only by a stroke join. Calling ClosePath does not paint the path — call DrawPath or DrawPathEvenOdd afterwards to stroke and/or fill it.
Syntaxe
Delphi
Function TPDFlib.ClosePath: Integer;
ActiveX
Function PDFlib::ClosePath() As Long
DLL
int DLClosePath(int InstanceID);
Return values
| 0 | Failed — no document is open or no path has been started. |
|---|---|
| 1 | Aktuální podcesta se zavřela |
Poznámky
Uzavření cesty je důležité vždy, když se tvar bude obkreslovat tahem: otevřená cesta zanechá viditelnou mezeru mezi posledním a prvním bodem a spoj tahu v tomto vrcholu se vykreslí jako rovný konec (butt cap) místo řádného spoje. U vyplňovaných cest zavírací úsek implikuje pravidlo výplně, ale explicitní zavření i tak dá čistší výstup a vyžaduje se před zahájením nové podcesty dalším StartPath
Příklad
// Draw a closed triangle, stroked
PDF.SetStrokeColor(0, 0, 0);
PDF.SetLineWidth(1);
PDF.StartPath(100, 100);
PDF.AddLineToPath(200, 100);
PDF.AddLineToPath(150, 180);
PDF.ClosePath; // line back to (100, 100)
PDF.DrawPath(0); // 0 = outline onlyViz také
StartPath, AddLineToPath, AddCurveToPath, DrawPath, DrawPathEvenOdd