1 /*************************************************************************** 2 3 copyright : (C) 2007 by mean 4 email : fixounet@free.fr 5 ***************************************************************************/ 6 7 /*************************************************************************** 8 * * 9 * This program is free software; you can redistribute it and/or modify * 10 * it under the terms of the GNU General Public License as published by * 11 * the Free Software Foundation; either version 2 of the License, or * 12 * (at your option) any later version. * 13 * * 14 ***************************************************************************/ 15 #ifndef ADM_COLORSPACE_H 16 #define ADM_COLORSPACE_H 17 18 #include "ADM_coreImage6_export.h" 19 #include "ADM_rgb.h" // To have colors 20 21 class ADMImage; 22 typedef enum 23 { 24 ADM_CS_BILINEAR, 25 ADM_CS_BICUBIC, 26 ADM_CS_LANCZOS, 27 ADM_CS_BICUBLIN, 28 ADM_CS_GAUSS, 29 ADM_CS_SINC, 30 ADM_CS_SPLINE, 31 ADM_CS_FAST_BILINEAR 32 }ADMColorScaler_algo; 33 /** 34 \class ADMColorScaler 35 */ 36 class ADM_COREIMAGE6_EXPORT ADMColorScalerFull 37 { 38 protected: 39 void *context; 40 uint32_t srcWidth,srcHeight; 41 uint32_t dstWidth,dstHeight; 42 ADM_colorspace fromColor,toColor; 43 ADMColorScaler_algo algo; 44 uint8_t getStrideAndPointers(bool dst,uint8_t *from,ADM_colorspace fromColor, 45 uint8_t **srcData,int *srcStride); 46 public : 47 48 ADMColorScalerFull(ADMColorScaler_algo algo, int sw, int sh, int dw,int dh,ADM_colorspace from,ADM_colorspace to); 49 bool reset(ADMColorScaler_algo, int sw, int sh, int dw,int dh,ADM_colorspace from,ADM_colorspace to); 50 51 52 bool convert(uint8_t *from, uint8_t *to); 53 bool convertImage(ADMImage *img, uint8_t *to); 54 bool convertImage(ADMImage *sourceImage, ADMImage *destImage); 55 bool convertPlanes(int sourceStride[3],int destStride[3], 56 uint8_t *sourceData[3], uint8_t *destData[3]); 57 ~ADMColorScalerFull(); 58 }; 59 /** 60 \class ADMColorScalerSimple 61 \brief Same as Full but target & source width/height are the same 62 */ 63 class ADMColorScalerSimple :public ADMColorScalerFull 64 { 65 public: 66 bool changeWidthHeight(int newWidth, int newHeight); 67 ADMColorScalerSimple( int width, int height, ADM_colorspace from,ADM_colorspace to,ADMColorScaler_algo algo=ADM_CS_BICUBIC): ADMColorScalerFull(algo,width,height,width,height,from,to)68 ADMColorScalerFull(algo, width, height, width,height, from, to) 69 { 70 71 } 72 73 }; 74 75 #endif 76 //EOF 77 78