|
THotPDF.RegisterCoonsPatchMesh
|
Горе |
|
Декларира PDF 1.3+ Coons patch mesh shading (ISO 32000-1 8.7.4.5.6, /ShadingType 6) и го обвива в inline Pattern Type 2 entry в page Resources/Pattern dictionary-то. Всеки patch е ограничен от четири cubic Bezier криви и носи по един цвят на ъгъл; renderer-ът напасва Coons повърхността между четирите edge-а, което дава произволно извита color-bearing quad. Използвайте това, когато straight-edge triangle meshes (RegisterFreeFormGouraudShading, RegisterLatticeFormGouraudShading) биха изисквали много triangles, за да приближат curved boundaries - foil и metallic gradients върху извити paths, SVG-derived gradient meshes и всяка quad с извити edge-ове
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);
Описание Засенчването се излъчва като непряк поток с /ShadingType 6, /BitsPerCoordinate 16, /BitsPerComponent 8 и /BitsPerFlag 8. Всеки патч се пакетират като 1 байт флагове (винаги 0 за независими патчове), последван от 12 контролни точки (всяка по 4 байта: 2 big-endian X + 2 big-endian Y) и 4 ъглови цвята (по NumComponents байта всеки), общо 1 + 48 + 4 * NumComponents байта на патч. Масивът /Decode връща 16-битовите координати обратно към зададения потребителски правоъгълник [XMin, XMax] x [YMin, YMax], а всеки цветови компонент обратно към [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-ът, който ограничава encoded coordinates. Тези четири стойности стават първите четири entries на /Decode. Control points извън този rectangle се clamped-ват по време на encoding. Поставяйте ги в същите user-space coordinates, в които ще рисувате - за HotPDF screen-coordinate Rectangle на (X, Y, W, H) съответният PDF user-space rectangle е (X, PageHeight - Y - H) до (X + W, PageHeight - Y) NumComponents - брой color components на ъгъл. Подайте 1 за DeviceGray, 3 за DeviceRGB или 4 за DeviceCMYK. Всяка друга стойност вдига exception Patches - плосък масив от Extended стойности. Всеки patch добавя 24 + 4 * NumComponents стойности: 24 floats за 12-те control points (X, Y, X, Y, ..., 12 pairs в c1..c12 clockwise order), последвани от 4 * NumComponents floats за corner colors (corner 1 / 2 / 3 / 4 = c1 / c4 / c7 / c10 в cyclic order). Дължината на масива трябва да е положителен multiple на тази stride. Всички emitted patches носят flag = 0 (independent patch); continuation flags 1 / 2 / 3 (edge sharing с предишния patch) не са изложени в този convenience overload
Върната стойност: автоматично генерирано pattern име (Sh1, Sh2, ...) регистрирано в current page Resources/Pattern dictionary-то. Връща празен string, когато StrictVersionLock е включен и активната Version е под PDF 1.3, в противен случай document version-ът се повишава автоматично до 1.3
Примерен код
See Also RegisterFreeFormGouraudShading, RegisterLatticeFormGouraudShading, RegisterDeviceN, Version, PDF Filter Support
|