w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pdfcolor.c File Reference
#include "system.h"
#include "mem.h"
#include "error.h"
#include "dpxconf.h"
#include "dpxfile.h"
#include "pdfdoc.h"
#include "pdfdev.h"
#include "pdfresource.h"
#include "pdfcolor.h"
#include "dpxcrypt.h"
Include dependency graph for pdfcolor.c:

Go to the source code of this file.

Classes

struct  iccXYZNumber
 
struct  iccHeader
 
struct  iccbased_cdata
 
struct  pdf_colorspace
 

Macros

#define DEV_COLOR_STACK_MAX   128
 
#define iccNullSig   0
 
#define ICC_INTENT_TYPE(n)   ((int) (((n) >> 16) & 0xff))
 
#define ICC_INTENT_PERCEPTUAL   0
 
#define ICC_INTENT_RELATIVE   1
 
#define ICC_INTENT_SATURATION   2
 
#define ICC_INTENT_ABSOLUTE   3
 
#define check_sig(d, p, q, r, s)   ((d) && (d)->sig == ((p)<<24|(q)<<16|(r)<<8|(s)))
 
#define sget_signed_long(p)   ((int32_t) ((p)[0] << 24|(p)[1] << 16|(p)[2] << 8|(p)[3]))
 
#define sget_signed_short(p)   ((short) ((p)[0] << 8|(p)[1]))
 
#define get_iccSig(p)   ((iccSig) ((p)[0] << 24|(p)[1] << 16|(p)[2] << 8|(p)[3]))
 
#define ICC_HEAD_SECT1_START   0
 
#define ICC_HEAD_SECT1_LENGTH   56
 
#define ICC_HEAD_SECT2_START   68
 
#define ICC_HEAD_SECT2_LENGTH   16
 
#define ICC_HEAD_SECT3_START   100
 
#define ICC_HEAD_SECT3_LENGTH   28
 
#define print_iccSig(s, t)
 
#define PDF_COLORSPACE_FAMILY_DEVICE   0
 
#define PDF_COLORSPACE_FAMILY_CIEBASED   1
 
#define PDF_COLORSPACE_FAMILY_SPECIAL   2
 

Typedefs

typedef uint32_t iccSig
 

Functions

int pdf_color_type (const pdf_color *color)
 
int pdf_color_rgbcolor (pdf_color *color, double r, double g, double b)
 
int pdf_color_cmykcolor (pdf_color *color, double c, double m, double y, double k)
 
int pdf_color_graycolor (pdf_color *color, double g)
 
int pdf_color_spotcolor (pdf_color *color, char *name, double c)
 
void pdf_color_copycolor (pdf_color *color1, const pdf_color *color2)
 
void pdf_color_brighten_color (pdf_color *dst, const pdf_color *src, double f)
 
int pdf_color_is_white (const pdf_color *color)
 
int pdf_color_set_color (const pdf_color *color, char *buffer, size_t buffer_len, char mask)
 
int pdf_color_compare (const pdf_color *color1, const pdf_color *color2)
 
void pdf_color_clear_stack (void)
 
void pdf_color_set (pdf_color *sc, pdf_color *fc)
 
void pdf_color_push (pdf_color *sc, pdf_color *fc)
 
void pdf_color_pop (void)
 
void pdf_color_get_current (pdf_color **sc, pdf_color **fc)
 
static int pdf_colorspace_defineresource (const char *ident, int subtype, void *cdata, pdf_obj *resource)
 
static int pdf_colorspace_findresource (const char *ident, int subtype, const void *cdata)
 
static int iccp_version_supported (int major, int minor)
 
static iccSig str2iccSig (const void *s)
 
static void iccp_init_iccHeader (iccHeader *icch)
 
static void init_iccbased_cdata (struct iccbased_cdata *cdata)
 
static void release_iccbased_cdata (struct iccbased_cdata *cdata)
 
static int get_num_components_iccbased (const struct iccbased_cdata *cdata)
 
static int compare_iccbased (const char *ident1, const struct iccbased_cdata *cdata1, const char *ident2, const struct iccbased_cdata *cdata2)
 
int iccp_check_colorspace (int colortype, const void *profile, int proflen)
 
