NewGraphicsState

Vector graphics, Text, Page layout

Description

Creates or reuses a PDF ExtGState that can combine fill transparency, stroke transparency, line width, line cap, line join, and miter limit settings for later application with SetGraphicsState

Syntax

Delphi

Function TPDFlib.NewGraphicsState(FillTransparency, StrokeTransparency: Integer; LineWidth: Double; LineCap, LineJoin: Integer; MiterLimit: Double): Integer;

ActiveX

Function PDFlib::NewGraphicsState(FillTransparency As Long, StrokeTransparency As Long, LineWidth As Double, LineCap As Long, LineJoin As Long, MiterLimit As Double) As Long

DLL

int DLNewGraphicsState(int InstanceID, int FillTransparency, int StrokeTransparency, double LineWidth, int LineCap, int LineJoin, double MiterLimit);

Parameters

FillTransparencyFill transparency percentage, where 0 is opaque and 100 is invisible, or -1 to omit /ca
StrokeTransparencyStroke transparency percentage, where 0 is opaque and 100 is invisible, or -1 to omit /CA
LineWidthLine width in the current measurement units, 0 for a PDF hairline, or -1 to omit /LW
LineCapLine cap style 0 = butt, 1 = round, 2 = projecting square, or -1 to omit /LC
LineJoinLine join style 0 = miter, 1 = round, 2 = bevel, or -1 to omit /LJ
MiterLimitMiter limit ratio greater than 0, or -1 to omit /ML

Return values

0No valid graphics-state property was supplied, a parameter was out of range, or transparency is not allowed in the current PDF/A mode
>0A reusable graphics-state ID for the selected document

Remarks

Identical settings reuse the same ExtGState object instead of writing duplicate resource dictionaries

Transparency entries automatically raise the effective document version to PDF 1.4; line-state-only entries raise it to PDF 1.3

The returned ID belongs to the current document and should be passed to SetGraphicsState before drawing content that should use those settings

Example