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)  

backend_eps.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include "potracelib.h"
#include "curve.h"
#include "main.h"
#include "backend_eps.h"
#include "flate.h"
#include "lists.h"
#include "auxiliary.h"
Include dependency graph for backend_eps.c:

Go to the source code of this file.

Macros

#define SAFE_CALLOC(var, n, typ)    if ((var = (typ *)calloc(n, sizeof(typ))) == NULL) goto calloc_error
 
#define black   0x000000
 
#define red   0xff0000
 
#define green   0x008000
 
#define blue   0x0000ff
 
#define TRY(x)   if (x) goto try_error
 

Typedefs

typedef int color_t
 

Functions

static int ship (const char *fmt,...)
 
static int shipcom (const char *fmt,...)
 
static void eps_callbacks (FILE *fout)
 
static point_t unit (dpoint_t p)
 
static void eps_coords (dpoint_t p)
 
static void eps_rcoords (dpoint_t p)
 
static void eps_moveto (dpoint_t p)
 
static void eps_moveto_offs (dpoint_t p, double xoffs, double yoffs)
 
static void eps_lineto (dpoint_t p)
 
static void eps_curveto (dpoint_t p1, dpoint_t p2, dpoint_t p3)
 
static const char * eps_colorstring (const color_t col)
 
static void eps_setcolor (const color_t col)
 
static void eps_linewidth (double w)
 
static int eps_path_long (privcurve_t *curve)
 
static int eps_path_short (privcurve_t *curve)
 
static int eps_path (privcurve_t *curve)
 
static void eps_jaggy (potrace_path_t *plist)
 
static void eps_polygon (privcurve_t *curve, const color_t col)
 
static void eps_L (privcurve_t *curve, const color_t col)
 
static int render0 (potrace_path_t *plist)
 
static int render0_opaque (potrace_path_t *plist)
 
static int render1 (potrace_path_t *plist)
 
static int render2 (potrace_path_t *plist)
 
static int render_debug (potrace_path_t *plist)
 
static int eps_render (potrace_path_t *plist)
 
static int eps_init (imginfo_t *imginfo)
 
static void eps_term (void)
 
int page_eps (FILE *fout, potrace_path_t *plist, imginfo_t *imginfo)
 
int init_ps (FILE *fout)
 
int term_ps (FILE *fout)
 
static void eps_pageinit_ps (imginfo_t *imginfo)
 
static void eps_pageterm_ps (void)
 
int page_ps (FILE *fout, potrace_path_t *plist, imginfo_t *imginfo)
 

Variables

static int(* xship )(FILE *f, int filter, const char *s, int len)
 
static FILExship_file
 
static point_t cur
 
static color_t eps_color = -1
 
static double eps_width = -1
 
static const char * optimacros
 
static const char * debugmacros
 
static int eps_pagenumber
 

Macro Definition Documentation

◆ black

#define black   0x000000

Definition at line 34 of file backend_eps.c.

◆ blue

#define blue   0x0000ff

Definition at line 37 of file backend_eps.c.

◆ green

#define green   0x008000

Definition at line 36 of file backend_eps.c.

◆ red

#define red   0xff0000

Definition at line 35 of file backend_eps.c.

◆ SAFE_CALLOC

#define SAFE_CALLOC (   var,
  n,
  typ 
)     if ((var = (typ *)calloc(n, sizeof(typ))) == NULL) goto calloc_error

Definition at line 29 of file backend_eps.c.

◆ TRY

#define TRY (   x)    if (x) goto try_error

Definition at line 39 of file backend_eps.c.

Typedef Documentation

◆ color_t

typedef int color_t

Definition at line 32 of file backend_eps.c.

Function Documentation

◆ eps_callbacks()

static void eps_callbacks ( FILE fout)
static

Definition at line 84 of file backend_eps.c.

References dummy_xship(), flate_xship(), fout, info, lzw_xship(), xship, and xship_file.

Referenced by init_ps(), page_eps(), page_ps(), and term_ps().

◆ eps_colorstring()

static const char* eps_colorstring ( const color_t  col)
static

Definition at line 156 of file backend_eps.c.

References b, buf, col, g, r, and sprintf.

Referenced by eps_init(), eps_setcolor(), and init_ps().

◆ eps_coords()

static void eps_coords ( dpoint_t  p)
static

Definition at line 110 of file backend_eps.c.

References cur, p, ship(), unit(), point_s::x, and point_s::y.

Referenced by eps_moveto(), eps_moveto_offs(), render1(), render2(), and render_debug().

◆ eps_curveto()

