20 #include "imagepreview.h"
22 #include <tqpainter.h>
24 #include <tqpaintdevice.h>
27 TQImage convertImage(
const TQImage& image,
int hue,
int saturation,
int brightness,
int gamma);
29 ImagePreview::ImagePreview(TQWidget *parent,
const char *name ) : TQWidget(parent,name) {
36 setBackgroundMode(NoBackground);
39 ImagePreview::~ImagePreview(){
42 void ImagePreview::setImage(
const TQImage& image){
43 image_ = image.convertDepth(32);
45 resize(image_.size());
49 void ImagePreview::setParameters(
int brightness,
int hue,
int saturation,
int gamma){
50 brightness_ = brightness;
52 saturation_ = saturation;
57 void ImagePreview::paintEvent(TQPaintEvent*){
58 TQImage tmpImage = convertImage(image_,hue_,(bw_ ? 0 : saturation_),brightness_,gamma_);
59 int x = (width()-tmpImage.width())/2, y = (height()-tmpImage.height())/2;
61 TQPixmap buffer(width(), height());
62 buffer.fill(parentWidget(), 0, 0);
64 p.drawImage(x,y,tmpImage);
67 bitBlt(
this, TQPoint(0, 0), &buffer, buffer.rect(), TQt::CopyROP);
70 void ImagePreview::setBlackAndWhite(
bool on){
75 TQSize ImagePreview::minimumSizeHint()
const