| 1 |
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. |
| 2 |
|
| 3 |
Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata, |
| 4 |
the dvipdfmx project team. |
| 5 |
|
| 6 |
Copyright (C) 1998, 1999 by Mark A. Wicks <[email protected]> |
| 7 |
|
| 8 |
This program is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 2 of the License, or |
| 11 |
(at your option) any later version. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with this program; if not, write to the Free Software |
| 20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef _PDF_COLOR_H_ |
| 24 |
#define _PDF_COLOR_H_ |
| 25 |
|
| 26 |
#include "pdfobj.h" |
| 27 |
|
| 28 |
#define PDF_COLORSPACE_TYPE_CMYK -4 |
| 29 |
#define PDF_COLORSPACE_TYPE_RGB -3 |
| 30 |
#define PDF_COLORSPACE_TYPE_SPOT -2 |
| 31 |
#define PDF_COLORSPACE_TYPE_GRAY -1 |
| 32 |
#define PDF_COLORSPACE_TYPE_INVALID 0 |
| 33 |
#define PDF_COLORSPACE_TYPE_DEVICEGRAY 1 |
| 34 |
#define PDF_COLORSPACE_TYPE_DEVICERGB 2 |
| 35 |
#define PDF_COLORSPACE_TYPE_DEVICECMYK 3 |
| 36 |
#define PDF_COLORSPACE_TYPE_CALGRAY 4 |
| 37 |
#define PDF_COLORSPACE_TYPE_CALRGB 5 |
| 38 |
#define PDF_COLORSPACE_TYPE_LAB 6 |
| 39 |
#define PDF_COLORSPACE_TYPE_ICCBASED 7 |
| 40 |
#define PDF_COLORSPACE_TYPE_SEPARATION 8 |
| 41 |
#define PDF_COLORSPACE_TYPE_DEVICEN 9 |
| 42 |
#define PDF_COLORSPACE_TYPE_INDEXED 10 |
| 43 |
#define PDF_COLORSPACE_TYPE_PATTERN 11 |
| 44 |
|
| 45 |
#define PDF_COLOR_COMPONENT_MAX 32 |
| 46 |
|
| 47 |
typedef struct |
| 48 |
{ |
| 49 |
int res_id; |
| 50 |
int type; |
| 51 |
int num_components; |
| 52 |
char *spot_color_name; |
| 53 |
double values[PDF_COLOR_COMPONENT_MAX]; |
| 54 |
int pattern_id; |
| 55 |
} pdf_color; |
| 56 |
|
| 57 |
extern int pdf_color_rgbcolor (pdf_color *color, |
| 58 |
double r, double g, double b); |
| 59 |
extern int pdf_color_cmykcolor (pdf_color *color, |
| 60 |
double c, double m, double y, double k); |
| 61 |
extern int pdf_color_graycolor (pdf_color *color, double g); |
| 62 |
|
| 63 |
extern int pdf_color_spotcolor (pdf_color *color, char* color_name, double c); |
| 64 |
|
| 65 |
extern void pdf_color_copycolor (pdf_color *color1, const pdf_color *color2); |
| 66 |
|
| 67 |
#define pdf_color_black(c) pdf_color_graycolor(c, 0.0); |
| 68 |
#define pdf_color_white(c) pdf_color_graycolor(c, 1.0); |
| 69 |
|
| 70 |
extern void pdf_color_brighten_color (pdf_color *dst, const pdf_color *src, double f); |
| 71 |
|
| 72 |
extern int pdf_color_type (const pdf_color *color); |
| 73 |
extern int pdf_color_compare (const pdf_color *color1, const pdf_color *color2); |
| 74 |
extern int pdf_color_set_color (const pdf_color *color, char *buff, size_t buff_len, char mask); |
| 75 |
|
| 76 |
extern int pdf_color_is_white (const pdf_color *color); |
| 77 |
|
| 78 |
/* Not check size */ |
| 79 |
extern pdf_obj *iccp_get_rendering_intent (const void *profile, int proflen); |
| 80 |
extern int iccp_check_colorspace (int colortype, |
| 81 |
const void *profile, int proflen); |
| 82 |
|
| 83 |
/* returns colorspace ID */ |
| 84 |
extern int iccp_load_profile (const char *ident, |
| 85 |
const void *profile, int proflen); |
| 86 |
|
| 87 |
extern void pdf_init_colors (void); |
| 88 |
extern void pdf_close_colors (void); |
| 89 |
|
| 90 |
extern pdf_obj *pdf_get_colorspace_reference (int cspc_id); |
| 91 |
#if 0 |
| 92 |
extern int pdf_get_colorspace_num_components (int cspc_id); |
| 93 |
extern int pdf_get_colorspace_subtype (int cspc_id); |
| 94 |
|
| 95 |
/* Not working */ |
| 96 |
extern int pdf_colorspace_load_ICCBased (const char *ident, |
| 97 |
const char *profile_filename); |
| 98 |
#endif |
| 99 |
|
| 100 |
/* Color special |
| 101 |
* See remark in spc_color.c. |
| 102 |
*/ |
| 103 |
extern void pdf_color_set (pdf_color *sc, pdf_color *fc); |
| 104 |
extern void pdf_color_push (pdf_color *sc, pdf_color *fc); |
| 105 |
extern void pdf_color_pop (void); |
| 106 |
|
| 107 |
/* Color stack |
| 108 |
*/ |
| 109 |
extern void pdf_color_clear_stack (void); |
| 110 |
extern void pdf_color_get_current (pdf_color **sc, pdf_color **fc); |
| 111 |
|
| 112 |
#if 0 |
| 113 |
/* Reinstall color */ |
| 114 |
extern void pdf_dev_preserve_color(void); |
| 115 |
#endif |
| 116 |
|
| 117 |
#endif /* _PDF_COLOR_H_ */ |