static void eps_curveto ( dpoint_t  p1,
dpoint_t  p2,
dpoint_t  p3 
)
static

Definition at line 143 of file backend_eps.c.

References cur, p1, p2, q1, q2, q3, ship(), unit(), point_s::x, and point_s::y.

Referenced by eps_path_long().

◆ eps_init()

◆ eps_jaggy()

static void eps_jaggy ( potrace_path_t plist)
static

Definition at line 321 of file backend_eps.c.

References cur, dpoint(), eps_lineto(), eps_moveto(), i, list_forall, NULL, p, prev, pt, ship(), cordic::x, point_s::x, and point_s::y.

Referenced by render1(), render2(), and render_debug().

◆ eps_L()

static void eps_L ( privcurve_t curve,
const color_t  col 
)
static

◆ eps_lineto()

static void eps_lineto ( dpoint_t  p)
static

Definition at line 138 of file backend_eps.c.

References eps_rcoords(), p, and ship().

Referenced by eps_jaggy(), eps_L(), eps_path_long(), eps_polygon(), and render1().

◆ eps_linewidth()

static void eps_linewidth ( double  w)
static

Definition at line 189 of file backend_eps.c.

References eps_width, info, ship(), and w.

Referenced by eps_L(), eps_polygon(), render1(), render2(), and render_debug().

◆ eps_moveto()

static void eps_moveto ( dpoint_t  p)
static

Definition at line 123 of file backend_eps.c.

References eps_coords(), p, and ship().

Referenced by eps_jaggy(), eps_L(), eps_path_long(), eps_polygon(), render1(), render2(), and render_debug().

◆ eps_moveto_offs()

static void eps_moveto_offs ( dpoint_t  p,
double  xoffs,
double  yoffs 
)
static

Definition at line 129 of file backend_eps.c.

References eps_coords(), p, and ship().

Referenced by eps_L(), and render_debug().

◆ eps_pageinit_ps()

static void eps_pageinit_ps ( imginfo_t imginfo)
static

◆ eps_pageterm_ps()

static void eps_pageterm_ps ( void  )
static

Definition at line 831 of file backend_eps.c.

References ship().

Referenced by page_ps().

◆ eps_path()

static int eps_path ( privcurve_t curve)
static

Definition at line 308 of file backend_eps.c.

References eps_path_long(), eps_path_short(), and info.

Referenced by render0(), render0_opaque(), render2(), and render_debug().

◆ eps_path_long()

static int eps_path_long ( privcurve_t curve)
static

Definition at line 204 of file backend_eps.c.

References c, eps_curveto(), eps_lineto(), eps_moveto(), i, m, POTRACE_CORNER, and POTRACE_CURVETO.

Referenced by eps_path().

◆ eps_path_short()

static int eps_path_short ( privcurve_t curve)
static

Definition at line 228 of file backend_eps.c.

References abs, dpoint(), free, i, int(), interval(), m, M, max, mod(), NULL, POTRACE_CURVETO, q, SAFE_CALLOC, ship(), unit(), v, cordic::x, and y.

Referenced by eps_path().

◆ eps_polygon()

static void eps_polygon ( privcurve_t curve,
const color_t  col 
)
static

Definition at line 360 of file backend_eps.c.

References col, eps_lineto(), eps_linewidth(), eps_moveto(), eps_setcolor(), i, m, and ship().

Referenced by render2(), and render_debug().

◆ eps_rcoords()

static void eps_rcoords ( dpoint_t  p)
static

Definition at line 115 of file backend_eps.c.

References cur, p, q, ship(), unit(), point_s::x, and point_s::y.

Referenced by eps_lineto().

◆ eps_render()

static int eps_render ( potrace_path_t plist)
static

Definition at line 666 of file backend_eps.c.

References info, r, render0(), render0_opaque(), render1(), render2(), and render_debug().

Referenced by page_eps(), and page_ps().

◆ eps_setcolor()

static void eps_setcolor ( const color_t  col)
static

Definition at line 180 of file backend_eps.c.

References col, eps_color, eps_colorstring(), and ship().

Referenced by eps_L(), eps_polygon(), render0(), render0_opaque(), render1(), render2(), and render_debug().

◆ eps_term()

static void eps_term ( void  )
static

Definition at line 740 of file backend_eps.c.

References ship(), and shipcom().

Referenced by page_eps().

◆ init_ps()

int init_ps ( FILE fout)

◆ page_eps()

int page_eps ( FILE fout,
potrace_path_t plist,
imginfo_t imginfo 
)

Definition at line 746 of file backend_eps.c.

