NewRGBCoonsPatchMesh

Shading, Graphics

Description

Creates a Coons patch mesh shading, PDF shading type 6, and registers it under ShaderName in DeviceRGB colour. Each patch carries twelve control points, the four patch corners plus two control points per edge, in P1..P12 order (corners at P1, P4, P7, P10) plus one colour per corner. Patches are emitted independently with no edge sharing

Syntax

Delphi

Function TPDFlib.NewRGBCoonsPatchMesh(Const ShaderName: WideString;
  Const Patches: Array Of TPLMeshPatchCorners;
  BitsPerCoordinate, BitsPerComponent: Integer;
  Const BoundsX0, BoundsY0, BoundsX1, BoundsY1: Double): Integer;

Parameters

ShaderNameName the shader is registered under; pass it to SetFillShader or SetLineShader to paint with the mesh
PatchesArray of TPLMeshPatchCorners records; PX/PY hold the control point coordinates in P1..P12 slots 0..11 and CR/CG/CB hold the four corner colours in the range 0 to 1
BitsPerCoordinateQuantisation bits for control point coordinates, between 1 and 32
BitsPerComponentQuantisation bits per colour component, between 1 and 16
BoundsX0, BoundsY0, BoundsX1, BoundsY1Decode rectangle that maps the packed control point coordinates into shading coordinate space

Return values

0The mesh was not created, because no document is selected, the patch array is empty, or a bits parameter is out of range
1The mesh was registered under ShaderName

Remarks

Coordinates follow the library top-left origin system and are translated internally (ISO 32000-1 §8.7.4.5.7). For patches with inner control points see NewRGBTensorPatchMesh

Example

Patch:= Default(TPLMeshPatchCorners);
Patch.PX[0]:= 100;  Patch.PY[0]:= 100;   // P1 corner
Patch.PX[3]:= 300;  Patch.PY[3]:= 100;   // P4 corner
Patch.PX[6]:= 300;  Patch.PY[6]:= 250;   // P7 corner
Patch.PX[9]:= 100;  Patch.PY[9]:= 250;   // P10 corner
Patch.CR[0]:= 1; Patch.CG[0]:= 0; Patch.CB[0]:= 0;
Patch.CR[1]:= 0; Patch.CG[1]:= 0; Patch.CB[1]:= 1;
Patch.CR[2]:= 0; Patch.CG[2]:= 1; Patch.CB[2]:= 0;
Patch.CR[3]:= 1; Patch.CG[3]:= 1; Patch.CB[3]:= 0;
SetLength(Patches, 1);
Patches[0]:= Patch;
PDF.NewRGBCoonsPatchMesh('patch', Patches, 16, 8,
  100, 100, 300, 250);
PDF.SetFillShader('patch');