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)  

pdfspecial.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
#include "system.h"
#include "mem.h"
#include "mfileio.h"
#include "numbers.h"
#include "dvi.h"
#include "pdflimits.h"
#include "pdfspecial.h"
#include "pdfobj.h"
#include "pdfdoc.h"
#include "pdfdev.h"
#include "pdfparse.h"
#include "jpeg.h"
#include "epdf.h"
#include "mpost.h"
#include "psimage.h"
#include "config.h"
#include <png.h>
#include "pngimage.h"
Include dependency graph for pdfspecial.c:

Go to the source code of this file.

Classes

struct  pdfmark
 
struct  named_reference
 

Macros

#define verbose   0
 
#define debug   0
 
#define WIDTH   0
 
#define HEIGHT   1
 
#define DEPTH   2
 
#define SCALE   3
 
#define XSCALE   4
 
#define YSCALE   5
 
#define ROTATE   6
 
#define BBOX   7
 
#define ANN   1
 
#define OUTLINE   2
 
#define ARTICLE   3
 
#define DEST   4
 
#define DOCINFO   7
 
#define DOCVIEW   8
 
#define OBJ   9
 
#define CONTENT   10
 
#define PUT   11
 
#define CLOSE   12
 
#define BOP   13
 
#define EOP   14
 
#define BEAD   15
 
#define EPDF   16
 
#define IMAGE   17
 
#define BCOLOR   18
 
#define ECOLOR   19
 
#define BGRAY   20
 
#define EGRAY   21
 
#define BGCOLOR   22
 
#define BXFORM   23
 
#define EXFORM   24
 
#define PAGE_SIZE   25
 
#define BXOBJ   26
 
#define EXOBJ   27
 
#define UXOBJ   28
 
#define SCOLOR   29
 
#define BANN   30
 
#define EANN   31
 
#define LINK_ANNOT   32
 
#define NOLINK_ANNOT   33
 

Functions

static void add_reference (char *name, pdf_obj *object, char *res_name)
 
static void release_reference (char *name)
 
static pdf_objlookup_reference (char *name)
 
static char * lookup_ref_res_name (char *name)
 
static pdf_objlookup_object (char *name)
 
static void do_content (char **start, char *end, double x_user, double y_user)
 
static void do_image (char **start, char *end, double x_user, double y_user)
 
static pdf_objjpeg_start_image (FILE *file)
 
static void finish_image (pdf_obj *image_res, struct xform_info *p, char *res_name)
 
static void do_bxobj (char **start, char *end, double x_user, double y_user)
 
static void do_exobj (void)
 
static void do_uxobj (char **start, char *end, double x_user, double y_user)
 
void pdf_special_set_grow (double g)
 
double pdf_special_tell_grow (void)
 
void pdf_special_ignore_colors (void)
 
static void do_bop (char **start, char *end)
 
static void do_eop (char **start, char *end)
 
pdf_objget_reference (char **start, char *end)
 
pdf_objget_reference_lvalue (char **start, char *end)
 
static void do_put (char **start, char *end)
 
struct xform_infonew_xform_info (void)
 
void release_xform_info (struct xform_info *p)
 
int validate_image_xform_info (struct xform_info *p)
 
static int parse_one_dim_word (char **start, char *end)
 
double parse_one_unit (char **start, char *end)
 
static int parse_dimension (char **start, char *end, struct xform_info *p)
 
static void do_pagesize (char **start, char *end)
 
static void do_ann (char **start, char *end)
 
static void do_bann (char **start, char *end)
 
static void do_eann (char **start, char *end)
 
static void do_bgcolor (char **start, char *end)
 
static void do_bcolor (char **start, char *end)
 
static void do_scolor (char **start, char *end)
 
static void do_bgray (char **start, char *end)
 
static void do_ecolor (void)
 
static void do_egray (void)
 
static void do_bxform (char **start, char *end, double x_user, double y_user)
 
static void do_exform (void)
 
static void do_outline (char **start, char *end)
 
static void do_article (char **start, char *end)
 
static void do_bead (char **start, char *end)
 
pdf_objembed_image (char *filename, struct xform_info *p, double x_user, double y_user, char *objname)
 
static void do_dest (char **start, char *end)
 
static void do_docinfo (char **start, char *end)
 
static void do_docview (char **start, char *end)
 
static void do_close (char **start, char *end)
 
static void do_obj (char **start, char *end)
 
static int is_pdf_special (char **start, char *end)
 
static int parse_pdfmark (char **start, char *end)
 
void pdf_finish_specials (void)
 
int pdf_parse_special (char *buffer, UNSIGNED_QUAD size, double x_user, double y_user)
 
