[Digikam-devel] extragear/graphics/digikam/imageplugins/lensdistortion
Gilles Caulier
caulier.gilles at gmail.com
Thu Jul 5 12:39:55 BST 2007
SVN commit 683857 by cgilles:
digiKam from trunk : complete KDE4 port of LensDistorsion image plugin.
CCMAIL: digikam-devel at kde.org
M +11 -17 CMakeLists.txt
M +31 -34 imageeffect_lensdistortion.cpp
M +1 -3 imageeffect_lensdistortion.h
M +2 -1 imageplugin_lensdistortion.cpp
M +1 -2 imageplugin_lensdistortion.h
M +0 -2 pixelaccess.cpp
--- trunk/extragear/graphics/digikam/imageplugins/lensdistortion/CMakeLists.txt #683856:683857
@@ -1,23 +1,17 @@
-include_directories( ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/editor ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/canvas ${CMAKE_SOURCE_DIR}/digikam/libs/histogram ${CMAKE_SOURCE_DIR}/digikam/libs/levels ${CMAKE_SOURCE_DIR}/digikam/libs/curves ${CMAKE_SOURCE_DIR}/digikam/libs/whitebalance ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/common ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/iccprofiles ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/imageplugins ${CMAKE_SOURCE_DIR}/digikam/libs/dialogs ${CMAKE_SOURCE_DIR}/digikam/libs/dimg ${CMAKE_SOURCE_DIR}/digikam/libs/dmetadata ${CMAKE_SOURCE_DIR}/digikam/libs/dimg/filters ${CMAKE_SOURCE_DIR}/digikam/digikam )
+SET(digikamimageplugin_lensdistortion_PART_SRCS imageplugin_lensdistortion.cpp
+ imageeffect_lensdistortion.cpp
+ lensdistortion.cpp
+ pixelaccess.cpp
+ )
+KDE4_AUTOMOC(${digikamimageplugin_lensdistortion_PART_SRCS})
-########### next target ###############
+KDE4_ADD_PLUGIN(digikamimageplugin_lensdistortion ${digikamimageplugin_lensdistortion_PART_SRCS})
-set(digikamimageplugin_lensdistortion_PART_SRCS imageplugin_lensdistortion.cpp imageeffect_lensdistortion.cpp lensdistortion.cpp pixelaccess.cpp)
+TARGET_LINK_LIBRARIES(digikamimageplugin_lensdistortion digikam)
-kde4_automoc(${digikamimageplugin_lensdistortion_PART_SRCS})
+INSTALL(TARGETS digikamimageplugin_lensdistortion DESTINATION ${PLUGIN_INSTALL_DIR})
-kde4_add_plugin(digikamimageplugin_lensdistortion ${digikamimageplugin_lensdistortion_PART_SRCS})
-
-target_link_libraries(digikamimageplugin_lensdistortion digikam )
-
-install(TARGETS digikamimageplugin_lensdistortion DESTINATION ${PLUGIN_INSTALL_DIR} )
-
-
-########### install files ###############
-
-install( FILES digikamimageplugin_lensdistortion_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam )
-install( FILES digikamimageplugin_lensdistortion.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
-
+INSTALL(FILES digikamimageplugin_lensdistortion_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam)
+INSTALL(FILES digikamimageplugin_lensdistortion.desktop DESTINATION ${SERVICES_INSTALL_DIR})
--- trunk/extragear/graphics/digikam/imageplugins/lensdistortion/imageeffect_lensdistortion.cpp #683856:683857
@@ -30,16 +30,13 @@
// Qt includes.
-#include <qlabel.h>
+#include <QLabel>
+#include <QPixmap>
+#include <QPainter>
+#include <QBrush>
+#include <QPen>
+#include <QGridLayout>
-#include <qlayout.h>
-#include <qpixmap.h>
-#include <qpainter.h>
-#include <qbrush.h>
-#include <qpen.h>
-//Added by qt3to4:
-#include <Q3GridLayout>
-
// KDE includes.
#include <klocale.h>
@@ -94,16 +91,14 @@
setAboutData(about);
// -------------------------------------------------------------
- QWidget *widget = new QWidget(this);
- setMainWidget(widget);
- QWidget *gboxSettings = new QWidget(widget);
- Q3GridLayout* gridSettings = new Q3GridLayout( gboxSettings, 8, 1, spacingHint());
+
+ QWidget *gboxSettings = new QWidget(mainWidget());
+ QGridLayout* gridSettings = new QGridLayout( gboxSettings );
m_maskPreviewLabel = new QLabel( gboxSettings );
m_maskPreviewLabel->setAlignment ( Qt::AlignHCenter | Qt::AlignVCenter );
- m_maskPreviewLabel->setWhatsThis( i18n("<p>You can see here a thumbnail preview of the distortion correction "
- "applied to a cross pattern.") );
- gridSettings->addMultiCellWidget(m_maskPreviewLabel, 0, 0, 0, 1);
+ m_maskPreviewLabel->setWhatsThis( i18n("<p>You can see here a thumbnail preview of the "
+ "distortion correction applied to a cross pattern.") );
// -------------------------------------------------------------
@@ -112,12 +107,10 @@
m_mainInput = new KDoubleNumInput(gboxSettings);
m_mainInput->setPrecision(1);
m_mainInput->setRange(-100.0, 100.0, 0.1, true);
- m_mainInput->setWhatsThis( i18n("<p>This value controls the amount of distortion. Negative values correct lens barrel "
- "distortion, while positive values correct lens pincushion distortion."));
+ m_mainInput->setWhatsThis( i18n("<p>This value controls the amount of distortion. Negative values "
+ "correct lens barrel distortion, while positive values correct lens "
+ "pincushion distortion."));
- gridSettings->addMultiCellWidget(label1, 1, 1, 0, 1);
- gridSettings->addMultiCellWidget(m_mainInput, 2, 2, 0, 1);
-
// -------------------------------------------------------------
QLabel *label2 = new QLabel(i18n("Edge:"), gboxSettings);
@@ -125,12 +118,9 @@
m_edgeInput = new KDoubleNumInput(gboxSettings);
m_edgeInput->setPrecision(1);
m_edgeInput->setRange(-100.0, 100.0, 0.1, true);
- m_edgeInput->setWhatsThis( i18n("<p>This value controls in the same manner as the Main control, but has more effect "
- "at the edges of the image than at the center."));
+ m_edgeInput->setWhatsThis( i18n("<p>This value controls in the same manner as the Main control, "
+ "but has more effect at the edges of the image than at the center."));
- gridSettings->addMultiCellWidget(label2, 3, 3, 0, 1);
- gridSettings->addMultiCellWidget(m_edgeInput, 4, 4, 0, 1);
-
// -------------------------------------------------------------
QLabel *label3 = new QLabel(i18n("Zoom:"), gboxSettings);
@@ -140,9 +130,6 @@
m_rescaleInput->setRange(-100.0, 100.0, 0.1, true);
m_rescaleInput->setWhatsThis( i18n("<p>This value rescales the overall image size."));
- gridSettings->addMultiCellWidget(label3, 5, 5, 0, 1);
- gridSettings->addMultiCellWidget(m_rescaleInput, 6, 6, 0, 1);
-
// -------------------------------------------------------------
QLabel *label4 = new QLabel(i18n("Brighten:"), gboxSettings);
@@ -152,9 +139,20 @@
m_brightenInput->setRange(-100.0, 100.0, 0.1, true);
m_brightenInput->setWhatsThis( i18n("<p>This value adjusts the brightness in image corners."));
+ // -------------------------------------------------------------
+
+ gridSettings->addMultiCellWidget(m_maskPreviewLabel, 0, 0, 0, 1);
+ gridSettings->addMultiCellWidget(label1, 1, 1, 0, 1);
+ gridSettings->addMultiCellWidget(m_mainInput, 2, 2, 0, 1);
+ gridSettings->addMultiCellWidget(label2, 3, 3, 0, 1);
+ gridSettings->addMultiCellWidget(m_edgeInput, 4, 4, 0, 1);
+ gridSettings->addMultiCellWidget(label3, 5, 5, 0, 1);
+ gridSettings->addMultiCellWidget(m_rescaleInput, 6, 6, 0, 1);
gridSettings->addMultiCellWidget(label4, 7, 7, 0, 1);
gridSettings->addMultiCellWidget(m_brightenInput, 8, 8, 0, 1);
-
+ gridSettings->setMargin(spacingHint());
+ gridSettings->setSpacing(spacingHint());
+
setUserAreaWidget(gboxSettings);
// -------------------------------------------------------------
@@ -183,15 +181,15 @@
Longing for Qt4 where we can paint directly on the QImage...
*/
- QImage preview(120, 120, 32);
+ QImage preview(120, 120, QImage::Format_ARGB32);
memset(preview.bits(), 255, preview.numBytes());
- QPixmap pix (preview);
+ QPixmap pix = QPixmap::fromImage(preview);
QPainter pt(&pix);
pt.setPen( QPen(Qt::black, 1) );
pt.fillRect( 0, 0, pix.width(), pix.height(), QBrush(Qt::black, Qt::CrossPattern) );
pt.drawRect( 0, 0, pix.width(), pix.height() );
pt.end();
- QImage preview2(pix.convertToImage());
+ QImage preview2 = pix.toImage();
m_previewRasterImage = Digikam::DImg(preview2.width(), preview2.height(), false, false, preview2.bits());
}
@@ -318,4 +316,3 @@
}
} // NameSpace DigikamLensDistortionImagesPlugin
-
--- trunk/extragear/graphics/digikam/imageplugins/lensdistortion/imageeffect_lensdistortion.h #683856:683857
@@ -27,9 +27,7 @@
// Qt includes.
-#include <qimage.h>
-//Added by qt3to4:
-#include <QLabel>
+#include <QImage>
// Digikam includes.
--- trunk/extragear/graphics/digikam/imageplugins/lensdistortion/imageplugin_lensdistortion.cpp #683856:683857
@@ -45,8 +45,9 @@
{
m_lensdistortionAction = new KAction(KIcon("embosstool"), i18n("Lens Distortion..."), this);
actionCollection()->addAction("imageplugin_lensdistortion", m_lensdistortionAction );
- connect(m_lensdistortionAction, SIGNAL(triggered(bool) ), SLOT(slotLensDistortion()));
+ connect(m_lensdistortionAction, SIGNAL(triggered(bool)),
+ this, SLOT(slotLensDistortion()));
setXMLFile("digikamimageplugin_lensdistortion_ui.rc");
--- trunk/extragear/graphics/digikam/imageplugins/lensdistortion/imageplugin_lensdistortion.h #683856:683857
@@ -37,8 +37,7 @@
public:
- ImagePlugin_LensDistortion(QObject *parent,
- const QStringList &args);
+ ImagePlugin_LensDistortion(QObject *parent, const QStringList &args);
~ImagePlugin_LensDistortion();
void setEnabledActions(bool enable);
--- trunk/extragear/graphics/digikam/imageplugins/lensdistortion/pixelaccess.cpp #683856:683857
@@ -22,7 +22,6 @@
*
* ============================================================ */
-
// C++ include.
#include <cstring>
@@ -312,4 +311,3 @@
}
} // NameSpace DigikamLensDistortionImagesPlugin
-
More information about the Digikam-devel
mailing list