|
THotPDF.RegisterCoonsPatchMesh
|
Вверх |
|
Объявляет PDF 1.3+ Coons patch mesh shading (ISO 32000-1 8.7.4.5.6, /ShadingType 6) и оборачивает его в inline Pattern Type 2 entry в Resources/Pattern dictionary страницы. Каждый patch ограничен четырьмя cubic Bezier curves и несет один colour на corner; renderer подгоняет Coons surface между четырьмя edges, создавая произвольно изогнутый colour-bearing quad. Используйте, когда straight-edge triangle meshes потребовали бы много triangles для аппроксимации curved boundaries
Delphi syntax: function RegisterCoonsPatchMesh(XMin, YMin, XMax, YMax: Single; NumComponents: Integer; const Patches: array of Extended): AnsiString;
C++ syntax: AnsiString RegisterCoonsPatchMesh(float XMin, float YMin, float XMax, float YMax, int NumComponents, const Extended* Patches, int PatchesElementCount);
Описание Shading выводится как indirect stream с /ShadingType 6, /BitsPerCoordinate 16, /BitsPerComponent 8 и /BitsPerFlag 8. Каждый patch упакован как 1 flag byte (всегда 0 для independent patches), затем 12 control points (каждый 4 bytes: 2 big-endian X + 2 big-endian Y) и 4 corner colours (каждый NumComponents bytes), всего 1 + 48 + 4 * NumComponents bytes на patch. /Decode array сопоставляет 16-bit coordinates обратно к заданному [XMin, XMax] x [YMin, YMax] user-space rectangle и каждый colour component к [0, 1] The 12 control points are numbered c1..c12 in clockwise order around the patch boundary starting from corner 1. The four corners are c1 / c4 / c7 / c10, and the remaining eight (c2, c3 between c1 and c4; c5, c6 between c4 and c7; c8, c9 between c7 and c10; c11, c12 between c10 and c1) are the inner Bezier handles of each cubic edge. When the inner handles sit at 1/3 and 2/3 along the straight line between adjacent corners, the Coons surface degenerates to bilinear interpolation - visually equivalent to a 4-vertex Type 4 mesh.
XMin, YMin, XMax, YMax — user-space rectangle, ограничивающий mesh. Эти четыре значения становятся первыми четырьмя entries /Decode, чтобы 16-bit encoded vertex coordinates сопоставлялись обратно в PDF user space. Укажите их в тех же user-space coordinates, куда будете рисовать; для HotPDF screen-coordinate Rectangle at (X, Y, W, H) соответствующий PDF user-space rectangle равен (X, PageHeight - Y - H) to (X + W, PageHeight - Y) NumComponents - количество компонентов цвета на угол. Передайте 1 для DeviceGray, 3 для DeviceRGB или 4 для DeviceCMYK. Любое другое значение вызывает исключение Patches — плоский массив Extended values. Каждый patch вносит 24 + 4 * NumComponents values: 24 floats для 12 control points (X, Y pairs в c1..c12 clockwise order), затем 4 * NumComponents floats для corner colours. Длина массива должна быть положительным кратным этого stride. Все emitted patches имеют flag = 0 (independent patch); continuation flags 1 / 2 / 3 не открыты этим convenience overload
Возвращаемое значение: автоматически сгенерированное pattern name (Sh1, Sh2, ...), зарегистрированное в Resources/Pattern dictionary текущей страницы. Возвращает empty string, когда StrictVersionLock включен и active Version ниже PDF 1.3; иначе версия документа автоматически повышается до 1.3
Code Example
См. также RegisterFreeFormGouraudShading, RegisterLatticeFormGouraudShading, RegisterDeviceN, Version, PDF Filter Support
|