diff --git a/doc/pdfio.3 b/doc/pdfio.3 index 50daaa5..e63fa80 100644 --- a/doc/pdfio.3 +++ b/doc/pdfio.3 @@ -1,4 +1,4 @@ -.TH pdfio 3 "pdf read/write library" "2021-07-26" "pdf read/write library" +.TH pdfio 3 "pdf read/write library" "2021-08-30" "pdf read/write library" .SH NAME pdfio \- pdf read/write library .SH Introduction @@ -412,6 +412,10 @@ pdfioArrayCreateColorFromPalette creates an indexed color array from an array of .PP pdfioArrayCreateColorFromPrimaries creates a color array using CIE XYZ primaries and a gamma value +.IP \(bu 5 +.PP +pdfioArrayCreateColorFromStandard creates a color array for a standard color space + .PP You can embed an ICC color profile using the pdfioFileCreateICCObjFromFile function: @@ -429,13 +433,13 @@ PDFio also includes predefined constants for creating a few standard color space pdfio_file_t *pdf = pdfioFileCreate(...); // Create an AdobeRGB color array - pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioAdobeRGBGamma, pdfioAdobeRGBMatrix, pdfioAdobeRGBWhitePoint); + pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_ADOBE); // Create an Display P3 color array - pdfio_array_t *display_p3 = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioDisplay P3Gamma, pdfioDisplay P3Matrix, pdfioDisplay P3WhitePoint); + pdfio_array_t *display_p3 = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_P3_D65); // Create an sRGB color array - pdfio_array_t *srgb = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioSRGBGamma, pdfioSRGBMatrix, pdfioSRGBWhitePoint); + pdfio_array_t *srgb = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_SRGB); .fi .PP Font Object Functions @@ -782,6 +786,20 @@ pdfioContentTextShowJustified draws an array of literal strings with offsets bet .SH ENUMERATIONS +.SS pdfio_cs_e +Standard color spaces +.TP 5 +PDFIO_CS_ADOBE +.br +AdobeRGB 1998 +.TP 5 +PDFIO_CS_P3_D65 +.br +Display P3 +.TP 5 +PDFIO_CS_SRGB +.br +sRGB .SS pdfio_filter_e Compression/decompression filters for streams .TP 5 @@ -1085,6 +1103,19 @@ pdfio_array_t * pdfioArrayCreateColorFromPrimaries ( double by ); .fi +.SS pdfioArrayCreateColorFromStandard +Create a color array for a standard color space. +.PP +.nf +pdfio_array_t * pdfioArrayCreateColorFromStandard ( + pdfio_file_t *pdf, + size_t num_colors, + pdfio_cs_t cs +); +.fi +.PP +This function creates a color array for a standard \fBPDFIO_CS_\fR enumerated color space. +The "num_colors" argument must be \fB1\fR for grayscale and \fB3\fR for RGB color. .SS pdfioArrayGetArray Get an array value from an array. .PP @@ -2613,6 +2644,12 @@ Array of PDF values .nf typedef struct _pdfio_array_s pdfio_array_t; .fi +.SS pdfio_cs_t +Standard color spaces +.PP +.nf +typedef enum pdfio_cs_e pdfio_cs_t; +.fi .SS pdfio_dict_t Key/value dictionary .PP diff --git a/doc/pdfio.html b/doc/pdfio.html index 0aee54d..b44db5a 100644 --- a/doc/pdfio.html +++ b/doc/pdfio.html @@ -283,6 +283,7 @@ span.string {
pdfioArrayCreateColorFromPrimaries
creates a color array using CIE XYZ primaries and a gamma value
pdfioArrayCreateColorFromStandard
creates a color array for a standard color space
You can embed an ICC color profile using the pdfioFileCreateICCObjFromFile
function:
pdfio_file_t *pdf = pdfioFileCreate(...);
@@ -710,13 +715,13 @@ pdfio_obj_t *icc = pdfioFileCreateICCObjFromFile(pdf, "
pdfio_file_t *pdf = pdfioFileCreate(...);
// Create an AdobeRGB color array
-pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioAdobeRGBGamma, pdfioAdobeRGBMatrix, pdfioAdobeRGBWhitePoint);
+pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_ADOBE);
// Create an Display P3 color array
-pdfio_array_t *display_p3 = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioDisplay P3Gamma, pdfioDisplay P3Matrix, pdfioDisplay P3WhitePoint);
+pdfio_array_t *display_p3 = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_P3_D65);
// Create an sRGB color array
-pdfio_array_t *srgb = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioSRGBGamma, pdfioSRGBMatrix, pdfioSRGBWhitePoint);
+pdfio_array_t *srgb = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_SRGB);
Font Object Functions
PDF supports many kinds of fonts, including PostScript Type1, PDF Type3, TrueType/OpenType, and CID. PDFio provides two functions for creating font objects. The first is pdfioFileCreateFontObjFromBase
which creates a font object for one of the base PDF fonts:
@@ -1122,6 +1127,24 @@ bool pdfioArrayAppendString(pdfio_array_t *a, const
Return Value
Color space array
+pdfioArrayCreateColorFromStandard
+Create a color array for a standard color space.
+
+pdfio_array_t *pdfioArrayCreateColorFromStandard(pdfio_file_t *pdf, size_t num_colors, pdfio_cs_t cs);
+Parameters
+
+pdf
+PDF file
+num_colors
+Number of colors (1 or 3)
+cs
+Color space enumeration
+
+Return Value
+Color array
+Discussion
+This function creates a color array for a standard PDFIO_CS_
enumerated color space.
+The "num_colors" argument must be 1
for grayscale and 3
for RGB color.
pdfioArrayGetArray
Get an array value from an array.
@@ -3273,6 +3296,11 @@ char *pdfioStringCreatef(pdfio_file_t *pdf, const ch
typedef struct _pdfio_array_s pdfio_array_t;
+pdfio_cs_t
+Standard color spaces
+
+typedef enum pdfio_cs_e pdfio_cs_t;
+
pdfio_dict_t
Key/value dictionary
@@ -3354,6 +3382,14 @@ typedef enum pdfio_valtype_e pdfio_valtype_t;
Upper-right Y coordinate
Constants
+pdfio_cs_e
+Standard color spaces
+Constants
+
+PDFIO_CS_ADOBE AdobeRGB 1998
+PDFIO_CS_P3_D65 Display P3
+PDFIO_CS_SRGB sRGB
+
pdfio_filter_e
Compression/decompression filters for streams
Constants
diff --git a/doc/pdfio.md b/doc/pdfio.md
index 113651f..889ea3b 100644
--- a/doc/pdfio.md
+++ b/doc/pdfio.md
@@ -351,6 +351,7 @@ creating color space arrays:
- [`pdfioArrayCreateColorFromMatrix`](@@) creates a color array using a CIE XYZ color transform matrix, a gamma value, and a CIE XYZ white point
- [`pdfioArrayCreateColorFromPalette`](@@) creates an indexed color array from an array of sRGB values
- [`pdfioArrayCreateColorFromPrimaries`](@@) creates a color array using CIE XYZ primaries and a gamma value
+- [`pdfioArrayCreateColorFromStandard`](@@) creates a color array for a standard color space
You can embed an ICC color profile using the
[`pdfioFileCreateICCObjFromFile`](@@) function:
@@ -370,13 +371,13 @@ spaces:
pdfio_file_t *pdf = pdfioFileCreate(...);
// Create an AdobeRGB color array
-pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioAdobeRGBGamma, pdfioAdobeRGBMatrix, pdfioAdobeRGBWhitePoint);
+pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_ADOBE);
// Create an Display P3 color array
-pdfio_array_t *display_p3 = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioDisplay P3Gamma, pdfioDisplay P3Matrix, pdfioDisplay P3WhitePoint);
+pdfio_array_t *display_p3 = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_P3_D65);
// Create an sRGB color array
-pdfio_array_t *srgb = pdfioArrayCreateColorFromMatrix(pdf, 3, pdfioSRGBGamma, pdfioSRGBMatrix, pdfioSRGBWhitePoint);
+pdfio_array_t *srgb = pdfioArrayCreateColorFromStandard(pdf, 3, PDFIO_CS_SRGB);
```