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)  

rule.cpp
Go to the documentation of this file.
1 /*
2  * rule.cpp -- generic Rule handling
3  * by pts@fazekas.hu at Fri Mar 15 21:13:47 CET 2002
4  */
5 
6 #ifdef __GNUC__
7 #ifndef __clang__
8 #pragma implementation
9 #endif
10 #endif
11 
12 #include "rule.hpp"
13 #include "error.hpp"
14 #include <string.h> /* strlen() */
15 
16 bool Rule::Cache::isPDF() const {
17  return 80<=FileFormat && FileFormat<100;
18 }
19 bool Rule::Cache::isPDFB() const {
20  return 90<=FileFormat && FileFormat<100;
21 }
22 bool Rule::Cache::isIndexed() const {
23  return SampleFormat==Image::SF_Indexed1
24  || SampleFormat==Image::SF_Indexed2
25  || SampleFormat==Image::SF_Indexed4
26  || SampleFormat==Image::SF_Indexed8;
27 }
29  return SampleFormat==Image::SF_Mask
30  || SampleFormat==Image::SF_Transparent2
31  || SampleFormat==Image::SF_Transparent4
32  || SampleFormat==Image::SF_Transparent8;
33 }
34 bool Rule::Cache::isOneBit() const {
35  return SampleFormat==Image::SF_Mask
36  || SampleFormat==Image::SF_Indexed1
37  || SampleFormat==Image::SF_Gray1;
38 }
39 #if 0
40 bool Rule::Cache::is8() const {
41  return SampleFormat==Image::SF_Indexed1
42  || SampleFormat==Image::SF_Indexed2
43  || SampleFormat==Image::SF_Indexed4
44  || SampleFormat==Image::SF_Indexed8;
45 }
46 #endif
47 bool Rule::Cache::isGray() const {
48  return SampleFormat==Image::SF_Gray1
49  || SampleFormat==Image::SF_Gray2
50  || SampleFormat==Image::SF_Gray4
51  || SampleFormat==Image::SF_Gray8;
52 }
53 bool Rule::Cache::isRGB() const {
54  return SampleFormat==Image::SF_Rgb1
55  || SampleFormat==Image::SF_Rgb2
56  || SampleFormat==Image::SF_Rgb4
57  || SampleFormat==Image::SF_Rgb8;
58 }
59 bool Rule::Cache::isBinSB() const {
60  return TransferEncoding==TE_Binary
61  || TransferEncoding==TE_MSBfirst
62  || TransferEncoding==TE_LSBfirst;
63 }
64 bool Rule::Cache::isPS() const {
65  return FileFormat>=100;
66 }
67 bool Rule::Cache::isPSL2() const {
68  return FileFormat>=120;
69 }
70 bool Rule::Cache::isPSL3() const {
71  return FileFormat>=130;
72 }
74  return Predictor!=PR_None;
75 }
76 bool Rule::Cache::isDCTE() const {
77  /* Dat: _not_ CO_JAI */
78  return Compression==CO_DCT || Compression==CO_IJG;
79 }
80 bool Rule::Cache::isZIPOK() const {
81  return Compression!=CO_ZIP ||
82  ( FileFormat!=FF_PSL1 && FileFormat!=FF_PSLC && FileFormat!=FF_PSL2
83  && FileFormat!=FF_PDF10 && FileFormat!=FF_PDFB10
84  );
85 }
86 
90 static class ValueDeleter {
91  public:
98  }
100 
101 static const slen_t SampleFormat_MAXLEN=32;
102 static void init_dicts() {
103  register MiniPS::Dict*y;
104 
105  /** TODO: Make this thread-safe. */
106  if (y_FileFormat!=NULLP) return;
107 
109  y->put("/PSL1", MiniPS::Qinteger(Rule::Cache::FF_PSL1));
110  y->put("/PSLC", MiniPS::Qinteger(Rule::Cache::FF_PSLC));
111  y->put("/PSL2", MiniPS::Qinteger(Rule::Cache::FF_PSL2));
112  y->put("/PSL3", MiniPS::Qinteger(Rule::Cache::FF_PSL3));
113  y->put("/PDFB1.0",MiniPS::Qinteger(Rule::Cache::FF_PDFB10));
114  y->put("/PDFB1.2",MiniPS::Qinteger(Rule::Cache::FF_PDFB12));
115  y->put("/PDF1.0", MiniPS::Qinteger(Rule::Cache::FF_PDF10));
116  y->put("/PDF1.2", MiniPS::Qinteger(Rule::Cache::FF_PDF12));
117  y->put("/GIF89a", MiniPS::Qinteger(Rule::Cache::FF_GIF89a));
119  y->put("/Empty", MiniPS::Qinteger(Rule::Cache::FF_Empty));
120  y->put("/Meta", MiniPS::Qinteger(Rule::Cache::FF_Meta));
121  y->put("/PNM", MiniPS::Qinteger(Rule::Cache::FF_PNM));
122  y->put("/PAM", MiniPS::Qinteger(Rule::Cache::FF_PAM));
123  y->put("/PIP", MiniPS::Qinteger(Rule::Cache::FF_PIP));
124  y->put("/JPEG", MiniPS::Qinteger(Rule::Cache::FF_JPEG));
125  y->put("/JPG", MiniPS::Qinteger(Rule::Cache::FF_JPEG));
126  y->put("/TIFF", MiniPS::Qinteger(Rule::Cache::FF_TIFF));
127  y->put("/TIF", MiniPS::Qinteger(Rule::Cache::FF_TIFF));
128  y->put("/PNG", MiniPS::Qinteger(Rule::Cache::FF_PNG));
129  y->put("/XPM", MiniPS::Qinteger(Rule::Cache::FF_XPM));
130  y->put("/BMP", MiniPS::Qinteger(Rule::Cache::FF_BMP));
131  y->put("/XWD", MiniPS::Qinteger(Rule::Cache::FF_XWD));
132  y->put("/X11", MiniPS::Qinteger(Rule::Cache::FF_X11));
133 
134  /* vvv strlen must be shorter then SampleFormat_MAXLEN */
136  y->put("/Opaque", MiniPS::Qinteger(Image::SF_Opaque));
137  y->put("/Transparent", MiniPS::Qinteger(Image::SF_Transparent));
138  y->put("/Transparent2", MiniPS::Qinteger(Image::SF_Transparent2));
139  y->put("/Transparent4", MiniPS::Qinteger(Image::SF_Transparent4));
140  y->put("/Transparent8", MiniPS::Qinteger(Image::SF_Transparent8));
141  y->put("/Gray1", MiniPS::Qinteger(Image::SF_Gray1));
142  y->put("/Gray2", MiniPS::Qinteger(Image::SF_Gray2));
143  y->put("/Gray4", MiniPS::Qinteger(Image::SF_Gray4));
144  y->put("/Gray8", MiniPS::Qinteger(Image::SF_Gray8));
145  y->put("/Indexed1", MiniPS::Qinteger(Image::SF_Indexed1));
146  y->put("/Indexed2", MiniPS::Qinteger(Image::SF_Indexed2));
147  y->put("/Indexed4", MiniPS::Qinteger(Image::SF_Indexed4));
148  y->put("/Indexed8", MiniPS::Qinteger(Image::SF_Indexed8));
149  y->put("/Mask", MiniPS::Qinteger(Image::SF_Mask));
150  y->put("/Rgb1", MiniPS::Qinteger(Image::SF_Rgb1)); /* recommended */
151  y->put("/Rgb2", MiniPS::Qinteger(Image::SF_Rgb2));
152  y->put("/Rgb4", MiniPS::Qinteger(Image::SF_Rgb4));
153  y->put("/Rgb8", MiniPS::Qinteger(Image::SF_Rgb8));
154  y->put("/RGB1", MiniPS::Qinteger(Image::SF_Rgb1)); /* obsolete */
155  y->put("/RGB2", MiniPS::Qinteger(Image::SF_Rgb2));
156  y->put("/RGB4", MiniPS::Qinteger(Image::SF_Rgb4));
157  y->put("/RGB8", MiniPS::Qinteger(Image::SF_Rgb8));
158  y->put("/Asis", MiniPS::Qinteger(Image::SF_Asis));
159  y->put("/Bbox", MiniPS::Qinteger(Image::SF_Bbox));
160 
162  y->put("/Binary", MiniPS::Qinteger(Rule::Cache::TE_Binary));
163  y->put("/ASCII", MiniPS::Qinteger(Rule::Cache::TE_ASCII));
164  y->put("/Hex", MiniPS::Qinteger(Rule::Cache::TE_Hex)); /* recommended */
165  y->put("/AHx", MiniPS::Qinteger(Rule::Cache::TE_Hex));
166  y->put("/ASCIIHex", MiniPS::Qinteger(Rule::Cache::TE_Hex));
167  y->put("/A85", MiniPS::Qinteger(Rule::Cache::TE_A85)); /* recommended */
168  y->put("/ASCII85", MiniPS::Qinteger(Rule::Cache::TE_A85));
169  y->put("/MSBfirst", MiniPS::Qinteger(Rule::Cache::TE_MSBfirst));
170  y->put("/LSBfirst", MiniPS::Qinteger(Rule::Cache::TE_LSBfirst));
171 
173  y->put("/ ", MiniPS::Qinteger(Rule::Cache::CO_None)); /* default */
174  y->put("/None", MiniPS::Qinteger(Rule::Cache::CO_None)); /* recommended */
175  y->put("/LZW", MiniPS::Qinteger(Rule::Cache::CO_LZW)); /* recommended */
176  y->put("/ZIP", MiniPS::Qinteger(Rule::Cache::CO_ZIP)); /* recommended */
177  y->put("/Flate", MiniPS::Qinteger(Rule::Cache::CO_ZIP));
178  y->put("/Fl", MiniPS::Qinteger(Rule::Cache::CO_ZIP));
179  y->put("/RLE", MiniPS::Qinteger(Rule::Cache::CO_RLE)); /* recommended */
180  y->put("/RunLength", MiniPS::Qinteger(Rule::Cache::CO_RLE));
181  y->put("/RunLengthEncoded", MiniPS::Qinteger(Rule::Cache::CO_RLE));
182  y->put("/RL", MiniPS::Qinteger(Rule::Cache::CO_RLE));
183  y->put("/PackBits", MiniPS::Qinteger(Rule::Cache::CO_RLE));
184  y->put("/Fax", MiniPS::Qinteger(Rule::Cache::CO_Fax)); /* recommended */
185  y->put("/CCITTFax", MiniPS::Qinteger(Rule::Cache::CO_Fax));
186  y->put("/CCF", MiniPS::Qinteger(Rule::Cache::CO_Fax));
187  y->put("/DCT", MiniPS::Qinteger(Rule::Cache::CO_DCT)); /* recommended */
188  y->put("/JPEG",MiniPS::Qinteger(Rule::Cache::CO_IJG)); /* changed at Sun Jun 23 17:06:34 CEST 2002 */
189  y->put("/JPG", MiniPS::Qinteger(Rule::Cache::CO_IJG)); /* changed at Sun Jun 23 17:06:34 CEST 2002 */
190  y->put("/JFIF",MiniPS::Qinteger(Rule::Cache::CO_IJG)); /* changed at Sun Jun 23 17:06:34 CEST 2002 */
191  y->put("/IJG", MiniPS::Qinteger(Rule::Cache::CO_IJG)); /* recommended */
192  y->put("/JAI", MiniPS::Qinteger(Rule::Cache::CO_JAI)); /* recommended */
193 
194  y=y_Scale=new MiniPS::Dict();
195  y->put("/ ", MiniPS::Qinteger(Rule::CacheHints::SC_None)); /* default */
199 }
200 
202  /* Tue Jul 2 13:48:12 CEST 2002 */
203  #if 0 /* BUGFIX for g++-3.4 (needs symbols __cxa_guard_acquire, __cxa_guard_release) */
204  static char rule_dummy=(init_dicts(),0); /* call once per process */
205  (void)rule_dummy;
206  #else
207  if (y_FileFormat==NULLP) init_dicts();
208  #endif
209  while (slen!=0 && s[0]=='/') { s++; slen--; }
210  if (slen<=0 || slen>=SampleFormat_MAXLEN) return Image::SF_max;
211  char buf[SampleFormat_MAXLEN];
213  if (buf[0]>='a' && buf[0]<='z') buf[0]+='A'-'a'; /* capitalize 1st letter */
216 }
217 
218 char const* Rule::Cache::dumpFileFormat(ff_t FileFormat, co_t Compression) {
219  switch (FileFormat) {
220  case FF_eps: return Compression==CO_ZIP ? "PSL3" : "PSL2";
221  case FF_pdf: return Compression==CO_ZIP ? "PDF1.2" : "PDF1.0";
222  case FF_pdfb: return Compression==CO_ZIP ? "PDFB1.2" : "PDFB1.0";
223  case FF_PSL1: return "PSL1";
224  case FF_PSLC: return "PSLC";
225  case FF_PSL2: return "PSL2";
226  case FF_PSL3: return "PSL3";
227  case FF_PDFB10:return "PDFB1.0";
228  case FF_PDFB12:return "PDFB1.2";
229  case FF_PDF10: return "PDF1.0";
230  case FF_PDF12: return "PDF1.2";
231  case FF_GIF89a:return "GIF89a";
232  case FF_PNM: return "PNM";
233  case FF_PAM: return "PAM";
234  case FF_PIP: return "PIP";
235  case FF_Empty: return "Empty";
236  case FF_Meta: return "Meta";
237  case FF_JPEG: return "JPEG";
238  case FF_TIFF: return "TIFF";
239  case FF_PNG: return "PNG";
240  case FF_XPM: return "XPM";
241  case FF_BMP: return "BMP";
242  case FF_XWD: return "XWD";
243  case FF_X11: return "X11";
244  }
245  return (char const*)NULLP;
246 }
247 char const* Rule::Cache::dumpTransferEncoding(te_t TransferEncoding) {
248  switch (TransferEncoding) {
249  case TE_Binary: return "Binary";
250  case TE_ASCII: return "ASCII";
251  case TE_Hex: return "Hex";
252  case TE_A85: return "A85";
253  case TE_MSBfirst:return "MSBfirst";
254  case TE_LSBfirst:return "LSBfirst";
255  }
256  return (char const*)NULLP;
257 }
258 char const* Rule::Cache::dumpSampleFormat(Image::sf_t SampleFormat) {
259  switch (SampleFormat) {
260  case Image::SF_Opaque: return "Opaque";
261  case Image::SF_Transparent: return "Transparent";
262  case Image::SF_Gray1: return "Gray1";
263  case Image::SF_Indexed1: return "Indexed1";
264  case Image::SF_Mask: return "Mask";
265  case Image::SF_Transparent2: return "Transparent2";
266  case Image::SF_Gray2: return "Gray2";
267  case Image::SF_Indexed2: return "Indexed2";
268  case Image::SF_Transparent4: return "Transparent4";
269  case Image::SF_Rgb1: return "Rgb1";
270  case Image::SF_Gray4: return "Gray4";
271  case Image::SF_Indexed4: return "Indexed4";
272  case Image::SF_Transparent8: return "Transparent8";
273  case Image::SF_Rgb2: return "Rgb2";
274  case Image::SF_Gray8: return "Gray8";
275  case Image::SF_Indexed8: return "Indexed8";
276  case Image::SF_Rgb4: return "Rgb4";
277  case Image::SF_Rgb8: return "Rgb8";
278  case Image::SF_Asis: return "Asis";
279  case Image::SF_Bbox: return "Bbox";
280  }
281  return (char const*)NULLP;
282 }
283 char const* Rule::Cache::dumpCompression(co_t Compression) {
284  switch (Compression) {
285  case CO_None:return "None";
286  case CO_LZW: return "LZW";
287  case CO_ZIP: return "ZIP";
288  case CO_RLE: return "RLE";
289  case CO_Fax: return "Fax";
290  case CO_DCT: return "DCT";
291  case CO_IJG: return "IJG";
292  case CO_JAI: return "JAI";
293  }
294  return (char const*)NULLP;
295 }
296 
298  switch (Scale) {
299  case SC_None: return "None";
300  case SC_OK: return "OK";
301  case SC_RotateOK:return "RotateOK";
302  }
303  return (char const*)NULLP;
304 }
305 
306 /* Checks and recovers Predictor. Called by scanf_dict.
307  * @return Qundef if param invalid
308  * Qinteger(1) if param==Qundef
309  * valid Qinteger otherwise
310  */
312  return v==MiniPS::Qundef ? MiniPS::Qinteger(1) /* PR_None */
313  : v==MiniPS::Qinteger(1) || v==MiniPS::Qinteger(2) ||
314  v==MiniPS::Qinteger(45) || v==MiniPS::Qinteger(55) ||
315  ((v&1)!=0 && v>=MiniPS::Qinteger(10) && v<=MiniPS::Qinteger(15)) ? v
316  : MiniPS::Qundef;
317 }
319  return v==MiniPS::Qundef ? MiniPS::Qinteger(0)
320  : ((v&1)!=0 && v>=MiniPS::Qinteger(1) && v<=MiniPS::Qinteger(4)) ? v
321  : MiniPS::Qundef;
322 }
324  return v==MiniPS::Qundef ? MiniPS::Qinteger(0)
325  : v==MiniPS::Qinteger(1) || v==MiniPS::Qinteger(2) ||
326  v==MiniPS::Qinteger(4) || v==MiniPS::Qinteger(8) ? v
327  : MiniPS::Qundef;
328 }
330  return v==MiniPS::Qundef ? MiniPS::Qinteger(-1)
331  : ((v&1)!=0 && v>=MiniPS::Qinteger(-1) && v<=MiniPS::Qinteger(9)) ? v
332  : MiniPS::Qundef;
333 }
335  return v==MiniPS::Qundef ? MiniPS::Qinteger(0)
336  : ((v&1)!=0 && v>=MiniPS::Qinteger(-2)) ? v /* -2 means: positive value marking the image height */
337  : MiniPS::Qundef;
338 }
340  return v==MiniPS::Qundef ? MiniPS::Qinteger(75)
341  : ((v&1)!=0 && v>=MiniPS::Qinteger(0) && v<=MiniPS::Qinteger(100)) ? v
342  : MiniPS::Qundef;
343 }
345  return v==MiniPS::Qundef ? MiniPS::Qinteger(3)
346  : ((v&1)!=0 && v>=MiniPS::Qinteger(0) && v<=MiniPS::Qinteger(3)) ? v
347  : MiniPS::Qundef;
348 }
349 
351  #if 0 /* BUGFIX for g++-3.4 (needs symbols __cxa_guard_acquire, __cxa_guard_release) */
352  static char rule_dummy=(init_dicts(),0); /* call once per process */
353  (void)rule_dummy;
354  #else
355  if (y_FileFormat==NULLP) init_dicts();
356  #endif
358  MiniPS::VALUE FileFormat, SampleFormat, WarningOK, TransferEncoding,
359  Compression, Predictor, Transparent;
360  MiniPS::VALUE PredictorColumns, PredictorColors, PredictorBPC, Effort, K,
361  RecordSize, Quality, ColorTransform, TransferCPL,
362  EncoderRows, EncoderColumns, EncoderBPL, EncoderColors, DCT, Scale;
363 
364  MiniPS::scanf_dict(dict_, /*show_warnings:*/true,
365  "FileFormat", MiniPS::S_SENUM, y_FileFormat, &FileFormat,
366  "SampleFormat", MiniPS::S_SENUM, y_SampleFormat, &SampleFormat,
367  "WarningOK", MiniPS::T_BOOLEAN, MiniPS::Qtrue, &WarningOK,
368  "TransferEncoding",MiniPS::S_SENUM, y_TransferEncoding, &TransferEncoding,
369  "Compression", MiniPS::S_SENUM, y_Compression, &Compression,
370  "Predictor", MiniPS::S_FUNC, better_predictor, &Predictor,
371  "Transparent", MiniPS::S_RGBSTR, MiniPS::Qnull, &Transparent, /* force an RGB color transparent */
372  "Hints", MiniPS::T_DICT, MiniPS::Qnull, &dictHints,
373  NULLP
374  );
375  dict=(MiniPS::Dict*)dict_;
376  cache.FileFormat=(Rule::Cache::ff_t)MiniPS::int2ii(FileFormat);
377  cache.SampleFormat=(Image::sf_t)MiniPS::int2ii(SampleFormat);
378  cache.WarningOK=(Rule::Cache::ff_t)WarningOK==MiniPS::Qtrue;
379  cache.TransferEncoding=(Rule::Cache::te_t)MiniPS::int2ii(TransferEncoding);
380  cache.Compression=(Rule::Cache::co_t)MiniPS::int2ii(Compression);
381  cache.Predictor=(Rule::Cache::pr_t)MiniPS::int2ii(Predictor);
382  cache.Transparent=0x1000000UL; /* No extra transparency */
383  if (Transparent!=MiniPS::Qnull) {
384  unsigned char const*p=(unsigned char const*)(MiniPS::RSTRING(Transparent)->begin_());
385  cache.Transparent=(p[0]<<16)+(p[1]<<8)+p[2];
386  }
387  //MiniPS::dump(Predictor);
388  // fprintf(stderr,"cpred=%u\n", cache.Predictor);
389 
390  if ((MiniPS::VALUE)dictHints==MiniPS::Qnull) dict->put("/Hints", (MiniPS::VALUE)(dictHints=new MiniPS::Dict()));
391  MiniPS::scanf_dict((MiniPS::VALUE)dictHints, /*show_warnings:*/true,
392  "EncoderBPL", MiniPS::S_PINTEGER,MiniPS::Qinteger(0), &EncoderBPL,
393  "EncoderColumns", MiniPS::S_PINTEGER,MiniPS::Qinteger(0), &EncoderColumns,
394  "EncoderRows", MiniPS::S_PINTEGER,MiniPS::Qinteger(0), &EncoderRows,
395  "EncoderColors", MiniPS::S_FUNC, better_xColors, &EncoderColors,
396  "PredictorColumns",MiniPS::S_PINTEGER,MiniPS::Qinteger(0), &PredictorColumns,
397  "PredictorColors", MiniPS::S_FUNC, better_xColors, &PredictorColors,
398  "PredictorBPC", MiniPS::S_FUNC, better_predictorBPC, &PredictorBPC,
399  "Effort", MiniPS::S_FUNC, better_effort, &Effort,
400  "RecordSize", MiniPS::S_UINTEGER,MiniPS::Qinteger(0), &RecordSize,
401  "K", MiniPS::S_FUNC, better_k, &K,
402  "Quality", MiniPS::S_FUNC, better_quality, &Quality,
403  "ColorTransform", MiniPS::S_FUNC, better_colorTransform, &ColorTransform,
404  "TransferCPL", MiniPS::S_PINTEGER,MiniPS::Qinteger(78), &TransferCPL,
405  "DCT", MiniPS::T_DICT, MiniPS::Qnull, &DCT,
406  "Scale", MiniPS::S_SENUM, y_Scale, &Scale,
407  "ImageDPI", MiniPS::S_NUMBER, MiniPS::Qinteger(72), &cacheHints.ImageDPI,
408  "TopMargin", MiniPS::S_NUMBER, MiniPS::Qinteger(0), &cacheHints.TopMargin,
409  "BottomMargin", MiniPS::S_NUMBER, MiniPS::Qinteger(0), &cacheHints.BottomMargin,
410  "LeftMargin", MiniPS::S_NUMBER, MiniPS::Qinteger(0), &cacheHints.LeftMargin,
411  "RightMargin", MiniPS::S_NUMBER, MiniPS::Qinteger(0), &cacheHints.RightMargin,
412  "LowerMargin", MiniPS::S_NUMBER, MiniPS::Qinteger(0), &cacheHints.LowerMargin,
413 
414  "Comment", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Comment,
415  "Title", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Title,
416  "Subject", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Subject,
417  "Author", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Author,
418  "Creator", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Creator,
419  "Producer", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Producer,
420  "Created", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Created,
421  "Produced", MiniPS::T_STRING, MiniPS::Qnull, &cacheHints.Produced,
422 #if 0
423  /* vvv parameters for /DCTEncode. Currently ignored. Obsoleted by /DCT */
424  "Colors", MiniPS::S_ANY, MiniPS::Qnull, &dummy,
425  "HSamples", MiniPS::S_ANY, MiniPS::Qnull, &dummy,
426  "VSamples", MiniPS::S_ANY, MiniPS::Qnull, &dummy,
427  "QuantTables", MiniPS::S_ANY, MiniPS::Qnull, &dummy,
428  "QFactor", MiniPS::S_ANY, MiniPS::Qnull, &dummy,
429  "HuffTables", MiniPS::S_ANY, MiniPS::Qnull, &dummy,
430 #endif
431  NULLP
432  );
433  if (DCT==MiniPS::Qnull) dict->put("/DCT", DCT=(MiniPS::VALUE)new MiniPS::Dict());
434  // cacheHints.DCT=(DCT==MiniPS::Qnull)? new MiniPS::Dict() : MiniPS::RDICT(DCT);
435  if (cache.isPS()) {
436  MiniPS::setDumpPS(cacheHints.TopMargin, true);
437  MiniPS::setDumpPS(cacheHints.BottomMargin, true);
438  MiniPS::setDumpPS(cacheHints.LeftMargin, true);
439  MiniPS::setDumpPS(cacheHints.RightMargin, true);
440  MiniPS::setDumpPS(cacheHints.LowerMargin, true);
441  }
442  cacheHints.DCT=MiniPS::RDICT(DCT);
443  cacheHints.EncoderColumns=MiniPS::int2ii(EncoderColumns);
444  cacheHints.EncoderBPL=MiniPS::int2ii(EncoderBPL);
445  cacheHints.EncoderColors=MiniPS::int2ii(EncoderColors);
446  cacheHints.EncoderRows=MiniPS::int2ii(EncoderRows);
447  cacheHints.PredictorColumns=MiniPS::int2ii(PredictorColumns);
448  cacheHints.PredictorColors=MiniPS::int2ii(PredictorColors);
449  cacheHints.PredictorBPC=MiniPS::int2ii(PredictorBPC);
450  cacheHints.Effort=MiniPS::int2ii(Effort);
451  cacheHints.RecordSize=MiniPS::int2ii(RecordSize);
452  cacheHints.K=MiniPS::int2ii(K);
453  cacheHints.Quality=MiniPS::int2ii(Quality);
454  cacheHints.ColorTransform=MiniPS::int2ii(ColorTransform);
455  cacheHints.TransferCPL=MiniPS::int2ii(TransferCPL);
456  cacheHints.Scale=(Rule::CacheHints::sc_t)MiniPS::int2ii(Scale);
457  /* fprintf(stderr, "scaled=%g\n", (char*)MiniPS::scale(ImageDPI,1)); */
458 }
459 
461  /* Dat: called from appliers.cpp:out_*_work(); the sample format is final */
462  bool separatep2=
463  separatep &&
464  ( cache.SampleFormat==Image::SF_Transparent2
465  || cache.SampleFormat==Image::SF_Transparent4
466  || cache.SampleFormat==Image::SF_Transparent8);
467  /* vvv simplifier added at Sat Jun 15 13:59:40 CEST 2002 */
468  if (separatep2) cache.SampleFormat=Image::SF_Transparent8;
469  if (!info->setSampleFormat(cache.SampleFormat, cache.WarningOK, /*TryOnly*/false, cache.Transparent))
470  Error::sev(Error::EERROR) << "doSampleFormat: cannot set desired SampleFormat" << (Error*)0;
471  Image::Sampled *img=info->getImg();
472  slen_t n=1;
473  if (separatep2) {
474  info->separate();
475  img=info->getImgs()[0];/*NULLP OK*/;
476  n=info->getNncols();
477  }
478  if (img!=NULLP) {
479  if (0==cacheHints.EncoderBPL) cacheHints.EncoderBPL=(slen_t)img->getWd()*img->getCpp()*img->getBpc();
480  if (0==cacheHints.EncoderColumns) cacheHints.EncoderColumns=img->getWd();
481  if (0==cacheHints.EncoderColors) cacheHints.EncoderColors=img->getCpp();
482  if (0==cacheHints.EncoderRows) cacheHints.EncoderRows=img->getHt()*n;
483  if (0==cacheHints.PredictorColumns) cacheHints.PredictorColumns=img->getWd();
484  if (0==cacheHints.PredictorColors) cacheHints.PredictorColors=img->getCpp();
485  if (0==cacheHints.PredictorBPC) cacheHints.PredictorBPC=img->getBpc();
486  if (-2==cacheHints.K) cacheHints.K=img->getHt()*n;
487  }
488 }
489 
490 static char const*getDecode(Rule::Cache::co_t Compression) {
491  return (Compression==Rule::Cache::CO_LZW ? "/LZWDecode"
492  :Compression==Rule::Cache::CO_Fax ? "/CCITTFaxDecode"
493  :Compression==Rule::Cache::CO_ZIP ? "/FlateDecode"
494  :Compression==Rule::Cache::CO_RLE ? "/RunLengthDecode"
495  :Compression==Rule::Cache::CO_DCT ? "/DCTDecode"
496  :Compression==Rule::Cache::CO_IJG ? "/DCTDecode"
497  :Compression==Rule::Cache::CO_JAI ? "/DCTDecode"
498  :"");
499 }
500 
501 /** For PDF BI inline images */
502 static char const*getBIDecode(Rule::Cache::co_t Compression) {
503  return (Compression==Rule::Cache::CO_LZW ? "/LZW"
504  :Compression==Rule::Cache::CO_Fax ? "/CCF"
505  :Compression==Rule::Cache::CO_ZIP ? "/Fl"
506  :Compression==Rule::Cache::CO_RLE ? "/RL"
507  :Compression==Rule::Cache::CO_DCT ? "/DCT"
508  :Compression==Rule::Cache::CO_IJG ? "/DCT"
509  :Compression==Rule::Cache::CO_JAI ? "/DCT"
510  :"");
511 }
512 
514  assert(cacheHints.PredictorBPC!=0 && "doSampleFormat already called");
515  bool hps=hasPredictorSpec();
516  if (cache.isPDF()) {
517  /* Dat: also implies appendTransferSpec() -- this is true only for PDF */
518  if (!cache.isPDFB()) {
519  if (cache.Compression==cache.CO_None) {
520  if (cache.TransferEncoding==cache.TE_Hex) out << "/Filter/ASCIIHexDecode";
521  else if (cache.TransferEncoding==cache.TE_A85) out << "/Filter/ASCII85Decode";
522  } else if (cache.TransferEncoding!=cache.TE_Hex && cache.TransferEncoding!=cache.TE_A85) {
523  out << "/Filter" << getDecode(cache.Compression);
524  if (hps) { out << "/DecodeParms"; appendPredictorSpec(out); }
525  } else { /* both TransferEncoding and Compression */
526  if (cache.TransferEncoding==cache.TE_Hex) out << "/Filter[/ASCIIHexDecode";
527  else if (cache.TransferEncoding==cache.TE_A85) out << "/Filter[/ASCII85Decode";
528  else assert(0);
529  out << getDecode(cache.Compression);
530  if (hps) { out << "]/DecodeParms[null"; appendPredictorSpec(out); }
531  /* ^^^ BUGFIX at Tue Jun 4 18:50:13 CEST 2002 */
532  out << ']';
533  }
534  } else {
535  if (cache.Compression==cache.CO_None) {
536  if (cache.TransferEncoding==cache.TE_Hex) out << "/F/AHx";
537  else if (cache.TransferEncoding==cache.TE_A85) out << "/F/A85";
538  } else if (cache.TransferEncoding!=cache.TE_Hex && cache.TransferEncoding!=cache.TE_A85) {
539  out << "/F" << getBIDecode(cache.Compression);
540  if (hps) { out << "/DP"; appendPredictorSpec(out); }
541  } else { /* both TransferEncoding and Compression */
542  if (cache.TransferEncoding==cache.TE_Hex) out << "/F[/AHx";
543  else if (cache.TransferEncoding==cache.TE_A85) out << "/F[/A85";
544  else assert(0);
545  out << getBIDecode(cache.Compression);
546  if (hps) { out << "]/DP[null"; appendPredictorSpec(out); }
547  out << ']';
548  }
549  } /* IFELSE PDFB */
550  } else { /* NOT PDF */
551  if (cache.Compression!=cache.CO_None) {
552  appendPredictorSpec(out);
553  out << getDecode(cache.Compression) << " filter";
554  }
555  } /* IFELSE PDF */
556 }
557 
559  return cache.Compression==cache.CO_Fax
560  || ((cache.Compression==cache.CO_ZIP || cache.Compression==cache.CO_LZW) &&
561  cache.Predictor!=cache.PR_None);
562 }
563 
565  assert(cacheHints.PredictorBPC!=0 && "doSampleFormat already called");
566  if (cache.Compression==cache.CO_Fax)
567  out << "<</K " << cacheHints.K
568  << "/Columns " << cacheHints.EncoderBPL
569  /* ^^^ EncoderColumns -> EncoderBPL BUGFIX at Wed Jul 3 20:05:12 CEST 2002 */
570  << ">>";
571  else if ((cache.Compression==cache.CO_ZIP || cache.Compression==cache.CO_LZW) &&
572  cache.Predictor!=cache.PR_None)
573  out<< "<</BitsPerComponent " << (unsigned)cacheHints.PredictorBPC
574  << "/Columns " << cacheHints.PredictorColumns
575  << "/Colors " << (unsigned)cacheHints.PredictorColors
576  << (cache.Predictor==cache.PR_TIFF2 ? "/Predictor 2>>": "/Predictor 10>>");
577 }
579  if (cache.TransferEncoding==cache.TE_Hex) out << "/ASCIIHexDecode filter";
580  else if (cache.TransferEncoding==cache.TE_A85) out << "/ASCII85Decode filter";
581 }
582 
583 /* --- */
584 
586 
588  param_assert(anew!=NULLP);
589  anew->next=first_rule;
590  first_rule=anew;
591 }
592 
594  unsigned num=0;
596  while (p!=(Applier*)NULLP) {
597  if (p->check_rule!=0/*NULLP*/ && p->work!=0/*NULLP*/) { num++; out << ' ' << p->format; }
598  p=p->next;
599  }
600  return num;
601 }
602 
605  MiniPS::Array *pary=MiniPS::RARRAY(Profile);
606  OutputRule *ret=new OutputRule[pary->getLength()+1], *or_=ret;
607  /* ^^^ just enough place; there may be BAD items which won't be stored */
609  unsigned c;
610  #if !USE_BUILTIN_LZW
611  bool lzw_warning=true;
612  #endif
615  Error::WARNING_DEFER, (GenBuffer::Writable*)NULLP); /* Dat: WARNING_DEFER untested */
616  for (c=0, pary->getFirst(val); val!=NULLP; pary->getNext(val), c++) {
617  /* val: each OutputRule of the Profile */
618  or_->fromDict(*val);
619  or_->c=c;
621  // printf("building: %s...\n", p->format);
622  #if !USE_BUILTIN_LZW
623  if (or_->cache.Compression==or_->cache.CO_LZW && lzw_warning) {
624  lzw_warning=false;
625  Error::sev(Error::WARNING) << "buildProfile: please `configure --enable-lzw' for /Compression/LZW support in OutputRule #" << c << (Error*)0;
626  }
627  #endif
628  while (p!=NULLP) {
629  if (p->check_rule!=0/*NULLP*/) switch (p->check_rule(or_)) {
630  case Applier::BAD:
631  Error::sev(Error::WARNING_DEFER) << "buildProfile: ^^^ thus ignoring impossible OutputRule #" << c << (Error*)0;
632  goto end_appliers;
633  case Applier::MAYBE: case Applier::OK:
634  if (p->work!=0/*NULLP*/) { or_++; goto end_appliers; }
635  Error::sev(Error::WARNING_DEFER) << "buildProfile: ^^^ ignoring unimplemented OutputRule #" << c << (Error*)0;
636  // case p->DONT_KNOW: ;
637  }
638  p=p->next; /* continue with other Appliers; hope other than DONT_KNOW */
639  }
640  Error::sev(Error::WARNING_DEFER) << "buildProfile: ignoring, no handlers for OutputRule #" << c << (Error*)0;
641  end_appliers:
642  if (quiet) delete Error::getRecorded();
643  }
644  if (quiet) { delete Error::getRecorded(); Error::popPolicy(); }
645  if (or_==ret) Error::sev(Error::WARNING) << "buildProfile: all OutputRules in the .job file are useless" << (Error*)0;
646  or_->dict=or_->dictHints=(MiniPS::Dict*)NULLP; /* end-of-list */
647  return ret;
648 }
649 
651  OutputRule *or_;
652  // unsigned tryc=0; /* Wed Jul 3 19:30:33 CEST 2002 */
656  Image::Sampled::rgb_t Transparent=0x1000000UL;
657  if (rule_list->dict!=NULLP) {
658  Transparent=rule_list->cache.Transparent;
659  for (or_=rule_list+1; or_->dict!=NULLP; or_++) {
660  if (Transparent!=rule_list->cache.Transparent) {
661  /* Imp: make different copies, based on different or_->cache.Transparent -- or not? */
662  Error::sev(Error::EERROR) << "applyProfile: ambiguous /Transparent" << (Error*)0;
663  }
664  }
665  }
666  /* Dat: -transparent ... makes the specified color transparent, but it cannot
667  * be used to remove transparenct
668  */
669  // printf("Transparent=0x%lx\n",Transparent);
670  for (or_=rule_list; or_->dict!=NULLP; or_++) {
671  /* ^^^ Try each OutputRule (or_) in reverse order of registration */
672  Error::sev(Error::NOTICE_DEFER) << "applyProfile: trying OutputRule #" << or_->c << (Error*)0;
673  if (sf->setSampleFormat(or_->cache.SampleFormat, or_->cache.WarningOK, /*TryOnly*/true, or_->cache.Transparent)) {
674  /* image supports the SampleFormat of OutputRule */
676  while (p!=NULLP) {
677  /* ^^^ Try each output Applier for the current candidate OutputRule */
678  if (p->check_rule!=0/*NULLP*/ && p->work!=0/*NULLP*/) {
679  // tryc++;
680  switch (p->work(out, or_, sf)) {
681  case Applier::BAD:
682  Error::sev(Error::WARNING) << "applyProfile: ^^^ thus cannot apply OutputRule #" << or_->c << (Error*)0;
683  goto end_appliers;
684  case Applier::OK:
685  // if (or_->c!=0) {
687  Error::sev(Error::NOTICE) << "applyProfile: applied OutputRule #" << or_->c << " using applier " << p->format << (Error*)0;
688  return;
689  /* case Applier::MAYBE: impossible */
690  // case p->DONT_KNOW: ;
691  }
692  }
693  p=p->next; /* continue with other Appliers; hope other than DONT_KNOW */
694  end_appliers: ;
695  }
696  } /* IF image supports SampleFormat */
697  }
698  Error::sev(Error::EERROR) << "applyProfile: invalid combination, no applicable OutputRule" << (Error*)0;
699 }
700 
702  /* MiniPS::* objects still remain -- the caller (reader) will delete them. */
703  delete [] rule_list;
704 }
705 
706 /* --- */
707 
708 //#include <string.h>
709 //static char xx[5000];
710 
712  Image::Indexed **imgs=sf->getImgs();
713  slen_t rlenht;
714  if (imgs!=NULLP) {
715  unsigned i;
716  if (sf->getNncols()!=0 && 0!=(rlenht=imgs[0]->getRlen()*imgs[0]->getHt())) {
717  // fprintf(stderr,"rh=%u nc=%u\n", rlenht, sf->getNncols());
718  for (i=0;i<sf->getNncols();i++) outstream.vi_write(imgs[i]->getRowbeg(), rlenht);
719  //for (i=0;i<sf->getNncols();i++) {
720  // memset(xx, 1<<(i), sizeof(xx));
721  // outstream.vi_write(xx, rlenht);
722  //}
723  }
724  } else {
725  Image::Sampled *img=sf->getImg();
726  rlenht=img->getRlen()*img->getHt();
727  if (rlenht!=0) outstream.vi_write(img->getRowbeg(), rlenht);
728  }
729  outstream.vi_write(0,0); /* Dat: frees cp, bp, (ap) */
730 }
732  Image::Sampled *img=sf->getImg();
733  slen_t wlen=img->getRowbeg()-img->getHeadp();
734  if (wlen!=0) outpal.vi_write(img->getHeadp(), wlen);
735  writeData(outpal, outstream, sf);
736  /* vvv replaced by the more generic writeData */
737  // slen_t rlenht=img->getRlen()*img->getHt();
738  // if (rlenht!=0) outstream.vi_write(img->getRowbeg(), rlenht);
739  // outstream.vi_write(0,0); /* Dat: frees cp, bp, (ap) */
740 }
741 
742 /** Returns a divisor of v1*v2 near 4096 */
744  static const slen_t LOW=2048, MID=4096, HIGH=8192;
745  slen_t d, p;
746  if (v1>v2) { d=v1; v1=v2; v2=d; }
747  if (LOW<=v2 && v2<=HIGH) return v2; /* larger */
748  if (LOW<=v1 && v1<=HIGH) return v1; /* smaller */
749  if ((p=v1*v2)<=HIGH) return p; /* smaller */
750  for (d=MID;d<=HIGH;d++) if (p%d==0) return d;
751  for (d=MID-1;d>=LOW;d--) if (p%d==0) return d;
752  return v1; /* the smaller one */
753 }
754 
755 /** Basicly out.format("%g", (double)n/255);, but we don't want to depend on
756  * floating point arithmetic of the underlying architecture.
757  */
758 static void div255(GenBuffer::Writable& out, unsigned n) {
759  char tmp[7];
760  unsigned abc;
761  param_assert(n<=255);
762  tmp[0]='0'; tmp[1]='.'; tmp[3]='\0';
763  if (n%51!=0) {
764  /* Divisors of 255: 1, 3, 5, 15, 17, 51, 85, 255.
765  * 0/255 == "0" 51/255 == "0.2"
766  * 102/255 == "0.4" 153/255 == "0.6"
767  * 204/255 == "0.8" 255/255 == "1"
768  * All other k/255 are infinite as a decimal fraction.
769  * 1000 > 2*255, so 3 digits after '.' is enough.
770  */
771  assert(n<=254);
772  #if 0
773  abc=(127L+1000*n)/255;
774  tmp[2]='0'+abc/100;
775  tmp[3]='0'+(abc/10)%10;
776  tmp[4]='0'+abc%10;
777  tmp[5]='\0';
778  #else
779  abc=(127L+10000*n)/255;
780  tmp[2]='0'+abc/1000;
781  tmp[3]='0'+(abc/100)%10;
782  tmp[4]='0'+(abc/10)%10;
783  tmp[5]='0'+abc%10;
784  tmp[6]='\0';
785  #endif
786  } else if (n<153) {
787  if (n<51) tmp[1]='\0';
788  else if (n>51) tmp[2]='4';
789  else tmp[2]='2';
790  }
791  else if (n<204) tmp[2]='6';
792  else if (n>204) { tmp[0]='1'; tmp[1]='\0'; }
793  else tmp[2]='8';
794  out << tmp;
795 }
796 
799  GenBuffer::Writable&outpal,
800  GenBuffer::Writable&outstream,
801  char const*template_, Rule::OutputRule*or_, Image::SampledInfo *sf, stream_writer_t stream_writer, char const*const*strings) {
802  unsigned int i, j;
803  register char const*p;
804  char *r;
805  Image::Sampled *img=sf->getImg();
806  param_assert(template_!=(const char*)NULLP);
807  p=template_;
808  bool nzp, scp;
809  SimBuffer::B scf;
810  while (1) {
811  assert(template_==p);
812  while (*p!='`' && *p!='\0') p++; /* '`' is the escape character */
813  if (p!=template_) out.vi_write(template_, p-template_);
814  if (*p++=='\0') break;
815  switch (*p++) {
816  case '\0':
817  p--; /* fall through */
818  case '`':
819  out.vi_write("`", 1); break;
820  case '#': /* number of non-transparent colors of /Indexed*, /Transparent* */
821  out << sf->getNncols(); break;
822  case 'p': /* 3*(number of non-transparent colors of /Indexed*, /Transparent*) */
823  out << (3*sf->getNncols()); break;
824  case 'P': /* number of palette bytes (including the transparent color) */
825  out << img->getRowbeg()-img->getHeadp(); break;
826  case '0': case '1': case '2': /* arbitrary, user-defined string */
827  param_assert(strings!=(char const*const*)NULLP);
828  out << strings[p[-1]-'0']; break;
829  case 'C': /* PDF /Procset entries */
830  if (or_->cache.isIndexed()) out << "/ImageI";
831  else if (or_->cache.isGray()) out << "/ImageB";
832  else out << "/ImageC"; /* SF_Rgb*, SF_Asis etc. */
833  break;
834  case 'i': /* PS image or colorimage operator */
835  out << (or_->cache.isGray() ? "image"
837  : "false 3 colorimage");
838  break;
839  case 'I': /* PS warning for usage of colorimage operator */
840  // if (!or_->cache.isGray()) out << "% PSLC required\n";
841  if (!or_->cache.isGray() && !or_->cache.isTransparentM()) out << "%%Extensions: CMYK\n";
842  break;
843 #if 0
844  case "p:invalid": /* optional predictor specification */
845  { unsigned char pred=or_->cache.Predictor;
846  if (pred== 2) out << "/Predictor 2"; /* TIFF predictor */
847  else if (pred>=10) out << "/Predictor 10"; /* any PNG predictor */
848  }
849 #endif
850  case 'w': /* image width, decimal */
851  out << img->getWd();
852  break;
853  case 'h': /* image height, decimal */
854  out << img->getHt();
855  break;
856  case '?': /* a divisor of rlen*height near 4096 */
857  if (sf->getImgs()!=NULLP) { /* /Transparent+ */
858  out << near_div(sf->getImgs()[0]->getRlen(), img->getHt());
859  /* Dat: `img->getHt()*sf->getNncols()' would be wrong */
860  } else {
861  out << near_div(img->getRlen(), img->getHt());
862  }
863  break;
864  case 'B': /* Clean7Bits or Binary; Sun Jun 23 18:55:35 CEST 2002 */
865  out << (or_->cache.isPDF() ? (or_->cache.isBinSB() ? "%\307\354\217\242\n" : "")
866  : (or_->cache.isBinSB() ? "Binary" : "Clean7Bit"));
867  break;
868  case 'b': /* image bpc, decimal */
869  /* added "true"|"false" for sam2p-0.39 at Sun Sep 22 17:49:25 CEST 2002 */
870  if (or_->cache.SampleFormat==Image::SF_Mask) out << "false";
871  else if (or_->cache.SampleFormat==Image::SF_Indexed1) out << "true";
872  else out << (unsigned)img->getBpc();
873  break;
874  case 'c': /* image cpp, decimal */
875  out << (unsigned)img->getCpp();
876  break;
877  case 'd': /* device-specific color-space name */
879  break;
880  case 't': /* closefile specification in PostScript */
881  if (or_->cache.Compression!=or_->cache.CO_None) out << " F closefile";
882  if (or_->cache.TransferEncoding!=or_->cache.TE_Binary) out << " T closefile";
883  break;
884  case 'T': /* TransferEncoding specification in PostScript */
885  or_->appendTransferSpec(out);
886  break;
887  case 'F': /* decoding filter specification in PostScript */
888  or_->appendDecoderSpec(out);
889  break;
890  case 'O': /* 0..1 /Decode values */
891  i=1;
892  emit_Decode:
893  j=img->getCpp();
894  out << "0 " << i;
895  while (j--!=1) out << " 0 " << i;
896  break;
897  case 'D': /* 0..max-1 /Decode values for indexed, 0..1 for others */
898  i=(or_->cache.isIndexed())?(1<<img->getBpc())-1:1;
899  goto emit_Decode;
900  case 'S': /* image data stream */
901  stream_writer(outpal, outstream, sf);
902  break;
903  case 'g': /* PDF 0..1 RGB triplet of the 0th palette color */
904  assert(img->getTy()==img->TY_INDEXED);
905  r=img->getHeadp();
906  goto appG;
907  case 'G': /* PDF 0..1 RGB triplet of the 1st palette color */
908  assert(img->getTy()==img->TY_INDEXED);
909  r=img->getHeadp()+3;
910  appG:
911  div255(out, (unsigned char)r[0]); out << ' ';
912  div255(out, (unsigned char)r[1]); out << ' ';
913  div255(out, (unsigned char)r[2]);
914  break;
915  case 'r': /* PS 0..1 RGB triplet of the 0th palette color */
916  assert(img->getTy()==img->TY_INDEXED);
917  r=img->getHeadp();
918  out << (unsigned)(unsigned char)r[0] << " 255 div "
919  << (unsigned)(unsigned char)r[1] << " 255 div "
920  << (unsigned)(unsigned char)r[2] << " 255 div";
921  break;
922  case 'R': /* PS code for setting up bg and fg colors for an imagemask */
923  /* formerly: PS 0..1 RGB triplet of the 1st palette color */
924  /* changed at Sun Sep 22 18:02:41 CEST 2002 */
926  assert(img->getTy()==img->TY_INDEXED);
927  r=img->getHeadp();
928  out << (unsigned)(unsigned char)r[0] << " 255 div " /* 0th palette color */
929  << (unsigned)(unsigned char)r[1] << " 255 div "
930  << (unsigned)(unsigned char)r[2] << " 255 div setrgbcolor\n";
932  out << "0 0 moveto\n"
933  << img->getWd() << " 0 lineto\n0 "
934  << img->getHt() << " rlineto\n-"
935  << img->getWd() << " 0 rlineto\nclosepath fill\n"
936  << (unsigned)(unsigned char)r[3] << " 255 div " /* 1st palette color */
937  << (unsigned)(unsigned char)r[4] << " 255 div "
938  << (unsigned)(unsigned char)r[5] << " 255 div\nsetrgbcolor\n";
939  }
940  }
941  break;
942  case 'E': /* EPS header for unscaled PS files */
943  if (or_->cacheHints.Scale==or_->cacheHints.SC_None) out << " EPSF-3.0";
944  break;
945  case 'X': /* BoundingBox for EPS, MediaBox for PDF */
946  if (or_->cache.isPDF()) {
947  // out << "0 0 ";
948  out << "0 ";
949  goto do_bbox;
950  } else if (or_->cacheHints.Scale==or_->cacheHints.SC_None) {
951  /* It is no point to start the BoundingBox of EPS files at
952  * (LeftMargin,BottomMargin). The effect would be the same as
953  * specifying no margins at all. Our choice is better: the
954  * BoundingBox contains the image and the margins too.
955  */
956  // out << "%%BoundingBox: 0 0 ";
957  out << "%%BoundingBox: 0 ";
958  do_bbox:
959  // out << MiniPS::RVALUE(or_->cacheHints.LowerMargin) << ';'; /* SUXX: this would put `1 72 mul' */
960  // out << MiniPS::RVALUE(or_->cacheHints.BottomMargin) << ';'; /* SUXX: this would put `1 72 mul' */
962  out << ' ';
965  out << ' ';
968  if (!or_->cache.isPDF()) out << '\n';
969  }
970  break;
971  case 's': /* scaling to a full PostScript page or translation for PDF and EPS */
974  scp=!MiniPS::isEq(or_->cacheHints.ImageDPI, 72) &&
975  !MiniPS::isEq(or_->cacheHints.ImageDPI, -72);
976 
977  if (or_->cache.isPDF()) {
978  SimBuffer::B scf;
979  if (scp) MiniPS::dumpScale(scf, or_->cacheHints.ImageDPI);
980  else scf << 'x';
981  if (nzp || scp) out << " " << scf << " 0 0 " << scf << " " << MiniPS::RVALUE(or_->cacheHints.LeftMargin)
982  << ' ' << MiniPS::RVALUE(or_->cacheHints.LowerMargin)
983  << " cm"; /* translate */
984  } else switch (or_->cacheHints.Scale) {
986  if (nzp) out << '\n' << MiniPS::RVALUE(or_->cacheHints.LeftMargin)
987  << ' ' << MiniPS::RVALUE(or_->cacheHints.LowerMargin)
988  << " translate";
989  if (scp) {
991  out << '\n' << scf << " dup scale";
992  }
993  break;
995  /* from pshack/big.ps */
996  out <<"\n6 dict begin currentpagedevice/PageSize get dup 0 get\n " << MiniPS::RVALUE(or_->cacheHints.LeftMargin) << " sub " << MiniPS::RVALUE(or_->cacheHints.RightMargin) << " sub/w exch\n"
997  " def 1 get " << MiniPS::RVALUE(or_->cacheHints.TopMargin) << " sub " << MiniPS::RVALUE(or_->cacheHints.BottomMargin) << " sub/h exch\n"
998  " def/x " << img->getWd() << " def/y " << img->getHt() << " def " << MiniPS::RVALUE(or_->cacheHints.LeftMargin) << ' ' << MiniPS::RVALUE(or_->cacheHints.BottomMargin) << " translate x h\n"
999  " mul y w mul gt{w x 0 h y w mul x div sub 2 div}{h y w x h mul y div sub 2 div\n"
1000  " 0}ifelse translate div dup scale\nend";
1001  break;
1003  /* from pshack/big.ps */
1004  out <<"\n6 dict begin currentpagedevice/PageSize get dup 0 get\n " << MiniPS::RVALUE(or_->cacheHints.LeftMargin) << " sub " << MiniPS::RVALUE(or_->cacheHints.RightMargin) << " sub/w exch\n"
1005  " def 1 get " << MiniPS::RVALUE(or_->cacheHints.TopMargin) << " sub " << MiniPS::RVALUE(or_->cacheHints.BottomMargin) << " sub/h exch\n"
1006  " def/x " << img->getWd() << " def/y " << img->getHt() << " def " << MiniPS::RVALUE(or_->cacheHints.LeftMargin) << ' ' << MiniPS::RVALUE(or_->cacheHints.BottomMargin) << "/b y h mul x\n"
1007  " w mul gt def b{w y}{h x}ifelse div/c x h mul y w mul gt def c{w x}{h y}ifelse\n"
1008  " div gt{h add translate -90 rotate b{w y h x w mul y div sub 2 div 0}{h\n"
1009  " x 0 w y h mul x div sub 2 div}}{translate c{w x 0 h y w mul x div sub 2 div}{h\n"
1010  " y w x h mul y div sub 2 div 0}}ifelse ifelse translate div dup scale\nend";
1011  break;
1012  }
1013  break;
1014  default:
1015  Error::sev(Error::EERROR) << "writeTTE: unknown escape: " << (char)p[-1] << (Error*)0;
1016  }
1017  template_=p;
1018  }
1019 }
1020 
1021 /** by pts@fazekas.hu at Mon Apr 15 22:31:03 CEST 2002 */
1023  Filter::VerbatimE &outve,
1024  GenBuffer::Writable&outpal,
1025  GenBuffer::Writable&outstream,
1026  MiniPS::Array *chunkArray,
1027  Rule::OutputRule*or_,
1029  stream_writer_t stream_writer,
1030  char const*const*strings) {
1031  static const unsigned MAXLEN=64;
1032  /* Imp: use heap instead of stack space */
1033  slen_t offsets[MAXLEN+1]; /* 260 bytes stack */
1034  SimBuffer::B chunks[MAXLEN]; /* <=1024 bytes stack; default constructor */
1036  param_assert(chunkArray!=NULLP);
1037  // param_assert(chunkArray->getLength()<=MAXLEN);
1038  if (chunkArray->getLength()>(int)MAXLEN) Error::sev(Error::EERROR) << "writeTTM: TTM too long" << (Error*)0;
1039  GenBuffer::Writable& out=outve.getOut();
1040  MiniPS::ii_t i, ii;
1041  for (chunkArray->getFirst(chunk), i=0; chunk!=NULLP; chunkArray->getNext(chunk), i++) {
1043  outve.setOut(chunks[i]);
1044  writeTTM(outve, outpal, outstream, MiniPS::RARRAY(*chunk), or_, sf, stream_writer, strings);
1045  }
1046  }
1047  for (chunkArray->getFirst(chunk), offsets[i=0]=0; chunk!=NULLP; chunkArray->getNext(chunk), i++) {
1048  switch (MiniPS::getType(*chunk)) {
1049  case MiniPS::T_ARRAY:
1050  break;
1051  case MiniPS::T_STRING: /* always null-terminated */
1052  outve.setOut(chunks[i]);
1053  writeTTE(outve, outpal, outstream, MiniPS::RSTRING(*chunk)->begin_(), or_, sf, stream_writer, strings);
1054  break;
1055  case MiniPS::T_INTEGER:
1056  if (0==(ii=MiniPS::int2ii(*chunk))) Error::sev(Error::EERROR) << "writeTTM: zero is an invalid chunk" << (Error*)0;
1057  if (ii>0) { /* an offset */
1058  if (ii>i) Error::sev(Error::EERROR) << "writeTTM: cannot predict chunk offset" << (Error*)0;
1059  if (MiniPS::T_ARRAY==MiniPS::getType(chunkArray->get(ii)))
1060  chunks[i].write_num(offsets[ii], 10); /* Dat: 10: 10 digits (for PDF xref table), not base 10 */
1061  else chunks[i] << offsets[ii];
1062  } else { /* a length */
1063  chunks[i] << chunks[-ii].getLength();
1064  }
1065  break;
1066  default:
1067  Error::sev(Error::EERROR) << "writeTTM: invalid chunk type: " << MiniPS::getTypeStr(MiniPS::getType(*chunk)) << (Error*)0;
1068  }
1069  offsets[i+1]=offsets[i]+chunks[i].getLength();
1070  } /* NEXT */
1071  outve.setOut(out);
1072  for (i=0; i<chunkArray->getLength(); i++) out << chunks[i];
1073  /* Imp: organize that chunks[.] gets freed earlier than this */
1074 } /* Rule::writeTTM() */
1075 
1077 
1080  GenBuffer::Writable&outpal,
1081  GenBuffer::Writable&outstream,
1082  char const *template_key,
1083  Rule::OutputRule*or_,
1085  stream_writer_t stream_writer,
1086  char const*const*strings) {
1088  Error::sev(Error::NOTICE) << "writeTTT: using template: " << template_key << (Error*)0;
1089  MiniPS::VALUE val=Templates->get(template_key, strlen(template_key));
1091  switch (MiniPS::getType(val)) {
1092  case MiniPS::T_STRING:
1093  writeTTE(out, outpal, outstream, MiniPS::RSTRING(val)->begin_(), or_, sf, stream_writer, strings);
1094  break;
1095  case MiniPS::T_ARRAY:
1096  /* Imp: vvv This up-cast is unsafe! */
1097  writeTTM(*(Filter::VerbatimE*)&out, outpal, outstream, MiniPS::RARRAY(val), or_, sf, stream_writer, strings);
1098  break;
1099  default:
1100  Error::sev(Error::EERROR) << "writeTTT: invalid template type: " << MiniPS::getTypeStr(MiniPS::getType(val)) << (Error*)0;
1101  }
1102 }
1103 
1104 /* __END__ */
Definition: error.hpp:20
static GenBuffer::Writable & sev(level_t level)
Definition: error.cpp:58
static void popPolicy()
Definition: error.cpp:127
static level_t getTopPrinted()
Definition: error.cpp:125
static SimBuffer::B * getRecorded()
Definition: error.cpp:115
level_t
Definition: error.hpp:27
@ NOTICE
Definition: error.hpp:33
@ EERROR
Definition: error.hpp:29
@ WARNING
Definition: error.hpp:31
@ NOTICE_DEFER
Definition: error.hpp:34
@ WARNING_DEFER
Definition: error.hpp:32
static void pushPolicy(level_t killer_, level_t printed_, level_t recorded_, GenBuffer::Writable *err=(GenBuffer::Writable *)((void *) 0))
Definition: error.cpp:101
void setOut(GenBuffer::Writable &out_)
Definition: gensio.hpp:111
GenBuffer::Writable & getOut() const
Definition: gensio.hpp:112
virtual void vi_write(char const *, slen_t)=0
static void tolower_memcpy(char *dst, char const *s, slen_t slen)
Definition: gensi.cpp:1173
unsigned long rgb_t
Definition: image.hpp:47
unsigned char getTy() const
Definition: image.hpp:125
char * getRowbeg() const
Definition: image.hpp:122
unsigned char getBpc() const
Definition: image.hpp:126
char * getHeadp() const
Definition: image.hpp:132
dimen_t getWd() const
Definition: image.hpp:123
dimen_t getHt() const
Definition: image.hpp:124
unsigned char getCpp() const
Definition: image.hpp:127
rlen_t getRlen() const
Definition: image.hpp:130
static char const * cs2devcs(unsigned char cs)
Definition: image.cpp:105
unsigned char getCs() const
Definition: image.hpp:128
sf_t
Definition: image.hpp:313
@ SF_Indexed2
Definition: image.hpp:322
@ SF_Asis
Definition: image.hpp:333
@ SF_Indexed1
Definition: image.hpp:318
@ SF_Opaque
Definition: image.hpp:315
@ SF_Rgb1
Definition: image.hpp:324
@ SF_Indexed8
Definition: image.hpp:330
@ SF_Gray4
Definition: image.hpp:325
@ SF_Mask
Definition: image.hpp:319
@ SF_Transparent
Definition: image.hpp:316
@ SF_Rgb4
Definition: image.hpp:331
@ SF_Rgb2
Definition: image.hpp:328
@ SF_Transparent8
Definition: image.hpp:327
@ SF_Rgb8
Definition: image.hpp:332
@ SF_Transparent2
Definition: image.hpp:320
@ SF_Bbox
Definition: image.hpp:334
@ SF_max
Definition: image.hpp:335
@ SF_Gray8
Definition: image.hpp:329
@ SF_Gray1
Definition: image.hpp:317
@ SF_Gray2
Definition: image.hpp:321
@ SF_Transparent4
Definition: image.hpp:323
@ SF_Indexed4
Definition: image.hpp:326
VALUE get(ii_t index)
Definition: minips.cpp:383
void getNext(VALUE *&val)
Definition: minips.cpp:433
void getFirst(VALUE *&val)
Definition: minips.cpp:429
VALUE get(char const *key, slen_t keylen)
Definition: minips.cpp:490
char * begin_() const
Definition: minips.hpp:95
ii_t getLength() const
Definition: minips.hpp:90
@ Qnull
Definition: minips.hpp:71
@ Qundef
Definition: minips.hpp:71
@ Qtrue
Definition: minips.hpp:71
static void delete0(VALUE v)
Definition: minips.cpp:217
static Value * RVALUE(VALUE v)
Definition: minips.hpp:215
static unsigned getType(VALUE v)
Definition: minips.cpp:206
static void dumpAdd3(GenBuffer::Writable &out, VALUE m, VALUE a, VALUE b, VALUE c, VALUE sub, unsigned rounding=0)
Definition: minips.cpp:1055
static VALUE Qinteger(ii_t v)
Definition: minips.hpp:234
static void scanf_dict(VALUE job, bool show_warnings,...)
Definition: minips.cpp:920
static void setDumpPS(VALUE v, bool g)
Definition: minips.cpp:1006
static ii_t int2ii(VALUE v)
Definition: minips.hpp:235
@ S_SENUM
Definition: minips.hpp:75
@ S_UINTEGER
Definition: minips.hpp:77
@ T_ARRAY
Definition: minips.hpp:74
@ S_RGBSTR
Definition: minips.hpp:80
@ S_NUMBER
Definition: minips.hpp:81
@ T_BOOLEAN
Definition: minips.hpp:73
@ S_ANY
Definition: minips.hpp:78
@ S_FUNC
Definition: minips.hpp:76
@ S_PINTEGER
Definition: minips.hpp:79
@ T_DICT
Definition: minips.hpp:74
@ T_STRING
Definition: minips.hpp:74
@ T_INTEGER
Definition: minips.hpp:73
static Array * RARRAY(VALUE v)
Definition: minips.hpp:217
static String * RSTRING(VALUE v)
Definition: minips.hpp:218
static Dict * RDICT(VALUE v)
Definition: minips.hpp:219
static bool isZero(VALUE v)
Definition: minips.cpp:1011
static char const * getTypeStr(unsigned u)
Definition: minips.cpp:212
ii_t VALUE
Definition: minips.hpp:69
static void dumpScale(GenBuffer::Writable &out, VALUE v)
Definition: minips.cpp:1033
static bool isEq(VALUE v, double d)
Definition: minips.cpp:1021
signed int ii_t
Definition: minips.hpp:21
static void writeData(GenBuffer::Writable &out, GenBuffer::Writable &outstream, Image::SampledInfo *sf)
Definition: rule.cpp:711
static unsigned printAppliers(GenBuffer::Writable &out)
Definition: rule.cpp:593
static void writeTTE(GenBuffer::Writable &out, GenBuffer::Writable &outpal, GenBuffer::Writable &outstream, char const *template_, Rule::OutputRule *or_, Image::SampledInfo *sf, stream_writer_t stream_writer, char const *const *strings=(char **)((void *) 0))
Definition: rule.cpp:797
static MiniPS::Dict * Templates
Definition: rule.hpp:299
static void writePalData(GenBuffer::Writable &out, GenBuffer::Writable &outstream, Image::SampledInfo *sf)
Definition: rule.cpp:731
static void writeTTM(Filter::VerbatimE &outve, GenBuffer::Writable &outpal, GenBuffer::Writable &outstream, MiniPS::Array *chunkArray, Rule::OutputRule *or_, Image::SampledInfo *sf, stream_writer_t stream_writer, char const *const *strings=(char **)((void *) 0))
Definition: rule.cpp:1022
static void register0(Applier *)
Definition: rule.cpp:587
void(* stream_writer_t)(GenBuffer::Writable &out, GenBuffer::Writable &outstream, Image::SampledInfo *sf)
Definition: rule.hpp:269
static void writeTTT(GenBuffer::Writable &out, GenBuffer::Writable &outpal, GenBuffer::Writable &outstream, char const *template_key, Rule::OutputRule *or_, Image::SampledInfo *sf, stream_writer_t stream_writer, char const *const *strings=(char **)((void *) 0))
Definition: rule.cpp:1078
static OutputRule * buildProfile(MiniPS::VALUE Profile, bool quiet=((bool) 0))
Definition: rule.cpp:603
static void applyProfile(GenBuffer::Writable &out, OutputRule *rule_list, Image::SampledInfo *sf)
Definition: rule.cpp:650
static void deleteProfile(OutputRule *)
Definition: rule.cpp:701
virtual slen_t getLength() const
Definition: gensi.hpp:253
~ValueDeleter()
Definition: rule.cpp:92
#define n
Definition: t4ht.c:1290
unsigned int slen_t
Definition: config2.h:37
#define NULLP
Definition: config2.h:66
#define param_assert
Definition: config2.h:96
#define dummy
Definition: devnag.c:313
int dummy
Definition: dummy.c:29
int v
Definition: dviconv.c:10
char * strings
Definition: dvidvi.c:141
#define info
Definition: dviinfo.c:42
cmd_t K[128]
Definition: fmtutil.c:72
static void
Definition: fpif.c:118
#define _(String)
Definition: ftxerr18.c:64
#define v1
#define v2
#define s
Definition: afcover.h:80
#define c(n)
Definition: gpos-common.c:150
#define d(n)
Definition: gpos-common.c:151
FILE * out
Definition: hbf2gf.c:286
#define slen
Definition: hpcdtoppm.c:1329
assert(pcxLoadImage24((char *)((void *) 0), fp, pinfo, hdr))
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
kerning y
Definition: ttdriver.c:212
static GBool quiet
Definition: pdfimages.cc:38
int num
Definition: disdvi.c:621
#define buf
static int ret
Definition: convert.c:72
int ii
Definition: main.c:50
static UHashtable * cache
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
int r
Definition: ppmqvga.c:68
static void chunk(LexState *ls)
Definition: minilua.c:4678
static MiniPS::VALUE better_quality(MiniPS::VALUE v)
Definition: rule.cpp:339
static MiniPS::VALUE better_effort(MiniPS::VALUE v)
Definition: rule.cpp:329
static class ValueDeleter value_deleter
static MiniPS::VALUE better_colorTransform(MiniPS::VALUE v)
Definition: rule.cpp:344
static char const * getBIDecode(Rule::Cache::co_t Compression)
Definition: rule.cpp:502
static char const * getDecode(Rule::Cache::co_t Compression)
Definition: rule.cpp:490
static void init_dicts()
Definition: rule.cpp:102
static void div255(GenBuffer::Writable &out, unsigned n)
Definition: rule.cpp:758
static MiniPS::VALUE better_xColors(MiniPS::VALUE v)
Definition: rule.cpp:318
static slen_t near_div(slen_t v1, slen_t v2)
Definition: rule.cpp:743
static MiniPS::VALUE better_predictorBPC(MiniPS::VALUE v)
Definition: rule.cpp:323
static MiniPS::Dict * y_FileFormat
Definition: rule.cpp:87
static MiniPS::VALUE better_predictor(MiniPS::VALUE v)
Definition: rule.cpp:311
static const slen_t SampleFormat_MAXLEN
Definition: rule.cpp:101
static MiniPS::Dict * y_Scale
Definition: rule.cpp:89
static MiniPS::VALUE better_k(MiniPS::VALUE v)
Definition: rule.cpp:334
static MiniPS::Dict * y_TransferEncoding
Definition: rule.cpp:88
static Rule::Applier * first_rule
Definition: rule.cpp:585
static MiniPS::Dict * y_SampleFormat
Definition: rule.cpp:88
static MiniPS::Dict * y_Compression
Definition: rule.cpp:89
#define Scale(o, sx, sy)
Definition: spaces.h:96
Applier * next
Definition: rule.hpp:240
MiniPS::VALUE LeftMargin
Definition: rule.hpp:155
MiniPS::VALUE LowerMargin
Definition: rule.hpp:160
MiniPS::VALUE TopMargin
Definition: rule.hpp:155
MiniPS::VALUE ImageDPI
Definition: rule.hpp:162
MiniPS::VALUE RightMargin
Definition: rule.hpp:155
static char const * dumpScale(sc_t Scale)
Definition: rule.cpp:297
MiniPS::VALUE BottomMargin
Definition: rule.hpp:155
static char const * dumpSampleFormat(Image::sf_t SampleFormat)
Definition: rule.cpp:258
static char const * dumpTransferEncoding(te_t TransferEncoding)
Definition: rule.cpp:247
@ FF_Empty
Definition: rule.hpp:40
@ FF_X11
Definition: rule.hpp:48
@ FF_PNG
Definition: rule.hpp:44
@ FF_PDF10
Definition: rule.hpp:34
@ FF_PDF12
Definition: rule.hpp:35
@ FF_XPM
Definition: rule.hpp:45
@ FF_PSL2
Definition: rule.hpp:30
@ FF_PSLC
Definition: rule.hpp:29
@ FF_Meta
Definition: rule.hpp:41
@ FF_PAM
Definition: rule.hpp:38
@ FF_BMP
Definition: rule.hpp:46
@ FF_PIP
Definition: rule.hpp:39
@ FF_PSL3
Definition: rule.hpp:31
@ FF_PDFB12
Definition: rule.hpp:33
@ FF_XWD
Definition: rule.hpp:47
@ FF_JPEG
Definition: rule.hpp:42
@ FF_PSL1
Definition: rule.hpp:28
@ FF_PNM
Definition: rule.hpp:37
@ FF_TIFF
Definition: rule.hpp:43
@ FF_GIF89a
Definition: rule.hpp:36
@ FF_PDFB10
Definition: rule.hpp:32
bool isPSL2() const
Definition: rule.cpp:67
bool hasPredictor() const
Definition: rule.cpp:73
bool isRGB() const
Definition: rule.cpp:53
Image::sf_t SampleFormat
Definition: rule.hpp:51
static char const * dumpCompression(co_t Compression)
Definition: rule.cpp:283
bool isOneBit() const
Definition: rule.cpp:34
Image::Sampled::rgb_t Transparent
Definition: rule.hpp:97
bool WarningOK
Definition: rule.hpp:22
bool isGray() const
Definition: rule.cpp:47
@ TE_Hex
Definition: rule.hpp:61
@ TE_Binary
Definition: rule.hpp:59
@ TE_ASCII
Definition: rule.hpp:60
@ TE_A85
Definition: rule.hpp:62
@ TE_LSBfirst
Definition: rule.hpp:64
@ TE_MSBfirst
Definition: rule.hpp:63
bool isZIPOK() const
Definition: rule.cpp:80
bool isIndexed() const
Definition: rule.cpp:22
ff_t FileFormat
Definition: rule.hpp:50
bool isTransparentM() const
Definition: rule.cpp:28
bool isBinSB() const
Definition: rule.cpp:59
te_t TransferEncoding
Definition: rule.hpp:66
bool isDCTE() const
Definition: rule.cpp:76
bool isPDFB() const
Definition: rule.cpp:19
static char const * dumpFileFormat(ff_t FileFormat, co_t Compression=CO_default)
Definition: rule.cpp:218
bool isPSL3() const
Definition: rule.cpp:70
pr_t Predictor
Definition: rule.hpp:95
co_t Compression
Definition: rule.hpp:80
bool isPS() const
Definition: rule.cpp:64
@ CO_Fax
Definition: rule.hpp:74
@ CO_ZIP
Definition: rule.hpp:72
@ CO_IJG
Definition: rule.hpp:76
@ CO_LZW
Definition: rule.hpp:71
@ CO_DCT
Definition: rule.hpp:75
@ CO_RLE
Definition: rule.hpp:73
@ CO_JAI
Definition: rule.hpp:77
@ CO_None
Definition: rule.hpp:70
static Image::sf_t parseSampleFormat(char const *s, slen_t slen)
Definition: rule.cpp:201
bool isPDF() const
Definition: rule.cpp:16
MiniPS::Dict * dictHints
Definition: rule.hpp:171
MiniPS::Dict * dict
Definition: rule.hpp:169
void appendTransferSpec(GenBuffer::Writable &out) const
Definition: rule.cpp:578
void appendPredictorSpec(GenBuffer::Writable &out) const
Definition: rule.cpp:564
unsigned c
Definition: rule.hpp:173
void fromDict(MiniPS::VALUE)
Definition: rule.cpp:350
bool hasPredictorSpec() const
Definition: rule.cpp:558
CacheHints cacheHints
Definition: rule.hpp:168
void appendDecoderSpec(GenBuffer::Writable &out) const
Definition: rule.cpp:513
void doSampleFormat(Image::SampledInfo *info, bool separate=((bool) 0))
Definition: rule.cpp:460
Definition: tfmaux.c:31
Definition: strexpr.c:21
int j
Definition: t4ht.c:1589
*job_name strlen((char *) job_name) - 4)
val
Definition: tex4ht.c:3227
#define MAXLEN
Definition: ttfdump.c:33