#include <qimage.h>
#include <qstring.h>
#include "crop.h"
Go to the source code of this file.
◆ cropImage()
| QImage * cropImage |
( |
QString | filename, |
|
|
QPoint | topLeft, |
|
|
QPoint | bottomRight ) |
Definition at line 36 of file crop.cpp.
37{
38
39 QImage origImage( filename );
40
41
42 if( origImage.depth() < 32 ) { origImage = origImage.convertDepth( 32, Qt::AutoColor ); }
43
44
47 origImage.depth());
48
49
50 int xOrig, yOrig;
51 int xCropped, yCropped;
52 uchar *origScanLine, *croppedScanLine;
53
55 {
56
57 origScanLine = origImage.scanLine(yOrig);
58 croppedScanLine = croppedImage->scanLine(yCropped);
59
61 {
62
63 *((QRgb*)croppedScanLine+xCropped) = *((QRgb*)origScanLine+xOrig);
64 }
65 }
66
67
68 return croppedImage;
69}
References bottomRight, and topLeft.
Referenced by EditingInterface::crop().