NewRGBTensorPatchMesh

Shading, Graphics

Description

Creates a tensor-product patch mesh shading, PDF shading type 7, and registers it under ShaderName in DeviceRGB colour. Each patch carries sixteen control points, the four patch corners, eight edge control points, and four inner control points, in P1..P16 order plus one colour per corner. Patches are emitted independently with no edge sharing

Syntax

Delphi

Function TPDFlib.NewRGBTensorPatchMesh(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..P16 slots 0..15, with the inner control points P13..P16 in slots 12..15, 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.8). The inner control points give finer control over the colour flow inside a patch than the bicubic boundary curves of NewRGBCoonsPatchMesh

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
// Inner control points P13..P16 in slots 12..15
Patch.PX[12]:= 166;  Patch.PY[12]:= 150;
Patch.PX[13]:= 233;  Patch.PY[13]:= 150;
Patch.PX[14]:= 233;  Patch.PY[14]:= 200;
Patch.PX[15]:= 166;  Patch.PY[15]:= 200;
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.NewRGBTensorPatchMesh('tensor', Patches, 16, 8,
  100, 100, 300, 250);
PDF.SetFillShader('tensor');