THPDFPage.SetDash

THPDFPage

 

Atas  Sebelumnya  Berikutnya

Menetapkan jenis pola garis putus-putus

 

Sintaks Delphi:

procedure SetDash ( DashArray: array of Byte; Phase: Byte );

 

Sintaks C++:

void __fastcall SetDash ( const Byte * DashArray, const int DashArray_Size, Byte Phase);

 

Deskripsi

Pola garis putus-putus mengatur pola segmen garis dan celah yang digunakan untuk menggores path. Pola ini ditentukan oleh array dash dan phase dash. Elemen array dash adalah angka yang menentukan panjang dash dan celah yang bergantian; phase dash menentukan jarak di dalam pola dash tempat dash dimulai

 

Contoh pola garis putus-putus

ARRAY DASH

PHASE DASH

APPEARANCE

DESKRIPSI

[]

[ 3 ]

[ 2 ]

[ 2 1 ] 

[ 3 5 ]

[ 2 3 ]

0

0

1

0

6

11

Dash pattern example

Tanpa dash

3 unit aktif, 3 unit nonaktif ... 

1 aktif, 2 nonaktif, 2 aktif, 2 nonaktif, … 

2 aktif, 1 nonaktif, 2 aktif, 1 nonaktif, … 

2 nonaktif, 3 aktif, 5 nonaktif, 3 aktif, 5 nonaktif, … 

1 aktif, 3 nonaktif, 2 aktif, 3 nonaktif, 2 aktif, …        

 

Contoh kode

program FillExample;
{$APPTYPE CONSOLE}
uses
    SysUtils, Graphics, Classes, HPDFDoc;

var
    HPDF: THotPDF;

const
    DashArray: array [0..3] of Byte = ( 6, 4, 2, 4 );

begin
    HPDF := THotPDF.Create(nil);
    try
        HPDF.AutoLaunch := true;                       // PDF file will be shown automatically
        HPDF.FileName := '.\Ellipse.pdf';              // Set PDF filename
        HPDF.BeginDoc;                                 // Create PDF file

        HPDF.CurrentPage.SetDash( DashArray, 0 );      // Set  - . -  dash pattern
        HPDF.CurrentPage.MoveTo ( 20, 20 );            // Move current point to 20, 20
        HPDF.CurrentPage.LineTo ( 300, 100 );          // Draw line from current point to 200, 100
        HPDF.CurrentPage.Stroke;                       // and stroke

        HPDF.CurrentPage.NoDash;                       // Set solid dash pattern
        HPDF.CurrentPage.MoveTo ( 300, 100 );          // Move current point to 300, 100
        HPDF.CurrentPage.LineTo ( 10, 200 );           // Draw line from current point to 10, 100
        HPDF.CurrentPage.Stroke;                       // and stroke

        HPDF.EndDoc;                                   // Close PDF file
    finally
        HPDF.Free;
    end;
end.

 

Lihat juga NoDash