|
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 curves και έχει ένα color ανά corner· ο renderer προσαρμόζει την Coons surface ανάμεσα στις τέσσερις edges, παράγοντας arbitrarily curved color-bearing quad. Χρησιμοποιήστε το όταν straight-edge triangle meshes (RegisterFreeFormGouraudShading, RegisterLatticeFormGouraudShading) θα χρειάζονταν πολλά triangles για να προσεγγίσουν curved boundaries - foil και metallic gradients σε bent paths, SVG-derived gradient meshes και οποιοδήποτε quad με curved edges
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 colors (κάθε ένα NumComponents bytes), συνολικά 1 + 48 + 4 * NumComponents bytes ανά patch. Το /Decode array αντιστοιχίζει τα 16-bit coordinates πίσω στο παρεχόμενο [XMin, XMax] x [YMin, YMax] user-space rectangle και κάθε color 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 που περικλείει τα encoded coordinates. Αυτές οι τέσσερις values γίνονται οι πρώτες τέσσερις entries του /Decode. Control points έξω από αυτό το rectangle γίνονται clamped κατά το encoding time. Τοποθετήστε τα στα ίδια user-space coordinates όπου θα ζωγραφίσετε - για Rectangle του HotPDF με screen-coordinate στο (X, Y, W, H), το αντίστοιχο PDF user-space rectangle είναι (X, PageHeight - Y - H) έως (X + W, PageHeight - Y) NumComponents - αριθμός color components ανά corner. Περάστε 1 για DeviceGray, 3 για DeviceRGB ή 4 για DeviceCMYK. Οποιαδήποτε άλλη τιμή προκαλεί exception Patches - flat array από Extended values. Κάθε patch συνεισφέρει 24 + 4 * NumComponents values: 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). Το array length πρέπει να είναι positive multiple αυτού του stride. Όλα τα emitted patches έχουν flag = 0 (independent patch)· continuation flags 1 / 2 / 3 (edge sharing με το προηγούμενο patch) δεν εκτίθενται σε αυτό το convenience overload
Return value: auto-generated pattern name (Sh1, Sh2, ...) καταχωρημένο στο Resources/Pattern dictionary της τρέχουσας σελίδας. Επιστρέφει κενό string όταν το StrictVersionLock είναι on και το active Version είναι κάτω από PDF 1.3 (διαφορετικά το document version γίνεται auto-bump σε 1.3)
Code Example
See Also RegisterFreeFormGouraudShading, RegisterLatticeFormGouraudShading, RegisterDeviceN, Version, PDF Filter Support
|