#include <panningPreviewInterface.h>
Inheritance diagram for PanningPreviewInterface:


Public Slots | |
| void | setSelection (QRect selection) |
Signals | |
| void | selectionChanged () |
Public Member Functions | |
| PanningPreviewInterface (QString imageFilename, QWidget *parent=0, const char *name=0) | |
| Creates layout. | |
| virtual QSize | sizeHint () const |
| QRect | getSelection () |
| QSize | paintingSize () |
Protected Member Functions | |
| void | resizeEvent (QResizeEvent *) |
Private Member Functions | |
| void | generateOrigImage () |
Private Attributes | |
| QImage | fullSizeImage |
| Full size image. | |
| QRect | selection |
| Current selection. | |
|
||||||||||||||||
|
Creates layout.
Definition at line 15 of file panningPreviewInterface.cpp. References fullSizeImage, and selection. 00016 : 00017 SplitViewInterface (parent, name ) 00018 { 00019 //load full size image 00020 fullSizeImage = QImage( imageFilename ); 00021 00022 //a 0-width selection is invalid and prevents 00023 //resize events from triggering painting 00024 //until the true selection region is set 00025 selection.setWidth( 0 ); 00026 }
|
|
|
Definition at line 105 of file panningPreviewInterface.cpp. References fullSizeImage, selection, selectionChanged(), and SplitViewInterface::setImages(). Referenced by setSelection(). 00106 {
00107 //generate orig image
00108 //set adjusted image to null so repain won't occur until it is reset
00109 setImages( fullSizeImage.copy( selection.left(), selection.top(),
00110 selection.width(), selection.height() ),
00111 QImage() );
00112
00113 //emit signal indicating adjusted image is out of date
00114 emit selectionChanged();
00115 }
|
|
|
Definition at line 117 of file panningPreviewInterface.cpp. Referenced by GrainEditor::generateAdjustedPreviewImage(), and GrainEditor::previewResized(). 00118 { return selection; }
|
|
|
Definition at line 34 of file panningPreviewInterface.cpp. References fullSizeImage. Referenced by resizeEvent(), and setSelection(). 00035 {
00036 return QSize( QMIN( fullSizeImage.width(), size().width() ),
00037 QMIN( fullSizeImage.height(), size().height() ) );
00038 }
|
|
|
Implements SplitViewInterface. Definition at line 40 of file panningPreviewInterface.cpp. References fullSizeImage, paintingSize(), selection, and setSelection(). 00041 {
00042 //center of new selection...
00043 QPoint center;
00044
00045 //if selection not set then default to center of image
00046 if( selection.width() == 0)
00047 {
00048 //compute center selection center
00049 center = QPoint( fullSizeImage.width() / 2,
00050 fullSizeImage.height() / 2 );
00051 }
00052 //else construct new selection that is centered over old selection
00053 else
00054 {
00055 //compute center selection center
00056 center = QPoint( selection.left() + selection.width()/2,
00057 selection.top() + selection.height()/2 );
00058 }
00059
00060 //determine width/height that will be used for painting
00061 QSize actualSize = paintingSize();
00062
00063 //compute new selection area centerd over old selection region
00064 QRect newSelection;
00065 newSelection.setLeft( center.x() - actualSize.width() /2 );
00066 newSelection.setTop ( center.y() - actualSize.height()/2 );
00067 newSelection.setRight( newSelection.left() + actualSize.width() - 1 );
00068 newSelection.setBottom( newSelection.top() + actualSize.height() - 1 );
00069
00070 //set selection which will result in regenerating of orig and adjusted images
00071 setSelection( newSelection );
00072 }
|
|
|
Referenced by generateOrigImage(). |
|
|
Definition at line 74 of file panningPreviewInterface.cpp. References fullSizeImage, generateOrigImage(), paintingSize(), and selection. Referenced by resizeEvent(). 00075 {
00076 //set the selection
00077 selection = s;
00078
00079 //get the available painting size
00080 QSize actualSize = paintingSize();
00081
00082 //if too wide or tall shrink selection
00083 if( selection.width() > actualSize.width() )
00084 selection.setRight( selection.left() + actualSize.width() - 1 );
00085 if( selection.height() > actualSize.height() )
00086 selection.setBottom( selection.top() + actualSize.height() - 1 );
00087
00088 //shift selection area if it extends beyond image boundary
00089 if( selection.left() < 0 )
00090 selection.moveBy( -selection.left(), 0 );
00091
00092 if( selection.top() < 0 )
00093 selection.moveBy( 0, -selection.top() );
00094
00095 if( selection.right() > fullSizeImage.width()-1 )
00096 selection.moveBy( (fullSizeImage.width()-1) - selection.right(), 0 );
00097
00098 if( selection.bottom() > fullSizeImage.height()-1 )
00099 selection.moveBy( 0, (fullSizeImage.height()-1) - selection.bottom() );
00100
00101 //regenerate orig and adjusted images
00102 generateOrigImage();
00103 }
|
|
|
Implements SplitViewInterface. Definition at line 28 of file panningPreviewInterface.cpp. 00029 {
00030 //subjetively chosen default size :)
00031 return QSize( 500, 400 );
00032 }
|
|
|
Full size image.
Definition at line 46 of file panningPreviewInterface.h. Referenced by generateOrigImage(), paintingSize(), PanningPreviewInterface(), resizeEvent(), and setSelection(). |
|
|
Current selection.
Definition at line 49 of file panningPreviewInterface.h. Referenced by generateOrigImage(), PanningPreviewInterface(), resizeEvent(), and setSelection(). |
1.3.9.1