References eps_callbacks(), eps_init(), eps_render(), eps_term(), fout, and TRY.

◆ page_ps()

int page_ps ( FILE fout,
potrace_path_t plist,
imginfo_t imginfo 
)

◆ render0()

static int render0 ( potrace_path_t plist)
static

Definition at line 448 of file backend_eps.c.

References eps_path(), eps_setcolor(), info, list_forall, NULL, p, ship(), and TRY.

Referenced by eps_render().

◆ render0_opaque()

static int render0_opaque ( potrace_path_t plist)
static

Definition at line 477 of file backend_eps.c.

References eps_path(), eps_setcolor(), info, list_forall, p, ship(), and TRY.

Referenced by eps_render().

◆ render1()

static int render1 ( potrace_path_t plist)
static

◆ render2()

static int render2 ( potrace_path_t plist)
static

◆ render_debug()

◆ ship()

◆ shipcom()

static int shipcom ( const char *  fmt,
  ... 
)
static

Definition at line 70 of file backend_eps.c.

References args, buf, fmt, strlen(), va_end, va_start, xship, and xship_file.

Referenced by eps_init(), eps_pageinit_ps(), eps_term(), init_ps(), page_ps(), and term_ps().

◆ term_ps()

int term_ps ( FILE fout)

Definition at line 799 of file backend_eps.c.

References eps_callbacks(), eps_pagenumber, fflush, fout, and shipcom().

◆ unit()

static point_t unit ( dpoint_t  p)
inlinestatic

Definition at line 99 of file backend_eps.c.

References floor, info, p, and q.

Referenced by eps_coords(), eps_curveto(), eps_path_short(), and eps_rcoords().

Variable Documentation

◆ cur

point_t cur
static

Definition at line 108 of file backend_eps.c.

