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//--------------------
17class QString;
18class QImage;
19class QPoint;
20class QSize;
21#include <qcolor.h>
22
23//Transform Codes
24typedef 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
33bool isJpeg(const char* filename);
34
37void calcScaledImageDimensions(int origWidth, int origHeight,
38 int idealWidth, int idealHeight,
39 int& width, int& height);
40
42void constructImages(QString imageName,
43 QImage& slideshowImage, QImage& thumbnailImage);
44
46bool transformImage( QString fileIn, QString fileOut, TRANSFORM_CODE transformation );
47
49bool scaleImage( QString fileIn, QString fileOut,
50 int newWidth, int newHeight );
51
53bool scaleImage(QString fileIn, QImage& scaledImage, int targetWidth, int targetHeight);
54
56bool getImageSize( const char* filename,QSize& size );
57
59bool getImageSize( const char* filename, int& width, int& height );
60
62double RGBtoL(QRgb* rgb);
63
65void RGBtoHSV( double r, double g, double b,
66 double *h, double *s, double *v );
67
69void HSVtoRGB( double *r, double *g, double *b,
70 double h, double s, double v );
71
72#endif //BACKEND_TOOLS_IMAGETOOLS_H
int width
Definition blur.cpp:79
int height
Definition blur.cpp:79
bool scaleImage(QString fileIn, QString fileOut, int newWidth, int newHeight)
Scale image and save copy to disk.
void constructImages(QString imageName, QImage &slideshowImage, QImage &thumbnailImage)
Constructs slideshow and thumbnail images for a full sized image.
bool getImageSize(const char *filename, QSize &size)
Get image dimensions.
void RGBtoHSV(double r, double g, double b, double *h, double *s, double *v)
Convert a RGB color triplet to HSV.
double RGBtoL(QRgb *rgb)
find luminance of a rgb color triplet
void HSVtoRGB(double *r, double *g, double *b, double h, double s, double v)
Convert a HSV color triplet to RGB.
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...
bool transformImage(QString fileIn, QString fileOut, TRANSFORM_CODE transformation)
Apply image transformation on image
TRANSFORM_CODE
Definition imageTools.h:25
@ FLIP_V
Definition imageTools.h:29
@ ROTATE_270
Definition imageTools.h:27
@ ROTATE_90
Definition imageTools.h:26
@ FLIP_H
Definition imageTools.h:28
bool isJpeg(const char *filename)
Checks to see if an image is a valid jpg by seeing if the image dimensions can be read.
long b