File: OutputOptions.h

package info (click to toggle)
kdc2tiff 0.35-10
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, stretch
  • size: 520 kB
  • ctags: 676
  • sloc: cpp: 3,107; ansic: 832; sh: 330; makefile: 23
file content (146 lines) | stat: -rw-r--r-- 2,892 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#ifndef _OutputOptions_H
#define _OutputOptions_H

/* Class used to handle processing of command line parameters passed to
 * kdc2tiff and kdc2jpeg.
 * 
 * Written by:  Chris Studholme
 * Last Update: 6-Dec-2003
 * Copyright:   GPL (http://www.fsf.org/copyleft/gpl.html)
 */

#include "KDCFile.h"
#include "GImage.h"
#include "GFile_DC120.h"

#define DEFAULT_JPEG_QUALITY 75

class OutputOptions {
public:
  // input file options
  const char* inputname;
  GFile* srcimage;
  GImage* image;
  bool fastdebayer;

  KDCFile* kdcfile; // this should go away

  // image options
  int contrastenhance;
  float gammacorrection;
  int grainreduction;
  bool squarepixels;
  bool nocrop;
  int rotate;
  int outputwhite;
  int lightwhite;        // 0=no correction, -1=auto

  // temporary variables
  float gammaoffset;

  // output file options
  char* outputname;
  bool overwrite;   // overwrite output file if exists
  int outputwidth;
  int outputheight;
  char* copyright;

  // specific tiff options
  bool outputtiff;
  const char* compresstype;
  int rowsperstrip;

  // specific jpeg options
  bool outputjpeg;
  int quality;
  bool progressive;

public:
  OutputOptions() {
    // defaults
    inputname=0;
    srcimage=0;
    image=0;
    fastdebayer=false;

    kdcfile=0;

    contrastenhance=2;
    gammacorrection=1;
    grainreduction=0;
    squarepixels=true;
    nocrop=false;
    rotate=0;

    gammaoffset=0;

    outputwhite=6500;
    lightwhite=0;

    outputname=0;
    overwrite=false;
    outputwidth=0;
    outputheight=0;
    copyright=0;

    outputtiff=false;
    compresstype=0;
    rowsperstrip=0;

    outputjpeg=false;
    quality=DEFAULT_JPEG_QUALITY;
    progressive=false;
  }

  OutputOptions(OutputOptions& other) {
    // copy from other
    inputname=other.inputname;
    srcimage=other.srcimage;
    image=other.image;
    fastdebayer=other.fastdebayer;

    kdcfile=other.kdcfile;

    contrastenhance=other.contrastenhance;
    gammacorrection=other.gammacorrection;
    grainreduction=other.grainreduction;
    squarepixels=other.squarepixels;
    nocrop=other.nocrop;
    rotate=other.rotate;

    gammaoffset=other.gammaoffset;

    outputwhite=other.outputwhite;
    lightwhite=other.lightwhite;

    outputname=other.outputname;
    //overwrite=other.overwrite;
    overwrite=false;
    outputwidth=other.outputwidth;
    outputheight=other.outputheight;
    copyright=other.copyright;

    outputtiff=other.outputtiff;
    compresstype=other.compresstype;
    rowsperstrip=other.rowsperstrip;

    outputjpeg=other.outputjpeg;
    quality=other.quality;
    progressive=other.progressive;
  }


  void SetOutputParameters();

  void SetOutputFilename();

  void CalculateScanLine(unsigned char* dest, int y);

  /* stops at first non-option, return 0 if error, new argv othersise
   */
  char** ParseOptions(int& argc, char*argv[]);
  
};


#endif