File: GFile_DC120.h

package info (click to toggle)
kdc2tiff 0.35-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 500 kB
  • ctags: 679
  • sloc: cpp: 3,107; ansic: 832; sh: 330; makefile: 49
file content (77 lines) | stat: -rw-r--r-- 1,682 bytes parent folder | download | duplicates (8)
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
#ifndef _GFile_DC120_H
#define _GFile_DC120_H

/* Class used to handle processing of .kdc file from KDCFile.
 * 
 * Written by:  Chris Studholme
 * Last Update: 8-January-2000
 * Copyright:   GPL (http://www.fsf.org/copyleft/gpl.html)
 */

#include "GFile.h"
#include "KDCFile.h"


class GFile_DC120 : public GFile {

 protected:
  int w, h;
  double aspect;
  unsigned int histogram[256];

 public:
  GFile_DC120(KDCFile& file, bool fast=false);
  virtual ~GFile_DC120();

  static bool supportsFile(FILE* file);

  bool isOK() {
    return true;
  }

  void FindBestMinMax(int& min, int& max) {
    calculateBestMinMax(min,max,histogram);
  }

  int getWidth() {
    return w;
  }
  int getHeight() {
    return h;
  }
  int getPreferredWidth() {
    return 1200;
  }
  int getPreferredHeight() {
    return 900;
  }
  double getAspectRatio() {
    return aspect;
  }

  const char* getComments() {
    return NULL;
  }

  void getPixel(short& r, short& g, short& b,
		float x1, float y1, float x2, float y2) {
    r = red->getPixel(x1,y1,x2,y2);
    g = green->getPixel(x1,y1,x2,y2);
    b = blue->getPixel(x1,y1,x2,y2);
  }
  void getScanLineHorz(short* r, short* g, short* b,
		       float x1, float y1, float x2, float y2, int npixels) {
    red->getScanLineHorz(r,x1,y1,x2,y2,npixels);
    green->getScanLineHorz(g,x1,y1,x2,y2,npixels);
    blue->getScanLineHorz(b,x1,y1,x2,y2,npixels);
  }
  void getScanLineVert(short* r, short* g, short* b,
		       float x1, float y1, float x2, float y2, int npixels) {
    red->getScanLineVert(r,x1,y1,x2,y2,npixels);
    green->getScanLineVert(g,x1,y1,x2,y2,npixels);
    blue->getScanLineVert(b,x1,y1,x2,y2,npixels);
  }

};

#endif