AlbumShaper  1.0a3
grainEditor.h
Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003-2005 by Will Stokes
00003 //==============================================
00004 //  This program is free software; you can redistribute it
00005 //  and/or modify it under the terms of the GNU General
00006 //  Public License as published by the Free Software
00007 //  Foundation; either version 2 of the License, or
00008 //  (at your option) any later version.
00009 //==============================================
00010 
00011 #ifndef GUI_EDITING_GRAINEDITOR_H
00012 #define GUI_EDITING_GRAINEDITOR_H
00013 
00014 //--------------------
00015 //forward declarations
00016 class BlurSharpenSlider;
00017 class PanningPreviewInterface;
00018 class SelectionPlacementInterface;
00019 //--------------------
00020 class QComboBox;
00021 class QFrame;
00022 class ClickableLabel;
00023 
00024 #include <qdialog.h>
00025 #include <qimage.h>
00026 
00027 //=====================================
00029 //=====================================
00030 
00031 class GrainEditor : public QDialog
00032 {
00033 Q_OBJECT
00034 
00035 public:
00037   GrainEditor(QString filename,
00038                   QWidget *parent=0, const char* name=0);
00039 
00040   ~GrainEditor();
00041   
00043   QImage* getModifiedImage();
00044   //----------------------
00045 protected:
00046   void keyPressEvent(QKeyEvent *e);
00047   void keyReleaseEvent(QKeyEvent *e);
00048   //----------------------
00049 private slots:
00051   void selectPreviewImageType(int selection);
00052 
00054   void resetBoundaries();
00055 
00057   void resetRegions();
00058 
00060   //accepts changes, otherwise calls reject
00061   void applyAction();  
00062 
00064   void resetAction();
00065 
00067   void previewResized();
00068 
00070   void generateAdjustedPreviewImage();
00071   
00072   //----------------------
00073 private:
00074   //adjust image using current blur/sharpen setting
00075   void adjustImage( QImage& image, QPoint offset );
00076     
00077   //original image filename
00078   QString fileName;
00079   
00080   //original image size
00081   QSize origImageSize;
00082   
00083   //Edges image
00084   QImage edgesImage;
00085   
00086   //Cluster map - each pixel assigned an int for the cluster it belongs to
00087   int* clusterMap;
00088   int numRegions;
00089   
00091   PanningPreviewInterface* previewInterface;
00092       
00094   SelectionPlacementInterface* selectionPlacementInterface;
00095   
00096   QComboBox* previewSelection;
00097   QFrame* buttonsFrame;  
00098   
00100   BlurSharpenSlider* boundariesSlider;
00101   ClickableLabel* boundariesIcon;
00102 
00103   BlurSharpenSlider* regionsSlider;
00104   ClickableLabel* regionsIcon;
00105 };
00106 //======================
00107 
00108 #endif //GUI_EDITING_GRAINEDITOR_H