TPLMeshVertex

Data types

Description

TPLMeshVertex is one vertex of an RGB triangle mesh: the element type of the Vertices array passed to NewRGBFreeFormTriangleMesh and NewRGBLatticeTriangleMesh. The record is declared in the unit PDFlibMeshShading.

X and Y give the position of the vertex. R, G and B give its device RGB colour, each component from 0 to 1.

NewRGBFreeFormTriangleMesh reads the array three records at a time, one triangle per group, and writes every vertex with edge flag 0, so the triangles are independent. NewRGBLatticeTriangleMesh writes the records row by row with VerticesPerRow records per row, in array order; the stream builder's contract is that rows run from top to bottom.

The values are encoded when the mesh is written. Each coordinate is taken as given: clamped to the coordinate range the method receives in BoundsX0, BoundsX1, BoundsY0 and BoundsY1, scaled linearly onto the integers 0 to 2^BitsPerCoordinate - 1 and rounded to the nearest one. Only those four bounds pass through the conversion for the document scale and origin (SetScale, SetOrigin); the record values do not. Each colour component is clamped to 0 to 1 and written with BitsPerComponent bits.

Syntax

TPLMeshVertex= Record
  X, Y: Double;
  R, G, B: Double;
End;

Fields

X, YHorizontal and vertical position of the vertex, encoded as given. A value outside the converted BoundsX0 to BoundsX1 or BoundsY0 to BoundsY1 range is clamped to the nearer bound and quantised to BitsPerCoordinate bits
R, G, BDevice red, green and blue components of the vertex colour, each from 0 to 1. A value outside that range is clamped and each component is quantised to BitsPerComponent bits

Remarks

NewRGBFreeFormTriangleMesh needs at least three records; one or two records left over after the last complete triangle are ignored. NewRGBLatticeTriangleMesh returns 0 unless the record count is an exact multiple of VerticesPerRow and holds at least two rows.

The shading dictionary names DeviceRGB as its colour space and uses the decode range 0 to 1 for every colour component.

The mesh is registered as a shader; select it with SetFillShader, SetLineShader or SetTextShader before painting.

See also

NewRGBFreeFormTriangleMesh, NewRGBLatticeTriangleMesh, TPLMeshPatchCorners, SetFillShader