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
|
#ifndef _GFile_JPEG_H
#define _GFile_JPEG_H
#include "GFile.h"
class GFile_JPEG : public GFile {
protected:
int w,h;
unsigned int histogram[256];
public:
GFile_JPEG(const char* filename, bool fast=false);
~GFile_JPEG();
static bool supportsFile(FILE* file);
bool isOK() {
return ((red!=NULL)&&(green!=NULL)&&(blue!=NULL));
}
void FindBestMinMax(int& min, int& max) {
calculateBestMinMax(min,max,histogram);
}
const char* getComments() {
return NULL;
}
int getWidth() {
return w;
}
int getHeight() {
return h;
}
double getAspectRatio() {
return 1;
}
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
|