pdf_objiccp_get_rendering_intent (const void *profile, int proflen)
 
static int iccp_unpack_header (iccHeader *icch, const void *profile, int proflen, int check_size)
 
static void iccp_get_checksum (unsigned char *checksum, const void *profile, int proflen)
 
static void print_iccp_header (iccHeader *icch, unsigned char *checksum)
 
static int iccp_devClass_allowed (int dev_class)
 
int iccp_load_profile (const char *ident, const void *profile, int proflen)
 
static void pdf_init_colorspace_struct (pdf_colorspace *colorspace)
 
static void pdf_clean_colorspace_struct (pdf_colorspace *colorspace)
 
static void pdf_flush_colorspace (pdf_colorspace *colorspace)
 
pdf_objpdf_get_colorspace_reference (int cspc_id)
 
void pdf_init_colors (void)
 
void pdf_close_colors (void)
 

Variables

pdf_color current_fill
 
pdf_color current_stroke
 
pdf_color default_color
 
struct {
   int   current
 
   pdf_color   stroke [128]
 
   pdf_color   fill [128]
 
color_stack
 
static unsigned char nullbytes16 [16]
 
struct {
   int   major
 
   int   minor
 
icc_versions []
 
struct {
   int   count
 
   int   capacity
 
   pdf_colorspace *   colorspaces
 
cspc_cache
 

Macro Definition Documentation

◆ check_sig

#define check_sig (   d,
  p,
  q,
  r,
  s 
)    ((d) && (d)->sig == ((p)<<24|(q)<<16|(r)<<8|(s)))

Definition at line 653 of file pdfcolor.c.

◆ DEV_COLOR_STACK_MAX

#define DEV_COLOR_STACK_MAX   128

Definition at line 431 of file pdfcolor.c.

◆ get_iccSig

#define get_iccSig (   p)    ((iccSig) ((p)[0] << 24|(p)[1] << 16|(p)[2] << 8|(p)[3]))

Definition at line 802 of file pdfcolor.c.

◆ ICC_HEAD_SECT1_LENGTH

#define ICC_HEAD_SECT1_LENGTH   56

Definition at line 889 of file pdfcolor.c.

◆ ICC_HEAD_SECT1_START

#define ICC_HEAD_SECT1_START   0

Definition at line 888 of file pdfcolor.c.

◆ ICC_HEAD_SECT2_LENGTH

#define ICC_HEAD_SECT2_LENGTH   16

Definition at line 892 of file pdfcolor.c.

◆ ICC_HEAD_SECT2_START

#define ICC_HEAD_SECT2_START   68

Definition at line 891 of file pdfcolor.c.

◆ ICC_HEAD_SECT3_LENGTH

#define ICC_HEAD_SECT3_LENGTH   28

Definition at line 895 of file pdfcolor.c.

◆ ICC_HEAD_SECT3_START

#define ICC_HEAD_SECT3_START   100

Definition at line 894 of file pdfcolor.c.

◆ ICC_INTENT_ABSOLUTE

#define ICC_INTENT_ABSOLUTE   3

Definition at line 634 of file pdfcolor.c.

◆ ICC_INTENT_PERCEPTUAL

#define ICC_INTENT_PERCEPTUAL   0

Definition at line 631 of file pdfcolor.c.

◆ ICC_INTENT_RELATIVE

#define ICC_INTENT_RELATIVE   1

Definition at line 632 of file pdfcolor.c.

◆ ICC_INTENT_SATURATION

#define ICC_INTENT_SATURATION   2

Definition at line 633 of file pdfcolor.c.

◆ ICC_INTENT_TYPE

#define ICC_INTENT_TYPE (   n)    ((int) (((n) >> 16) & 0xff))

Definition at line 630 of file pdfcolor.c.

◆ iccNullSig

#define iccNullSig   0

Definition at line 603 of file pdfcolor.c.

◆ PDF_COLORSPACE_FAMILY_CIEBASED

#define PDF_COLORSPACE_FAMILY_CIEBASED   1

Definition at line 1559 of file pdfcolor.c.

◆ PDF_COLORSPACE_FAMILY_DEVICE

#define PDF_COLORSPACE_FAMILY_DEVICE   0

Definition at line 1558 of file pdfcolor.c.

◆ PDF_COLORSPACE_FAMILY_SPECIAL

#define PDF_COLORSPACE_FAMILY_SPECIAL   2

Definition at line 1560 of file pdfcolor.c.

◆ print_iccSig

#define print_iccSig (   s,
  t 
)
Value:
if ((s) == 0) {\
MESG("pdf_color>> %s:\t(null)\n", (t)); \
} else if (!isprint(((s) >> 24) & 0xff) || \
!isprint(((s) >> 16) & 0xff) || \
!isprint(((s) >> 8) & 0xff) || \
!isprint((s) & 0xff)) { \
MESG("pdf_color>> %s:\t(invalid)\n", (t)); \
} else { \
MESG("pdf_color>> %s:\t%c%c%c%c\n", (t), \
((s) >> 24) & 0xff, ((s) >> 16) & 0xff, \
((s) >> 8) & 0xff, (s) & 0xff); \
}
#define s
Definition: afcover.h:80
Definition: dvips.h:235

◆ sget_signed_long

#define sget_signed_long (   p)    ((int32_t) ((p)[0] << 24|(p)[1] << 16|(p)[2] << 8|(p)[3]))

Definition at line 800 of file pdfcolor.c.

◆ sget_signed_short

#define sget_signed_short (   p)    ((short) ((p)[0] << 8|(p)[1]))

Definition at line 801 of file pdfcolor.c.

Typedef Documentation

◆ iccSig

typedef uint32_t iccSig

Definition at line 562 of file pdfcolor.c.

Function Documentation

◆ compare_iccbased()

static int compare_iccbased ( const char *  ident1,
const struct iccbased_cdata cdata1,
const char *  ident2,
const struct iccbased_cdata cdata2 
)
static

◆ get_num_components_iccbased()

static int get_num_components_iccbased ( const struct iccbased_cdata cdata)
static

◆ iccp_check_colorspace()

int iccp_check_colorspace ( int  colortype,
const void profile,
int  proflen 
)

◆ iccp_devClass_allowed()

static int iccp_devClass_allowed ( int  dev_class)
static

Definition at line 1027 of file pdfcolor.c.

References pdf_dev_get_param(), PDF_DEV_PARAM_COLORMODE, and str2iccSig().

Referenced by iccp_load_profile().

◆ iccp_get_checksum()

static void iccp_get_checksum ( unsigned char *  checksum,
const void profile,
int  proflen 
)
static

◆ iccp_get_rendering_intent()

pdf_obj* iccp_get_rendering_intent ( const void profile,
int  proflen 
)

◆ iccp_init_iccHeader()

◆ iccp_load_profile()

◆ iccp_unpack_header()

◆ iccp_version_supported()

static int iccp_version_supported ( int  major,
int  minor 
)
static

Definition at line 543 of file pdfcolor.c.

References icc_versions, idx, major, minor, and pdf_get_version().

Referenced by iccp_load_profile().

◆ init_iccbased_cdata()

static void init_iccbased_cdata ( struct iccbased_cdata cdata)
static

Definition at line 656 of file pdfcolor.c.

References ASSERT, memset(), and PDF_COLORSPACE_TYPE_INVALID.

Referenced by iccp_load_profile().

◆ pdf_clean_colorspace_struct()

◆ pdf_close_colors()

void pdf_close_colors ( void  )

Definition at line 1541 of file pdfcolor.c.

References cspc_cache, i, NULL, pdf_clean_colorspace_struct(), pdf_flush_colorspace(), and RELEASE.

Referenced by pdf_close_document().

◆ pdf_color_brighten_color()

void pdf_color_brighten_color ( pdf_color dst,
const pdf_color src,
double  f 
)

◆ pdf_color_clear_stack()

void pdf_color_clear_stack ( void  )

Definition at line 442 of file pdfcolor.c.

References color_stack, pdf_color_black, RELEASE, and WARN().

Referenced by pdf_init_device(), and spc_handler_color_default().

◆ pdf_color_cmykcolor()

int pdf_color_cmykcolor ( pdf_color color,
double  c,
double  m,
double  y,
double  k 
)

Definition at line 82 of file pdfcolor.c.

References ASSERT, c, k, m, NULL, PDF_COLORSPACE_TYPE_CMYK, WARN(), and y.

Referenced by do_operator(), spc_read_color_color(), and spc_read_color_pdf().

◆ pdf_color_compare()

◆ pdf_color_copycolor()

◆ pdf_color_get_current()

void pdf_color_get_current ( pdf_color **  sc,
pdf_color **  fc 
)

Definition at line 492 of file pdfcolor.c.

References color_stack, fc, and sc.

Referenced by pdf_dev_reset_color(), set_fillstyle(), spc_handler_pdfm_bcolor(), and spc_handler_pdfm_scolor().

◆ pdf_color_graycolor()

int pdf_color_graycolor ( pdf_color color,
double  g 
)

Definition at line 119 of file pdfcolor.c.

References ASSERT, g, NULL, PDF_COLORSPACE_TYPE_GRAY, and WARN().

Referenced by do_operator(), spc_read_color_color(), and spc_read_color_pdf().

◆ pdf_color_is_white()

int pdf_color_is_white ( const pdf_color color)

◆ pdf_color_pop()

void pdf_color_pop ( void  )

◆ pdf_color_push()

void pdf_color_push ( pdf_color sc,
pdf_color fc 
)

◆ pdf_color_rgbcolor()

int pdf_color_rgbcolor ( pdf_color color,
double  r,
double  g,
double  b 
)

◆ pdf_color_set()

void pdf_color_set ( pdf_color sc,
pdf_color fc 
)

◆ pdf_color_set_color()

◆ pdf_color_spotcolor()

int pdf_color_spotcolor ( pdf_color color,
char *  name,
double  c 
)

Definition at line 140 of file pdfcolor.c.

References ASSERT, c, name, PDF_COLORSPACE_TYPE_SPOT, and WARN().

Referenced by spc_read_color_color().

◆ pdf_color_type()

int pdf_color_type ( const pdf_color color)

Definition at line 44 of file pdfcolor.c.

References ASSERT.

Referenced by pdf_color_set_color().

◆ pdf_colorspace_defineresource()

◆ pdf_colorspace_findresource()

int pdf_colorspace_findresource ( const char *  ident,
int  subtype,
const void cdata 
)
static

◆ pdf_flush_colorspace()

static void pdf_flush_colorspace ( pdf_colorspace colorspace)
static

Definition at line 1410 of file pdfcolor.c.

References ASSERT, NULL, pdf_release_obj(), pdf_colorspace::reference, and pdf_colorspace::resource.

Referenced by pdf_close_colors().

◆ pdf_get_colorspace_reference()

pdf_obj* pdf_get_colorspace_reference ( int  cspc_id)

◆ pdf_init_colors()

void pdf_init_colors ( void  )

Definition at line 1533 of file pdfcolor.c.

References cspc_cache, and NULL.

Referenced by pdf_open_document().

◆ pdf_init_colorspace_struct()

◆ print_iccp_header()

◆ release_iccbased_cdata()

static void release_iccbased_cdata ( struct iccbased_cdata cdata)
static

Definition at line 669 of file pdfcolor.c.

References ASSERT, check_sig, and RELEASE.

Referenced by iccp_load_profile(), and pdf_clean_colorspace_struct().

◆ str2iccSig()

static iccSig str2iccSig ( const void s)
static

Variable Documentation

◆ capacity

int capacity

Definition at line 1335 of file pdfcolor.c.

Referenced by _appendPrivateuseToLanguageTag(), _getBuffer(), _HashMap_const_iterator< K, V >::_HashMap_const_iterator(), _pool_alloc_from_new_chunk(), _pool_chunk_init(), U_NAMESPACE_USE::acceptLanguage(), addCollation(), U_NAMESPACE_BEGIN::MutableCodePointTrie::allocDataBlock(), allocDataBlock(), ByteSinkUtil::appendChange(), RegexCImpl::appendReplacement(), appendUTF8(), Vector< T * >::capacity(), checkArgs(), number::impl::DecimalQuantity::checkHealth(), CollationIterator::CEBuffer::ensureAppendCapacity(), TextWord::ensureCapacity(), number::impl::DecimalQuantity::ensureCapacity(), CharString::ensureCapacity(), CharString::extract(), extractPackageName(), getCodesFromLocale(), CollationData::getEquivalentScripts(), CollationFastLatin::getOptions(), gregorio_kpse_find(), FontRuns::grow(), LocaleRuns::grow(), ValueRuns::grow(), ULocRuns::grow(), idForLocale(), RunArray::init(), FontRuns::init(), LocaleRuns::init(), ValueRuns::init(), ULocRuns::init(), init_resb_result(), String::make_claim(), makeFullFilename(), makeFullFilenameAndDirs(), makeTargetName(), UTS46::mapDevChars(), _HashMap_const_iterator< K, V >::operator++(), FormattedStringBuilder::operator=(), outputChar(), outputHexBytes(), outputPtrBytes(), outputString(), outputUString(), pool_alloc(), printComments(), printNoteElements(), graphite2::Vector< T >::reserve(), resize_capa(), setCodes(), setOneCode(), CollationSettings::setReorderArrays(), HashMap< K, V >::swap(), TransliteratorSpec::TransliteratorSpec(), u_fstropen_68(), u_writeIdenticalLevelRun_68(), ubrk_getRuleStatusVec_68(), ucol_cloneBinary_68(), ucol_getShortDefinitionString_68(), ucol_normalizeShortDefinitionString_68(), ucol_sit_dumpSpecs(), ucptrie_toBinary_68(), udatpg_addPattern_68(), udatpg_getBaseSkeleton_68(), udatpg_getBestPattern_68(), udatpg_getBestPatternWithOptions_68(), udatpg_getFieldDisplayName_68(), udatpg_getSkeleton_68(), uidna_labelToASCII_68(), uidna_labelToASCII_UTF8_68(), uidna_labelToUnicode_68(), uidna_labelToUnicodeUTF8_68(), uidna_nameToASCII_68(), uidna_nameToASCII_UTF8_68(), uidna_nameToUnicode_68(), uidna_nameToUnicodeUTF8_68(), unorm2_getDecomposition_68(), unorm2_getRawDecomposition_68(), unorm2_normalize_68(), uplrules_select_68(), uplrules_selectFormatted_68(), uplrules_selectForRange_68(), uplrules_selectWithFormat_68(), uprv_itou_68(), uprv_makeDenseRanges(), ures_toUTF8String(), uscript_getCode_68(), uscript_getSampleString_68(), uscript_getScriptExtensions_68(), uspoof_serialize(), utm_hasCapacity(), utrace_format_68(), utrace_vformat_68(), utrie2_serialize_68(), utrie_serialize_68(), CollationDataWriter::write(), CollationDataWriter::writeBase(), and CollationDataWriter::writeTailoring().

◆ 

color_stack { ... } struct

◆ colorspaces

pdf_colorspace* colorspaces

Definition at line 1336 of file pdfcolor.c.

◆ count

int count

Definition at line 1334 of file pdfcolor.c.

◆ 

cspc_cache { ... } struct

◆ current

int current

Definition at line 434 of file pdfcolor.c.

◆ current_fill

pdf_color current_fill
Initial value:
= {
-1,
-1 ,
1,
{0.0},
-1
}

Definition at line 370 of file pdfcolor.c.

◆ current_stroke

pdf_color current_stroke
Initial value:
= {
-1,
-1 ,
1,
{0.0},
-1
}

Definition at line 379 of file pdfcolor.c.

◆ default_color

pdf_color default_color
Initial value:
= {
-1,
-1 ,
1,
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-1
}

Definition at line 422 of file pdfcolor.c.

◆ fill

pdf_color fill[128]

Definition at line 436 of file pdfcolor.c.

◆ 

icc_versions[] { ... } struct
Initial value:
= {
{0, 0},
{0, 0},
{0, 0},
{0x02, 0x10},
{0x02, 0x20},
{0x04, 0x00},
{0x04, 0x00},
{0x04, 0x20},
{0x04, 0x20},
{0x04, 0x20},
{0x04, 0x20}
}

Referenced by iccp_version_supported().

◆ major

◆ minor

◆ nullbytes16

unsigned char nullbytes16[16]
static
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}

Definition at line 520 of file pdfcolor.c.

Referenced by compare_iccbased(), iccp_get_checksum(), iccp_load_profile(), and print_iccp_header().

◆ stroke