00001 /* Copyright (C) 2001-2007 Peter Selinger. 00002 This file is part of Potrace. It is free software and it is covered 00003 by the GNU General Public License. See the file COPYING for details. */ 00004 00005 /* $Id: main.h 147 2007-04-09 00:44:09Z selinger $ */ 00006 00007 #ifndef MAIN_H 00008 #define MAIN_H 00009 00010 #ifdef HAVE_CONFIG_H 00011 #include "config.h" 00012 #endif 00013 00014 #include "potracelib.h" 00015 00016 /* structure to hold a tilted rectangle */ 00017 struct rect_s { 00018 double bb[2]; /* dimensions of bounding box */ 00019 double orig[2]; /* origin relative to bounding box */ 00020 }; 00021 typedef struct rect_s rect_t; 00022 00023 /* structure to hold a dimensioned value */ 00024 struct dim_s { 00025 double x; /* value */ 00026 double d; /* dimension (in pt), or 0 if not given */ 00027 }; 00028 typedef struct dim_s dim_t; 00029 00030 #define DIM_IN (72) 00031 #define DIM_CM (72 / 2.54) 00032 #define DIM_MM (72 / 25.4) 00033 #define DIM_PT (1) 00034 00035 /* set some regional defaults */ 00036 00037 #ifdef USE_METRIC 00038 #define DEFAULT_DIM DIM_CM 00039 #define DEFAULT_DIM_NAME "centimeters" 00040 #else 00041 #define DEFAULT_DIM DIM_IN 00042 #define DEFAULT_DIM_NAME "inches" 00043 #endif 00044 00045 #ifdef USE_A4 00046 #define DEFAULT_PAPERWIDTH 595 00047 #define DEFAULT_PAPERHEIGHT 842 00048 #define DEFAULT_PAPERFORMAT "a4" 00049 #else 00050 #define DEFAULT_PAPERWIDTH 612 00051 #define DEFAULT_PAPERHEIGHT 792 00052 #define DEFAULT_PAPERFORMAT "letter" 00053 #endif 00054 00055 struct backend_s; 00056 00057 /* structure to hold command line options */ 00058 struct info_s { 00059 struct backend_s *backend; /* type of backend (eps,ps,pgm etc) */ 00060 potrace_param_t *param; /* tracing parameters, see potracelib.h */ 00061 int debug; /* type of output (0-2) (for BACKEND_PS/EPS only) */ 00062 dim_t width_d; /* desired width of image */ 00063 dim_t height_d; /* desired height of image */ 00064 double rx; /* desired x resolution (in dpi) */ 00065 double ry; /* desired y resolution (in dpi) */ 00066 double sx; /* desired x scaling factor */ 00067 double sy; /* desired y scaling factor */ 00068 double stretch; /* ry/rx, if not otherwise determined */ 00069 dim_t lmar_d, rmar_d, tmar_d, bmar_d; /* margins */ 00070 double angle; /* rotate by this many degrees */ 00071 int paperwidth, paperheight; /* paper size for ps backend (in pt) */ 00072 double unit; /* granularity of output grid */ 00073 int compress; /* apply compression? */ 00074 int pslevel; /* postscript level to use: affects only compression */ 00075 int color; /* rgb color code 0xrrggbb: line color */ 00076 int fillcolor; /* rgb color code 0xrrggbb: fill color */ 00077 double gamma; /* gamma value for pgm backend */ 00078 int longcoding; /* do not optimize for file size? */ 00079 char *outfile; /* output filename, if given */ 00080 char **infiles; /* array of input filenames */ 00081 int infilecount; /* number of input filenames */ 00082 double blacklevel; /* 0 to 1: black/white cutoff in input file */ 00083 int invert; /* invert bitmap? */ 00084 int opaque; /* paint white shapes opaquely? */ 00085 int group; /* group paths together? */ 00086 int progress; /* should we display a progress bar? */ 00087 }; 00088 typedef struct info_s info_t; 00089 00090 extern info_t info; 00091 00092 /* structure to hold per-image information, set e.g. by calc_dimensions */ 00093 struct imginfo_s { 00094 int pixwidth; /* width of input pixmap */ 00095 int pixheight; /* height of input pixmap */ 00096 double width; /* desired width of image (in pt or pixels) */ 00097 double height; /* desired height of image (in pt or pixels) */ 00098 double lmar, rmar, tmar, bmar; /* requested margins (in pt) */ 00099 rect_t trans; /* specify relative position of a tilted rectangle */ 00100 }; 00101 typedef struct imginfo_s imginfo_t; 00102 00103 #endif /* MAIN_H */