20#include "imagepreview.h"
24#include <tqpaintdevice.h>
27TQImage convertImage(
const TQImage& image,
int hue,
int saturation,
int brightness,
int gamma);
29ImagePreview::ImagePreview(TQWidget *parent,
const char *name ) : TQWidget(parent,name) {
36 setBackgroundMode(NoBackground);
39ImagePreview::~ImagePreview(){
42void ImagePreview::setImage(
const TQImage& image){
43 image_ = image.convertDepth(32);
45 resize(image_.size());
49void ImagePreview::setParameters(
int brightness,
int hue,
int saturation,
int gamma){
50 brightness_ = brightness;
52 saturation_ = saturation;
57void 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);
70void ImagePreview::setBlackAndWhite(
bool on){
75TQSize ImagePreview::minimumSizeHint()
const