AlbumShaper  1.0a3
imageTools.h
Go to the documentation of this file.
1 //==============================================
2 // copyright : (C) 2003-2005 by Will Stokes
3 //==============================================
4 // This program is free software; you can redistribute it
5 // and/or modify it under the terms of the GNU General
6 // Public License as published by the Free Software
7 // Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //==============================================
10 
11 #ifndef BACKEND_TOOLS_IMAGETOOLS_H
12 #define BACKEND_TOOLS_IMAGETOOLS_H
13 
14 //--------------------
15 //forward declarations
16 //--------------------
17 class QString;
18 class QImage;
19 class QPoint;
20 class QSize;
21 #include <qcolor.h>
22 
23 //Transform Codes
24 typedef enum
25 {
26  ROTATE_90, //rotate clockwise 90 degrees
27  ROTATE_270, //rotate counter-clockwise 90 degrees
28  FLIP_H, //flip left-to-right
29  FLIP_V, //flip top-to-bottom
31 
33 bool isJpeg(const char* filename);
34 
37 void calcScaledImageDimensions(int origWidth, int origHeight,
38  int idealWidth, int idealHeight,
39  int& width, int& height);
40 
42 void constructImages(QString imageName,
43  QImage& slideshowImage, QImage& thumbnailImage);
44 
46 bool transformImage( QString fileIn, QString fileOut, TRANSFORM_CODE transformation );
47 
49 bool scaleImage( QString fileIn, QString fileOut,
50  int newWidth, int newHeight );
51 
53 bool scaleImage(QString fileIn, QImage& scaledImage, int targetWidth, int targetHeight);
54 
56 bool getImageSize( const char* filename,QSize& size );
57 
59 bool getImageSize( const char* filename, int& width, int& height );
60 
62 double RGBtoL(QRgb* rgb);
63 
65 void RGBtoHSV( double r, double g, double b,
66  double *h, double *s, double *v );
67 
69 void HSVtoRGB( double *r, double *g, double *b,
70  double h, double s, double v );
71 
72 #endif //BACKEND_TOOLS_IMAGETOOLS_H
TRANSFORM_CODE
Definition: imageTools.h:24
double RGBtoL(QRgb *rgb)
find luminance of a rgb color triplet
Definition: imageTools.cpp:217
long b
Definition: jpegInternal.h:125
void RGBtoHSV(double r, double g, double b, double *h, double *s, double *v)
Convert a RGB color triplet to HSV.
Definition: imageTools.cpp:231
int width
Definition: blur.cpp:79
void HSVtoRGB(double *r, double *g, double *b, double h, double s, double v)
Convert a HSV color triplet to RGB.
Definition: imageTools.cpp:264
void constructImages(QString imageName, QImage &slideshowImage, QImage &thumbnailImage)
Constructs slideshow and thumbnail images for a full sized image.
Definition: imageTools.cpp:69
bool isJpeg(const char *filename)
Checks to see if an image is a valid jpg by seeing if the image dimensions can be read...
Definition: imageTools.cpp:33
void calcScaledImageDimensions(int origWidth, int origHeight, int idealWidth, int idealHeight, int &width, int &height)
Computes scale of image dimensions while respecting aspect ratio, equivalent to a QImage::scaleMin wi...
Definition: imageTools.cpp:39
bool scaleImage(QString fileIn, QString fileOut, int newWidth, int newHeight)
Scale image and save copy to disk.
Definition: imageTools.cpp:157
bool transformImage(QString fileIn, QString fileOut, TRANSFORM_CODE transformation)
Apply image transformation on image.
Definition: imageTools.cpp:112
bool getImageSize(const char *filename, QSize &size)
Get image dimensions.
Definition: imageTools.cpp:192
int height
Definition: blur.cpp:79