API referenceGraphics

pdfCreateStdPattern

Register one of 6 built-in hatch-style tiling patterns

C
int32_t __stdcall pdfCreateStdPattern(PPDF IPDF, int32_t Pattern, double LineWidth, double Distance, uint32_t LineColor, uint32_t BackColor);
Delphi
function pdfCreateStdPattern(const IPDF: PPDF; Pattern: Integer; LineWidth, Distance: Double; LineColor, BackColor: Cardinal): Integer; stdcall;

Purpose. Register one of 6 built-in hatch-style tiling patterns (horizontal/vertical/diagonal lines, crosshatch, etc.) without needing a pdfBeginPattern/pdfEndPattern capture.

Description. Pattern must be 0..5 (the specific 6 built-in kinds); any other value fails. Distance (line spacing) defaults to 8 and LineWidth defaults to 0.5 when a non-positive value is passed — these are silent substitutions, not failures. Registers a new pattern entry with an auto-allocated handle and alias, storing the kind/geometry/ colors for later serialization as a real PDF tiling pattern (the actual hatch geometry is generated at output time from Kind/LineWidth/ Distance, not drawn by the caller).

Parameters.

ParameterDescription
IPDFDocument handle.
PatternBuilt-in hatch kind, 0..5; any other value fails.
LineWidthHatch line stroke width; <= 0 silently substitutes 0.5.
DistanceSpacing between hatch lines; <= 0 silently substitutes 8.
LineColorPacked color of the hatch lines.
BackColorPacked background fill color of the tile.

Return value. The new pattern handle on success; -1 if Pattern is outside 0..5.

See also. pdfBeginPattern (a fully custom alternative).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfCreateStdPattern(IntPtr IPDF, int Pattern, double LineWidth, double Distance, uint LineColor, uint BackColor);
Area
Graphics
Category

Object Creation

Exported names

pdfCreateStdPattern

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.