|
THotPDF.RegisterSampledFunction
|
Κορυφή |
|
Δηλώνει PDF 1.3+ Function Type 0 (Sampled) indirect stream object (ISO 32000-1 7.10.2). Οι Sampled functions εκφράζουν arbitrary input-to-output mapping ως regular N-dimensional grid από M-dimensional output samples· ο renderer παρεμβάλλει γραμμικά ανάμεσα σε grid points για να αξιολογήσει intermediate inputs. Χρησιμοποιήστε το όπου το ICC profile machinery είναι υπερβολικό αλλά χρειάζεται hand-tuned lookup table - tone curves για /TransferFunction (ExtGState /TR), sampled tint transforms για /Separation ή /DeviceN (εναλλακτική στις linear Type 2 / arithmetic Type 4 paths), halftone threshold curves ή οποιοδήποτε άλλο PDF construct που δέχεται Function dictionary
Delphi syntax: function RegisterSampledFunction(const Domain: array of Single; const Range: array of Single; const Size: array of Integer; BitsPerSample: Integer; const Samples: array of byte; Order: Integer = 1): THPDFStreamObject;
C++ syntax: THPDFStreamObject* RegisterSampledFunction(const float* Domain, int DomainCount, const float* Range, int RangeCount, const int* Size, int SizeCount, int BitsPerSample, const unsigned char* Samples, int SamplesCount, int Order = 1);
Περιγραφή The function is emitted as an indirect stream with Order - optional, default 1. Accepts 1 (linear interpolation, PDF 1.7 default) or 3 (cubic-spline interpolation) per PDF 1.7 Table 38. Cubic gives smoother transitions at low sample-grid densities (e.g. 17-point ICC tone curves) but some older mobile readers silently fall back to linear when they encounter an Order value they do not implement. Available since HotPDF v2.54.0. For ASCII-input use cases - the typical authoring path - a single 1-input / M-output function with
Domain - 2N Single values, ordered Range - 2M Single values με το ίδιο shape για τις M output dimensions· τα output samples γίνονται clamped σε αυτό το range μετά το decoding Size - N integers που δίνουν το grid-point count κατά μήκος κάθε input axis. Το Length(Size) πρέπει να ισούται με N. Τα total grid points είναι το γινόμενο όλων των Size entries BitsPerSample - one of 1, 2, 4, 8, 12, 16, 24, or 32 per PDF 1.7 Table 38. Samples - το raw bit-packed sample stream. Το Length πρέπει να είναι τουλάχιστον ceil(GridPoints * M * BitsPerSample / 8) bytes. Το HotPDF αντιγράφει τα supplied bytes verbatim στο indirect stream object· η bit-pack correctness είναι ευθύνη του καλούντος
Return value: το indirect THPDFStreamObject ώστε οι καλούντες να μπορούν να το προσαρτήσουν όπου αναμένεται Function dictionary (συνήθως περνώντας το indirect reference του σε άλλο dict μέσω AddValue ή σε shading / separation builder). Το object ανήκει στη IndirectObjects list του document και απελευθερώνεται στο τέλος του document. Επιστρέφει nil όταν το StrictVersionLock είναι on και το active Version είναι κάτω από PDF 1.3 (διαφορετικά το document version γίνεται auto-bump σε 1.3)
Code Example
See Also RegisterAxialGradient, RegisterDeviceN, RegisterSeparation, Version, PDF Filter Support
|