Logo Search packages:      
Sourcecode: kdc2tiff version File versions  Download package

GFile_TIFF.h

#ifndef _GFile_TIFF_H
#define _GFile_TIFF_H

#include <tiffio.h>
#include "GFile.h"

/* GFile (ie. GImage) decendent for reading TIFF files.
 * 
 * Written by:  Chris Studholme
 * Last Update: 8-January-2000
 * Copyright:   GPL (http://www.fsf.org/copyleft/gpl.html)
 */

00014 class GFile_TIFF : public GFile {
 protected:
  TIFF* imagefile;
  
  int w,h;

 public:
  GFile_TIFF(const char* filename, bool fast=false);
  //  GFile_TIFF(FILE* imagefile);
  ~GFile_TIFF();

  static bool supportsFile(FILE* file);

  bool isOK() {
    return (imagefile!=0);
  }

  const char* getComments();

  int getWidth() {
    return w;
  }

  int getHeight() {
    return h;
  }
  
  /* width/height of individual pixel */
  double getAspectRatio();
  
  /* must have x1<x2, y1<y2,
   * pixel values are typically in [-16384,16383], but may be
   * out of this range
   */
  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);
  }

  /* must have y1<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);
  }

  /* must have x1<x2
   */
  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);
  }

 protected:
  void ReadImage(bool fast=false);

};

#endif


Generated by  Doxygen 1.6.0   Back to index