Mac OS X
Components Crossplatform Mac & Win Server Client Old Guides Examples
New in version: 8.0 8.1 8.2 8.3 8.4 8.5 9.0 9.1 9.2 9.3 Statistic
Converts colors to gray.
|Component||Version||macOS||Windows||Server||FileMaker Cloud||FileMaker iOS SDK|
|The PDF reference returned from DynaPDF.New.|
|Flags||The mode to operate.
Can be BW_To_Gray (RGB and B/W to gray), RGB_To_Gray (RGB to gray), ToGrayAdjust (Lighten or darken colors).
The value for ToGrayAdjust flag.
Returns OK or error.
DescriptionConverts colors to gray.
The function converts inline RGB operators in the current open page to gray. At time of publication only inline operators like g, rg, G, and RG are processed. CMYK colors will be left unchanged. The parameter Add is optional and considered only if the constant ToGrayAdjust is used.
The conversion of RGB inline color operators can be useful if the document was created with a GDI application, e.g. Microsoft Word, Excel and so on and if the file must be split into black & white and color pages. DynaPDF.IsColorPage can then be used to determine whether the page contains still colored objects. The advantage is that RGB black & white values, which are used for text and vector graphics, are already removed so that DyanPDF.IsColorPage returns only true if any other object uses a color, e.g. an image.
The constant ToGrayAdjust can be used to convert RGB colors to gray and to darken or lighten RGB and gray colors. The parameter Add must be a pointer of a floating point variable. The value can be in the range -1.0 through 1.0. Colors in PDF are stored as floating point values in the range 0.0 through 1.0. Since DeviceGray is an additive color space, 0 denotes black and 1.0 white. If all color operators should be set to black for example, then set the variable to -1.0. The function performs a range check. If the color becomes out of range then it will be adjusted to the nearest value that is inside the allowed color range.
See also ConvertColors function in DynaPDF manual.
Created 17th April 2019, last changed 17th April 2019
Feedback: Report problem or ask question.
MBS Xojo Chart Plugins