1 /* -*- C++ -*- 2 * This file is part of RawTherapee. 3 * 4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> 5 * 6 * RawTherapee is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * RawTherapee is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 #pragma once 20 21 #include "imagesource.h" 22 23 namespace rtengine { 24 25 class StdImageSource: public ImageSource { 26 27 protected: 28 ImageIO* img; 29 ColorTemp wb; 30 ProgressListener* plistener; 31 bool full; 32 int max[3]; 33 bool rgbSourceModified; 34 Imagefloat* imgCopy; 35 36 //void transformPixel (int x, int y, int tran, int& tx, int& ty); 37 void getSampleFormat(const Glib::ustring &fname, IIOSampleFormat &sFormat, IIOSampleArrangement &sArrangement); 38 39 public: 40 StdImageSource(); 41 ~StdImageSource() override; 42 43 int load(const Glib::ustring &fname) override; 44 int load(const Glib::ustring &fname, int maxw_hint, int maxh_hint); 45 void getImage(const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ExposureParams &hrp, const RAWParams &raw) override; getWB()46 ColorTemp getWB() const override 47 { 48 return wb; 49 } 50 void getAutoWBMultipliers(double &rm, double &gm, double &bm) override; 51 ColorTemp getSpotWB(std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, int tran, double equal) override; 52 getSensorType()53 eSensorType getSensorType() const override {return ST_NONE;} isMono()54 bool isMono() const override {return false;} 55 isWBProviderReady()56 bool isWBProviderReady() override 57 { 58 return true; 59 } 60 61 void getAutoExpHistogram(LUTu &histogram, int& histcompr) override; 62 getDefGain()63 double getDefGain() const override 64 { 65 return 0.0; 66 } 67 68 void getFullSize(int &w, int &h, int tr=TR_NONE) override; 69 void getSize(const PreviewProps &pp, int &w, int &h) override; 70 getImageIO()71 ImageIO *getImageIO() 72 { 73 return img; 74 } getImageMatrices()75 ImageMatrices *getImageMatrices() override 76 { 77 return (ImageMatrices*)nullptr; 78 } isRAW()79 bool isRAW() const override 80 { 81 return false; 82 } 83 setProgressListener(ProgressListener * pl)84 void setProgressListener(ProgressListener* pl) override 85 { 86 plistener = pl; 87 } 88 89 void convertColorSpace(Imagefloat *image, const ColorManagementParams &cmp, const ColorTemp &wb) override;// RAWParams raw will not be used for non-raw files (see imagesource.h) 90 static void colorSpaceConversion(Imagefloat* im, const ColorManagementParams &cmp, cmsHPROFILE embedded, IIOSampleFormat sampleFormat, ProgressListener *plistener=nullptr); 91 isRGBSourceModified()92 bool isRGBSourceModified() const override 93 { 94 return rgbSourceModified; 95 } setCurrentFrame(unsigned int frameNum)96 void setCurrentFrame(unsigned int frameNum) override {} getFrameCount()97 int getFrameCount() override {return 1;} getFlatFieldAutoClipValue()98 int getFlatFieldAutoClipValue() override {return 0;} 99 100 getRawValues(int x,int y,int rotate,int & R,int & G,int & B)101 void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) override { R = G = B = 0;} 102 103 void flushRGB() override; 104 105 void filmNegativeProcess(const procparams::FilmNegativeParams ¶ms, std::array<float, 3>& filmBaseValues) override; 106 bool getFilmNegativeExponents(Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams& currentParams, std::array<float, 3>& newExps) override; 107 bool getImageSpotValues(Coord2D spot, int spotSize, int tran, const procparams::FilmNegativeParams ¶ms, std::array<float, 3>& rawValues) override; 108 }; 109 110 } // namespace rtengine 111