Referenced by _addAttributeToList(), _addExtensionToList(), _addVariantToList(), _InterpretPS(), _pixman_choose_implementation(), _SPLCopyTransformedHintMasks(), _SplineSetApprox(), _SplineSetStroke(), aat_dumpmorx_asm(), aat_dumpmorx_ligatures(), aat_dumpmorx_substitutions(), PDFCore::addToHistory(), AltUniCopy(), AnchorPointsDuplicate(), AnyActiveSubstrings(), append_link(), append_thread(), apply_filter_TIFF2_1_2_4(), ASMFromClassFPST(), avl_slice(), BaseLangCopy(), BDF_Face_Init(), build_name_tree(), BuildFondList(), BuildStem(), calc_lon(), CalcRLEHuffLength(), cff_slot_load(), check_running_thread(), CheckPotential(), cid_parse_dict(), cid_parser_new(), cid_slot_load_glyph(), circlearcsto(), circlearcto(), ck_fclose(), ordlist< T, Telem, COMPARATOR >::clear(), closepath(), CMap_add_bfrange(), CMap_add_cidrange(), CMap_add_notdefrange(), BasicDVIReader::cmdBop(), BasicDVIReader::cmdDir(), BasicDVIReader::cmdDown(), BasicDVIReader::cmdFontDef(), BasicDVIReader::cmdFontNum(), VFReader::cmdLongChar(), BasicDVIReader::cmdPost(), GFReader::cmdPost(), BasicDVIReader::cmdPostPost(), BasicDVIReader::cmdPre(), BasicDVIReader::cmdPutChar(), BasicDVIReader::cmdPutRule(), BasicDVIReader::cmdRight(), BasicDVIReader::cmdSetChar(), BasicDVIReader::cmdSetRule(), VFReader::cmdShortChar(), BasicDVIReader::cmdW(), BasicDVIReader::cmdX(), BasicDVIReader::cmdXFontDef(), DVIReader::cmdXFontDef(), BasicDVIReader::cmdXGlyphArray(), BasicDVIReader::cmdXGlyphString(), BasicDVIReader::cmdXPic(), BasicDVIReader::cmdXTextAndGlyphs(), BasicDVIReader::cmdXXX(), BasicDVIReader::cmdY(), BasicDVIReader::cmdZ(), BasicDVIReader::collectBopOffsets(), Crop_Bitmap(), DashPattern::DashPattern(), do_annot(), do_dest(), do_handle_kerning(), do_link(), do_othersubr0(), do_postproc(), do_thread(), DStemAddHIFromActive(), DStemInfoCopy(), dump_irep(), DumpClass(), DumpHints(), dumpnames(), DumpRefsHints(), eps_coords(), eps_curveto(), eps_jaggy(), eps_rcoords(), BasicDVIReader::executeFontDefs(), GFReader::executePostamble(), BasicDVIReader::executePostPost(), FcNameFindNext(), FcStrStrIgnoreCase(), fea_NameID2NameTable(), fea_NameID2OTFName(), fea_ParseLookupDef(), fea_ParseMarkedGlyphs(), fea_TableByKeywords(), filter_TIFF2_apply_filter(), find_unicode_charmap(), find_variant_selector_charmap(), FindAllLangEntries(), FindCounterGroups(), FindLangEntry(), FindMatchingContour(), FontCache::fontinfo(), FT_Add_Default_Modules(), FT_Done_GlyphSlot(), FT_Get_Module(), FT_List_Finalize(), FT_List_Find(), ft_list_get_node_at(), FT_List_Iterate(), FT_Lookup_Renderer(), ft_module_get_service(), ft_open_face_internal(), ft_property_do(), FT_Remove_Module(), FT_Select_Charmap(), FT_Set_Charmap(), gc_marktrace(), GDFindDStems(), GDFindStems(), BasicDVIReader::goToPostamble(), Splash::gouraudTriangleShadedFill(), handle_backend_whatsit(), handle_lig_nest(), handle_lig_word(), handle_ligaturing(), HICopyTrans(), hlist_out(), hnj_serialize(), if(), JoinAllNeeded(), Load_SBit_Image(), Load_SBit_Range(), Load_TrueType_Glyph(), locate_tbl(), make_extensible(), MergeDStemInfo(), MinimumDistanceCopy(), mp_rle_huff_block(), mp_rle_huff_pblock(), Mpost_RLEHuffIBlock(), Mpost_RLEHuffPBlock(), mrb_ftruncate(), new_ligkern(), node_load(), node_slice(), ostrtouc(), parse_charstrings(), parse_dict(), parse_encoding(), parse_transform_cmd(), ParseBaseLang(), pathlist_to_tree(), pdf_coords(), pfed_read_glyph_layer(), pfr_bitwriter_decode_bytes(), pfr_bitwriter_decode_rle1(), pfr_bitwriter_decode_rle2(), pfr_glyph_load_simple(), pfr_phy_font_load(), ps_parser_load_field(), ps_parser_to_bytes(), ps_parser_to_token(), ps_parser_to_token_array(), ps_tobool(), ps_tocoordarray(), ps_tofixedarray(), PSCharStringToSplines(), psreinitnames(), pst_parse_any(), pst_parse_name(), pst_parse_number(), pst_string_parse_hex(), pst_string_parse_literal(), PSTCopy(), quantize_fs_dither(), read_binary_data(), JFM::readTables(), readttfbase(), readttfbaseminmax(), readttfcompositglyph(), RecalcT(), RefCharsCopy(), reversepathsfromto(), revrefs(), SCDefaultInterpolation(), SCGuessHintInstancesLight(), SCGuessHintPoints(), secCnctable(), VectorStreamBuffer< T >::seekoff(), set_rect_dimens(), SF_AddFPST(), SFDGetDesignSize(), SFDGetLangName(), SFDGetOtfFeatName(), SFDGetSpiros(), SFDGetSplineSet(), SFDParseBaseScript(), SFDParseJustify(), SFDParseMacFeatures(), SFDParseMacNames(), SFDReadDHints(), SFDReadHintInstances(), SFDReadHints(), SFLigaturePrepare(), sfnt_find_encoding(), ship_out(), SinglePointStroke(), skip_comment(), skip_literal_string(), skip_spaces(), skip_string(), SListCopy(), SMSetState(), Spline2DFindExtrema(), SplinePointListCopy(), SplinePointListCopy1(), SplinePointListCopySelected(), SplinePointListCopySelected1(), SplinePointListSplit(), SplineSetsPSApprox(), SplineSetsTTFApprox(), StemAddHIFromActive(), StemInfoCopy(), StrokedSplineFree(), StrokeEnd(), StrokeEndComplete(), synch_pos_with_cur(), T1_Get_Private_Dict(), T1_Load_Glyph(), t42_parse_charstrings(), t42_parse_dict(), t42_parse_encoding(), t42_parse_sfnts(), Matrix::toSVG(), TreeNext(), try_ligature(), tt_face_load_cvt(), TT_Get_SBit_Strike(), TTFAddLangStr(), ttfbuildcontours(), ttfFreeCacheData(), ttfFreeCompositeGlyph(), ttfInitCache(), ttfInitCacheData(), ttfLoadCompositeGlyph(), ttfPrintCompositeGlyph(), ucnvsel_next_encoding(), ucnvsel_reset_iterator(), ultag_getExtensionKey(), ultag_getExtensionsSize(), ultag_getExtensionValue(), ultag_getVariant(), ultag_getVariantsSize(), VI_DisplayWindow(), VI_ExecuteCommand(), VI_OutOfWindow(), vlist_out(), write_debug_record_1(), write_irep_header(), write_iseq_block(), write_lv_record(), write_lv_sym_table(), write_pool_block(), write_section_debug(), write_section_irep(), write_section_lv(), write_syms_block(), and PSImage::writeIdrawImage().

