Back to index

texmacs  1.0.7.15
pdfcolor.h
Go to the documentation of this file.
00001 /*  $Header: /home/cvsroot/dvipdfmx/src/pdfcolor.h,v 1.11 2008/12/11 16:03:04 matthias Exp $
00002     
00003     This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
00004 
00005     Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
00006     the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
00007     
00008     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
00009 
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014     
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU General Public License for more details.
00019     
00020     You should have received a copy of the GNU General Public License
00021     along with this program; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00023 */
00024 
00025 #ifndef _PDF_COLOR_H_
00026 #define _PDF_COLOR_H_
00027 
00028 #include "pdfobj.h"
00029 
00030 #define PDF_COLORSPACE_TYPE_DEVICECMYK -4
00031 #define PDF_COLORSPACE_TYPE_DEVICERGB  -3
00032 #define PDF_COLORSPACE_TYPE_DEVICEGRAY -1
00033 #define PDF_COLORSPACE_TYPE_INVALID     0
00034 #define PDF_COLORSPACE_TYPE_CALGRAY     1
00035 #define PDF_COLORSPACE_TYPE_CIELAB      2
00036 #define PDF_COLORSPACE_TYPE_CALRGB      3
00037 #define PDF_COLORSPACE_TYPE_ICCBASED    4
00038 
00039 #define PDF_COLORSPACE_TYPE_CMYK  PDF_COLORSPACE_TYPE_DEVICECMYK
00040 #define PDF_COLORSPACE_TYPE_RGB   PDF_COLORSPACE_TYPE_DEVICERGB
00041 #define PDF_COLORSPACE_TYPE_GRAY  PDF_COLORSPACE_TYPE_DEVICEGRAY
00042 
00043 
00044 #define PDF_COLOR_COMPONENT_MAX 4
00045 
00046 typedef struct
00047 {
00048   int    num_components;
00049   double values[PDF_COLOR_COMPONENT_MAX];
00050 } pdf_color;
00051 
00052 extern void       pdf_color_set_verbose   (void);
00053 
00054 extern int        pdf_color_type          (const pdf_color *color);
00055 extern int        pdf_color_rgbcolor      (pdf_color *color,
00056                                            double r, double g, double b);
00057 extern int        pdf_color_cmykcolor     (pdf_color *color,
00058                                            double c, double m, double y, double k);
00059 extern int        pdf_color_graycolor     (pdf_color *color, double g);
00060 #define pdf_color_black(c)   pdf_color_graycolor(c, 0.0);
00061 #define pdf_color_white(c)   pdf_color_graycolor(c, 1.0);
00062 
00063 extern void       pdf_color_copycolor     (pdf_color *color1, const pdf_color *color2);
00064 extern void       pdf_color_brighten_color (pdf_color *dst, const pdf_color *src, double f);
00065 
00066 extern int        pdf_color_compare       (const pdf_color *color1, const pdf_color *color2);
00067 
00068 extern int        pdf_color_is_white      (const pdf_color *color);
00069 extern int        pdf_color_is_valid      (const pdf_color *color);
00070 
00071 extern int        pdf_color_to_string     (const pdf_color *color, char *buffer);
00072 
00073 /* Not check size */
00074 extern pdf_obj *iccp_get_rendering_intent (const void *profile, long proflen);
00075 extern int      iccp_check_colorspace     (int colortype,
00076                                       const void *profile, long proflen);
00077 
00078 /* returns colorspace ID */
00079 extern int      iccp_load_profile (const char *ident,
00080                                const void *profile, long proflen);
00081 
00082 extern void     pdf_init_colors  (void);
00083 extern void     pdf_close_colors (void);
00084 
00085 extern pdf_obj *pdf_get_colorspace_reference      (int cspc_id);
00086 #if 0
00087 extern int      pdf_get_colorspace_num_components (int cspc_id);
00088 extern int      pdf_get_colorspace_subtype        (int cspc_id);
00089 
00090 /* Not working */
00091 extern int      pdf_colorspace_load_ICCBased      (const char *ident,
00092                                              const char *profile_filename);
00093 #endif
00094 
00095 /* Color specials & color stack
00096  * See remark in spc_color.c.
00097  */
00098 extern void     pdf_color_set   (pdf_color *sc, pdf_color *fc);
00099 extern void     pdf_color_push  (pdf_color *sc, pdf_color *fc);
00100 extern void     pdf_color_pop   (void);
00101 
00102 extern void     pdf_color_clear_stack (void);
00103 extern void     pdf_color_get_current (pdf_color **sc, pdf_color **fc);
00104 
00105 #endif /* _PDF_COLOR_H_ */