void add_xform_matrix (double xoff, double yoff, double xscale, double yscale, double rotate)
 
void pdf_scale_image (struct xform_info *p)
 

Variables

static char ignore_colors = 0
 
static double annot_grow = 0.0
 
struct {
   char *   s
 
   int   key
 
   int   hasunits
 
dimensions []
 
pdf_objpending_annot_dict = NULL
 
struct pdfmark pdfmarks []
 
struct named_referencenamed_references = NULL
 
static unsigned long number_named_references = 0
 
static unsigned long max_named_objects = 0
 

Macro Definition Documentation

◆ ANN

#define ANN   1

Definition at line 1208 of file pdfspecial.c.

◆ ARTICLE

#define ARTICLE   3

Definition at line 1210 of file pdfspecial.c.

◆ BANN

#define BANN   30

Definition at line 1235 of file pdfspecial.c.

◆ BBOX

#define BBOX   7

Definition at line 218 of file pdfspecial.c.

◆ BCOLOR

#define BCOLOR   18

Definition at line 1223 of file pdfspecial.c.

◆ BEAD

#define BEAD   15

Definition at line 1220 of file pdfspecial.c.

◆ BGCOLOR

#define BGCOLOR   22

Definition at line 1227 of file pdfspecial.c.

◆ BGRAY

#define BGRAY   20

Definition at line 1225 of file pdfspecial.c.

◆ BOP

#define BOP   13

Definition at line 1218 of file pdfspecial.c.

◆ BXFORM

#define BXFORM   23

Definition at line 1228 of file pdfspecial.c.

◆ BXOBJ

#define BXOBJ   26

Definition at line 1231 of file pdfspecial.c.

◆ CLOSE

#define CLOSE   12

Definition at line 1217 of file pdfspecial.c.

◆ CONTENT

#define CONTENT   10

Definition at line 1215 of file pdfspecial.c.

◆ debug

#define debug   0

Definition at line 55 of file pdfspecial.c.

◆ DEPTH

#define DEPTH   2

Definition at line 213 of file pdfspecial.c.

◆ DEST

#define DEST   4

Definition at line 1211 of file pdfspecial.c.

◆ DOCINFO

#define DOCINFO   7

Definition at line 1212 of file pdfspecial.c.

◆ DOCVIEW

#define DOCVIEW   8

Definition at line 1213 of file pdfspecial.c.

◆ EANN

#define EANN   31

Definition at line 1236 of file pdfspecial.c.

◆ ECOLOR

#define ECOLOR   19

Definition at line 1224 of file pdfspecial.c.

◆ EGRAY

#define EGRAY   21

Definition at line 1226 of file pdfspecial.c.

◆ EOP

#define EOP   14

Definition at line 1219 of file pdfspecial.c.

◆ EPDF

#define EPDF   16

Definition at line 1221 of file pdfspecial.c.

◆ EXFORM

#define EXFORM   24

Definition at line 1229 of file pdfspecial.c.

◆ EXOBJ

#define EXOBJ   27

Definition at line 1232 of file pdfspecial.c.

◆ HEIGHT

#define HEIGHT   1

Definition at line 212 of file pdfspecial.c.

◆ IMAGE

#define IMAGE   17

Definition at line 1222 of file pdfspecial.c.

◆ LINK_ANNOT

#define LINK_ANNOT   32

Definition at line 1237 of file pdfspecial.c.

◆ NOLINK_ANNOT

#define NOLINK_ANNOT   33

Definition at line 1238 of file pdfspecial.c.

◆ OBJ

#define OBJ   9

Definition at line 1214 of file pdfspecial.c.

◆ OUTLINE

#define OUTLINE   2

Definition at line 1209 of file pdfspecial.c.

◆ PAGE_SIZE

#define PAGE_SIZE   25

Definition at line 1230 of file pdfspecial.c.

◆ PUT

#define PUT   11

Definition at line 1216 of file pdfspecial.c.

◆ ROTATE

#define ROTATE   6

Definition at line 217 of file pdfspecial.c.

◆ SCALE

#define SCALE   3

Definition at line 214 of file pdfspecial.c.

◆ SCOLOR

#define SCOLOR   29

Definition at line 1234 of file pdfspecial.c.

◆ UXOBJ

#define UXOBJ   28

Definition at line 1233 of file pdfspecial.c.

◆ verbose

#define verbose   0

Definition at line 54 of file pdfspecial.c.

◆ WIDTH

#define WIDTH   0

Definition at line 211 of file pdfspecial.c.

◆ XSCALE

#define XSCALE   4

Definition at line 215 of file pdfspecial.c.

◆ YSCALE

#define YSCALE   5

Definition at line 216 of file pdfspecial.c.

Function Documentation

◆ add_reference()

◆ add_xform_matrix()

void add_xform_matrix ( double  xoff,
double  yoff,
double  xscale,
double  yscale,
double  rotate 
)

Definition at line 1655 of file pdfspecial.c.

References c, cos(), e, pdf_doc_add_to_page(), rotate, ROUND, s, sin(), sprintf, strlen(), work_buffer, xscale, and yscale.

Referenced by do_operator(), and embed_image().

◆ do_ann()

◆ do_article()

static void do_article ( char **  start,
char *  end 
)
static

◆ do_bann()

static void do_bann ( char **  start,
char *  end 
)
static

◆ do_bcolor()

◆ do_bead()

◆ do_bgcolor()

static void do_bgcolor ( char **  start,
char *  end 
)
static

◆ do_bgray()

static void do_bgray ( char **  start,
char *  end 
)
static

Definition at line 760 of file pdfspecial.c.

References atof(), dev_begin_gray(), end, fprintf, NULL, parse_number(), RELEASE, skip_white(), and start.

Referenced by pdf_parse_special().

◆ do_bop()

static void do_bop ( char **  start,
char *  end 
)
static

Definition at line 91 of file pdfspecial.c.

References end, MEM_END, MEM_START, pdf_doc_bop(), and start.

Referenced by pdf_parse_special().

◆ do_bxform()

static void do_bxform ( char **  start,
char *  end,
double  x_user,
double  y_user 
)
static

◆ do_bxobj()

static void do_bxobj ( char **  start,
char *  end,
double  x_user,
double  y_user 
)
static

◆ do_close()

static void do_close ( char **  start,
char *  end 
)
static

◆ do_content()

static void do_content ( char **  start,
char *  end,
double  x_user,
double  y_user 
)
static

Definition at line 1183 of file pdfspecial.c.

References end, len, pdf_doc_add_to_page(), sprintf, start, and work_buffer.

Referenced by pdf_parse_special().

◆ do_dest()

◆ do_docinfo()

static void do_docinfo ( char **  start,
char *  end 
)
static

◆ do_docview()

static void do_docview ( char **  start,
char *  end 
)
static

◆ do_eann()

static void do_eann ( char **  start,
char *  end 
)
static

◆ do_ecolor()

static void do_ecolor ( void  )
static

Definition at line 773 of file pdfspecial.c.

References dev_end_color().

Referenced by pdf_parse_special().

◆ do_egray()

static void do_egray ( void  )
static

Definition at line 778 of file pdfspecial.c.

References dev_end_color().

Referenced by pdf_parse_special().

◆ do_eop()

static void do_eop ( char **  start,
char *  end 
)
static

Definition at line 105 of file pdfspecial.c.

References end, MEM_END, MEM_START, pdf_doc_eop(), and start.

Referenced by pdf_parse_special().

◆ do_exform()

static void do_exform ( void  )
static

Definition at line 829 of file pdfspecial.c.

References dev_end_xform(), MEM_END, and MEM_START.

Referenced by pdf_parse_special().

◆ do_exobj()

static void do_exobj ( void  )
static

Definition at line 1836 of file pdfspecial.c.

References end_form_xobj().

Referenced by pdf_parse_special().

◆ do_image()

◆ do_obj()

static void do_obj ( char **  start,
char *  end 
)
static

◆ do_outline()

◆ do_pagesize()

static void do_pagesize ( char **  start,
char *  end 
)
static

◆ do_put()

◆ do_scolor()

◆ do_uxobj()

static void do_uxobj ( char **  start,
char *  end,
double  x_user,
double  y_user 
)
static

◆ embed_image()

◆ finish_image()

static void finish_image ( pdf_obj image_res,
struct xform_info p,
char *  res_name 
)
static

◆ get_reference()

pdf_obj* get_reference ( char **  start,
char *  end 
)

◆ get_reference_lvalue()

pdf_obj* get_reference_lvalue ( char **  start,
char *  end 
)

◆ is_pdf_special()

static int is_pdf_special ( char **  start,
char *  end 
)
static

Definition at line 1197 of file pdfspecial.c.

References end, skip_white(), start, strlen(), and strncmp().

Referenced by pdf_parse_special().

◆ jpeg_start_image()

◆ lookup_object()

◆ lookup_ref_res_name()

char * lookup_ref_res_name ( char *  name)
static

Definition at line 1460 of file pdfspecial.c.

References fprintf, i, name, named_references, NULL, number_named_references, and strcmp().

Referenced by do_uxobj().

◆ lookup_reference()

◆ new_xform_info()

◆ parse_dimension()

static int parse_dimension ( char **  start,
char *  end,
struct xform_info p 
)
static

◆ parse_one_dim_word()

static int parse_one_dim_word ( char **  start,
char *  end 
)
static

◆ parse_one_unit()

double parse_one_unit ( char **  start,
char *  end 
)

◆ parse_pdfmark()

static int parse_pdfmark ( char **  start,
char *  end 
)
static

Definition at line 1312 of file pdfspecial.c.

References dump(), end, fprintf, i, isalpha, pdfmarks, save, skip_white(), start, strlen(), strncmp(), and verbose.

Referenced by pdf_parse_special().

◆ pdf_finish_specials()

void pdf_finish_specials ( void  )

◆ pdf_parse_special()

◆ pdf_scale_image()

void pdf_scale_image ( struct xform_info p)

Definition at line 1701 of file pdfspecial.c.

References p, xscale, and yscale.

Referenced by do_operator(), finish_image(), mp_include(), and pdf_include_page().

◆ pdf_special_ignore_colors()

void pdf_special_ignore_colors ( void  )

Definition at line 86 of file pdfspecial.c.

References ignore_colors.

Referenced by main().

◆ pdf_special_set_grow()

void pdf_special_set_grow ( double  g)

Definition at line 77 of file pdfspecial.c.

References annot_grow, and g.

Referenced by do_args().

◆ pdf_special_tell_grow()

double pdf_special_tell_grow ( void  )

Definition at line 81 of file pdfspecial.c.

References annot_grow.

Referenced by pdf_doc_flush_annot().

◆ release_reference()

static void release_reference ( char *  name)
static

◆ release_xform_info()

void release_xform_info ( struct xform_info p)

Definition at line 257 of file pdfspecial.c.

References p, and RELEASE.

Referenced by do_ann(), do_bead(), do_bxform(), do_bxobj(), do_image(), do_operator(), do_pagesize(), do_texfig(), and parse_psfile().

◆ validate_image_xform_info()

int validate_image_xform_info ( struct xform_info p)

Definition at line 263 of file pdfspecial.c.

References fprintf, p, and check-static-inits::result.

Referenced by do_bxform(), do_image(), do_texfig(), and parse_psfile().

Variable Documentation

◆ annot_grow

double annot_grow = 0.0
static

Definition at line 75 of file pdfspecial.c.

Referenced by do_ann(), pdf_special_set_grow(), and pdf_special_tell_grow().

◆ 

dimensions[] { ... } struct
Initial value:
= {
{"width", 0 , 1},
{"height", 1 , 1},
{"depth", 2 , 1},
{"scale", 3 , 0},
{"xscale", 4 , 0},
{"yscale", 5 , 0},
{"rotate", 6 , 0},
{"bbox", 7 , 0}
}

Referenced by caryll_VectorInterfaceTypeName(), createNeutralVV(), createRegionFromTuples(), main(), parse_dimension(), parse_one_dim_word(), vq_createRegion(), and write_header().

◆ hasunits

int hasunits

Definition at line 223 of file pdfspecial.c.

Referenced by parse_dimension().

◆ ignore_colors

char ignore_colors = 0
static

Definition at line 74 of file pdfspecial.c.

Referenced by pdf_parse_special(), and pdf_special_ignore_colors().

◆ is_true_unit

int is_true_unit

Definition at line 314 of file pdfspecial.c.

Referenced by parse_one_unit().

◆ key

int key

Definition at line 222 of file pdfspecial.c.

Referenced by parse_dimension().

◆ max_named_objects

unsigned long max_named_objects = 0
static

Definition at line 1348 of file pdfspecial.c.

Referenced by add_reference().

◆ named_references

◆ number_named_references

unsigned long number_named_references = 0
static

◆ pdfmarks

struct pdfmark pdfmarks[]

Referenced by parse_pdfmark().

◆ pending_annot_dict

pdf_obj* pending_annot_dict = NULL

Definition at line 554 of file pdfspecial.c.

Referenced by do_bann(), and do_eann().

◆ s

char* s

Definition at line 221 of file pdfspecial.c.

Referenced by add_xform_matrix(), parse_one_dim_word(), and parse_one_unit().

◆ 

units { ... } struct
Initial value:
= {
{"pt", (72.0/72.27), 0},
{"in", (72.0), 0},
{"cm", (72.0/2.54), 0},
{"mm", (72.0/25.4), 0},
{"truept", (72.0/72.27), 1},
{"truein", (72.0), 1},
{"truecm", (72.0/2.54), 1},
{"truemm", (72.0/25.4), 1}
}

Definition at line 313 of file pdfspecial.c.

Referenced by decNumberRotate(), decShiftToLeast(), Length::getUnits(), parse_dimension(), parse_one_unit(), png_handle_pCAL(), test_one_file(), and uprv_decNumberRotate_68().