File indexing completed on 2024-05-26 04:24:44
0001 /* 0002 Copyright (c) 2003-2007 Clarence Dang <dang@kde.org> 0003 All rights reserved. 0004 0005 Redistribution and use in source and binary forms, with or without 0006 modification, are permitted provided that the following conditions 0007 are met: 0008 0009 1. Redistributions of source code must retain the above copyright 0010 notice, this list of conditions and the following disclaimer. 0011 2. Redistributions in binary form must reproduce the above copyright 0012 notice, this list of conditions and the following disclaimer in the 0013 documentation and/or other materials provided with the distribution. 0014 0015 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 0016 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0017 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 0018 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 0019 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 0020 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0021 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0022 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0023 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 0024 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0025 */ 0026 0027 0028 #ifndef kpTransformSkewDialog_H 0029 #define kpTransformSkewDialog_H 0030 0031 #include "kpTransformPreviewDialog.h" 0032 #include "imagelib/kpColor.h" 0033 0034 class QSpinBox; 0035 0036 0037 class kpTransformSkewDialog : public kpTransformPreviewDialog 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 kpTransformSkewDialog (bool actOnSelection, 0043 kpTransformDialogEnvironment *_env, QWidget *parent); 0044 ~kpTransformSkewDialog () override; 0045 0046 private: 0047 static int s_lastWidth, s_lastHeight; 0048 static int s_lastHorizontalAngle, s_lastVerticalAngle; 0049 0050 void createAngleGroupBox (); 0051 0052 QSize newDimensions () const override; 0053 QImage transformPixmap (const QImage &image, 0054 int targetWidth, int targetHeight) const override; 0055 0056 void updateLastAngles (); 0057 0058 private Q_SLOTS: 0059 void slotUpdate () override; 0060 0061 public: 0062 // These are the angles the users sees in the dialog and... 0063 int horizontalAngle () const; 0064 int verticalAngle () const; 0065 0066 // ...these functions translate them for use in kpPixmapFX::skew(). 0067 static int horizontalAngleForPixmapFX (int hangle); 0068 static int verticalAngleForPixmapFX (int vangle); 0069 0070 int horizontalAngleForPixmapFX () const; 0071 int verticalAngleForPixmapFX () const; 0072 0073 bool isNoOp () const override; 0074 0075 private Q_SLOTS: 0076 void accept () override; 0077 0078 private: 0079 QSpinBox *m_horizontalSkewInput, *m_verticalSkewInput; 0080 }; 0081 0082 0083 #endif // kpTransformSkewDialog_H