◆ debugmacros

const char* debugmacros
static
Initial value:
=
"/unit { %f } def\n"
"/box { newpath 0 0 moveto 0 1 lineto 1 1 lineto 1 0 lineto closepath } def\n"
"/circ { newpath 0 0 1 0 360 arc closepath } def\n"
"/dot { gsave .15 mul dup scale circ fill grestore } def\n"
"/sq { gsave unit unit scale -.5 -.5 translate box .02 setlinewidth stroke grestore } def\n"
"/sq1 { gsave translate sq unit .6 mul dot grestore } def\n"
"/dot2 { gsave translate unit dot grestore } def\n"
"/usq { gsave unit unit scale -.5 -.5 rmoveto 0 1 rlineto 1 0 rlineto 0 -1 rlineto closepath .02 setlinewidth stroke grestore } def\n"
"/dot1 { gsave translate unit .3 mul dup scale circ fill grestore } def\n"
"/times { /Times-Roman findfont unit .3 mul scalefont setfont } def\n"
"/times1 { /Times-Roman findfont unit 10 mul scalefont setfont 0 0 0 setrgbcolor } def\n"
"/times2 { /Times-Roman findfont unit 2 mul scalefont setfont 0 0 0 setrgbcolor } def\n"

Definition at line 430 of file backend_eps.c.

Referenced by eps_init(), and init_ps().

◆ eps_color

color_t eps_color = -1
static

Definition at line 177 of file backend_eps.c.

Referenced by eps_pageinit_ps(), and eps_setcolor().

◆ eps_pagenumber

int eps_pagenumber
static

Definition at line 761 of file backend_eps.c.

Referenced by eps_pageinit_ps(), init_ps(), and term_ps().

◆ eps_width

double eps_width = -1
static

Definition at line 178 of file backend_eps.c.

Referenced by _cairo_ps_surface_emit_eps(), eps_linewidth(), and eps_pageinit_ps().

◆ optimacros

const char* optimacros
static
Initial value:
=
"/D{bind def}def\n"
"/R{roll}D\n"
"/K{copy}D\n"
"/P{pop}D\n"
"/p{3 2 R add 3 1 R add exch}D\n"
"/t{dup 4 3 R mul 3 1 R mul}D\n"
"/a{dup 1 sub neg 4 1 R t 5 2 R t p}D\n"
"/m{2 K le{exch}if P}D\n"
"/n{abs exch abs m}D\n"
"/d{-1 t p n}D\n"
"/s{[4 2 R] cvx def}D\n"
"/g{7 K P 4 K P P d 5 1 R d 10 m m div 5 K 12 8 R 5 4 R a 9 4 R 3 2 R a 6 4 R curveto}D\n"
"/e{4 2 R lineto lineto P P}D\n"
"/q{3 K P n 10 m div}D\n"
"/f{x y 7 4 R 5 1 R 4 K p /y s 7 2 R 2 K 9 7 R 7 6 R t p 2 K /x s}D\n"
"/C{4 1 R q f 7 6 R g}D\n"
"/V{q f e}D\n"
"/c{3 1 R .5 f 7 6 R g}D\n"
"/v{.5 f e}D\n"
"/j{5 K P p /y s 3 K t 7 5 R p /x s x moveto P}D\n"
"/i{.5 j}D\n"
"/I{dup 6 1 R q j 3 2 R}D\n"
"/z{closepath}D\n"
"/b{%s z fill}D\n"
"/w{%s z fill}D\n"

Definition at line 402 of file backend_eps.c.

Referenced by eps_init(), and init_ps().

◆ xship

int(* xship) (FILE *f, int filter, const char *s, int len) ( FILE f,
int  filter,
const char *  s,
int  len 
)
static

Definition at line 50 of file backend_eps.c.

Referenced by eps_callbacks(), ship(), and shipcom().

◆ xship_file

FILE* xship_file
static

Definition at line 51 of file backend_eps.c.

Referenced by eps_callbacks(), ship(), and shipcom().