Commit 7dff1084 authored by Halla Rempt's avatar Halla Rempt

* Added a image properties dialog

* Fixed some crashes in convolution filters
* Fixed bug in new create image dialog.

svn path=/trunk/koffice/; revision=369524
parent 1126b111
......@@ -94,7 +94,7 @@ User Interface
* Create templates for often-used image formats. Add save-as-template
* Check OASIS file saving.
* Fix gimp XCF import/export (ImageMagick hacking...)
* Fix imports to import metadata and image files in non-rgb encodings.
Profiles
......
......@@ -337,7 +337,6 @@ KisDoc::KisDoc(QWidget *parentWidget, const char *widgetName, QObject *parent, c
super(parentWidget, widgetName, parent, name, singleViewMode),
m_pixmap(RENDER_WIDTH, RENDER_HEIGHT)
{
// kdDebug() << "KisDoc created for " << widgetName << "\n";
m_undo = false;
m_dcop = 0;
......@@ -351,6 +350,10 @@ KisDoc::KisDoc(QWidget *parentWidget, const char *widgetName, QObject *parent, c
if (name)
dcopObject();
connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
this, SLOT( clipboardDataChanged() ) );
}
KisDoc::~KisDoc()
......@@ -375,7 +378,6 @@ DCOPObject *KisDoc::dcopObject()
bool KisDoc::initDoc(InitDocFlags flags, QWidget* parentWidget)
{
// kdDebug() << "KisDoc::initDoc\n";
if (!init())
return false;
......@@ -435,7 +437,6 @@ bool KisDoc::initDoc(InitDocFlags flags, QWidget* parentWidget)
bool KisDoc::init()
{
// kdDebug() << "KisDoc::init\n";
if (m_cmdHistory) {
delete m_cmdHistory;
m_cmdHistory = 0;
......@@ -516,7 +517,6 @@ bool KisDoc::loadXML(QIODevice *, const QDomDocument& doc)
m_images.push_back(img);
} else {
// kdDebug(DBG_AREA_CORE) << "KisDoc::loadXML nodeName == " << node.nodeName() << endl;
return false;
}
}
......@@ -536,10 +536,9 @@ QDomElement KisDoc::saveImage(QDomDocument& doc, KisImageSP img)
image.setAttribute("width", img -> width());
image.setAttribute("height", img -> height());
image.setAttribute("colorspacename", img -> colorStrategy() -> name());
kdDebug() << "Saving image with description " << img -> description() << "\n";
image.setAttribute("description", img -> description());
// XXX: Save profile as blob inside the image, instead of the product name.
if (img -> profile() -> valid())
if (img -> profile() && img -> profile()-> valid())
image.setAttribute("profile", img -> profile() -> productName());
image.setAttribute("x-res", img -> xRes());
image.setAttribute("y-res", img -> yRes());
......@@ -610,17 +609,17 @@ KisImageSP KisDoc::loadImage(const QDomElement& element)
yres = 100.0;
if ((profileProductName = element.attribute("profile")).isNull()) {
profile = new KisProfile();
profile = 0;
}
else {
QPtrList<KisResource> resourceslist = KisFactory::rServer() -> profiles();
KisResource * resource;
for ( resource = resourceslist.first(); resource; resource = resourceslist.next() ) {
Q_ASSERT(dynamic_cast<KisProfile*>(resource));
profile = static_cast<KisProfile*>(resource);
if (profile -> productName() == profileProductName)
vKisProfileSP profileList = KisFactory::rServer() -> profiles();
vKisProfileSP::iterator it;
for ( it = profileList.begin(); it != profileList.end(); ++it ) {
if ((*it) -> productName() == profileProductName) {
profile = (*it);
break;
profile = new KisProfile(); // Create invalid default profile.
}
}
}
......@@ -631,7 +630,6 @@ KisImageSP KisDoc::loadImage(const QDomElement& element)
if ((attr = element.attribute("colorspace")).isNull())
return 0;
colorspace_int = attr.toInt();
// kdDebug() << "colorspace_int = " << colorspace_int << endl;
if( colorspace_int <= IMAGE_TYPE_UNKNOWN || colorspace_int > IMAGE_TYPE_YUVA)
return 0;
switch(colorspace_int)
......@@ -676,8 +674,6 @@ KisImageSP KisDoc::loadImage(const QDomElement& element)
} else if (node.nodeName() == "COLORMAP") {
// TODO
} //else {
// kdDebug(DBG_AREA_CORE) << "KisDoc::loadImage nodeName == " << node.nodeName() << endl;
// }
}
}
} else {
......@@ -1042,11 +1038,6 @@ KoView* KisDoc::createViewInstance(QWidget* parent, const char *name)
void KisDoc::paintContent(QPainter& painter, const QRect& rect)
{
// kdDebug() << "KisDoc::paintContent called with rect: "
// << rect.x() << ","
// << rect.y() << ","
// << rect.right() << ","
// << rect.bottom() << "\n";
Q_INT32 x;
Q_INT32 y;
Q_INT32 x1;
......
......@@ -42,6 +42,7 @@ KisFactory::KisFactory( QObject* parent, const char* name )
(void)global();
s_rserver = new KisResourceServer;
// Initially load the profiles
s_rserver -> profiles();
}
......
......@@ -95,9 +95,13 @@ inline KisView* KisFilter::view()
inline KisStrategyColorSpaceSP KisFilter::colorStrategy()
{
// XXX: is this wise? Isn't it better to check whether view, image
// and layer aren't empty? BSAR.
return m_view -> currentImg() -> activeLayer() -> colorStrategy();
KisImageSP img = m_view -> currentImg();
if (!img) return 0;
KisLayerSP layer = img -> activeLayer();
if (!layer) return 0;
return layer -> colorStrategy();
}
inline void KisFilter::process(KisPaintDeviceSP dev, KisFilterConfiguration* config, const QRect& rect, KisTileCommand* ktc)
......
......@@ -178,6 +178,7 @@ KisImage::KisImage(KisUndoAdapter *undoAdapter, Q_INT32 width, Q_INT32 height,
setName(name);
startUpdateTimer();
m_dcop = 0L;
m_profile = 0;
}
KisImage::KisImage(const KisImage& rhs) : QObject(), KisRenderInterface(rhs)
......@@ -201,7 +202,7 @@ KisImage::KisImage(const KisImage& rhs) : QObject(), KisRenderInterface(rhs)
m_clrMap = rhs.m_clrMap;
m_dirty = rhs.m_dirty;
m_adapter = rhs.m_adapter;
m_profile = rhs.m_profile;
if (rhs.m_shadow)
m_shadow = new KisTileMgr(*rhs.m_shadow);
......@@ -489,8 +490,14 @@ KisProfileSP KisImage::profile() const
void KisImage::setProfile(const KisProfileSP& profile)
{
if (profile -> valid())
if (profile && profile -> valid()) {
kdDebug() << "KisImage::setProfile: " << profile -> productName() << "\n";
m_profile = profile;
}
else {
kdDebug() << "KisImage::setProfile: empty profile\n";
m_profile = 0;
}
}
KURL KisImage::uri() const
......
......@@ -393,6 +393,7 @@ void KisSelectionManager::unSelectAll()
}
void KisSelectionManager::clear()
{
KisImageSP img = m_parent -> currentImg();
......@@ -424,11 +425,12 @@ void KisSelectionManager::clear()
// XXX: make undoable
KisPainter p(img -> activeDevice());
p.bitBlt(r.x(), r.y(),
COMPOSITE_COPY_OPACITY, // XXX: Is a mere copy of transparency correct?
selection.data(),
r.x(), r.y(),
r.width(), r.height());
p.bitBlt(r.x(), r.y(),
COMPOSITE_OVER, //_OPACITY, // XXX: Is a mere copy of transparency correct?
selection.data(),
r.x(), r.y(),
r.width(), r.height());
p.end();
layer -> removeSelection();
......
......@@ -124,6 +124,7 @@ typedef KSharedPtr<KisFilterRegistry> KisFilterRegistrySP;
class KisProfile;
typedef KSharedPtr<KisProfile> KisProfileSP;
typedef KisSharedPtrVector<KisProfile> vKisProfileSP;
class KisChannelInfo;
typedef KSharedPtr<KisChannelInfo> KisChannelInfoSP;
......
......@@ -124,6 +124,7 @@
#include "kis_dlg_paint_properties.h"
#include "kis_dlg_transform.h"
#include "kis_dlg_preferences.h"
#include "kis_dlg_image_properties.h"
// Action managers
#include "kis_selection_manager.h"
......@@ -170,7 +171,7 @@ KisView::KisView(KisDoc *doc, KisUndoAdapter *adapter, QWidget *parent, const ch
m_layerSaveAs = 0;
m_layerResizeToImage = 0;
m_layerToImage = 0;
m_layerTransform = 0;
// m_layerTransform = 0;
m_layerRaise = 0;
m_layerLower = 0;
m_layerTop = 0;
......@@ -596,6 +597,7 @@ void KisView::setupActions()
// import/export actions
m_imgImport = new KAction(i18n("Import Image..."), "wizard", 0, this, SLOT(slotImportImage()), actionCollection(), "import_image");
m_imgExport = new KAction(i18n("Export Image..."), "wizard", 0, this, SLOT(export_image()), actionCollection(), "export_image");
m_imgProperties = new KAction(i18n("Image properties..."), 0, this, SLOT(slotImageProperties()), actionCollection(), "img_properties");
m_imgScan = 0; // How the hell do I get a KAction to the scan plug-in?!?
m_imgResizeToLayer = new KAction(i18n("Resize Image to Current Layer"), 0, this, SLOT(imgResizeToActiveLayer()), actionCollection(), "resizeimgtolayer");
// view actions
......@@ -622,7 +624,7 @@ void KisView::setupActions()
m_layerToImage = new KAction(i18n("Layer to Image"), 0, this, SLOT(layerToImage()), actionCollection(), "layer_to_image");
// layer transformations
m_layerTransform = new KAction(i18n("Scale Layer..."), 0, this, SLOT(layerTransform()), actionCollection(), "transformlayer");
// m_layerTransform = new KAction(i18n("Scale Layer..."), 0, this, SLOT(layerTransform()), actionCollection(), "transformlayer");
(void)new KAction(i18n("Rotate &180"), 0, this, SLOT(rotateLayer180()), actionCollection(), "rotateLayer180");
(void)new KAction(i18n("Rotate &270"), 0, this, SLOT(rotateLayerLeft90()), actionCollection(), "rotateLayerLeft90");
(void)new KAction(i18n("Rotate &90"), 0, this, SLOT(rotateLayerRight90()), actionCollection(), "rotateLayerRight90");
......@@ -1050,7 +1052,7 @@ void KisView::layerUpdateGUI(bool enable)
m_layerSaveAs -> setEnabled(enable);
m_layerResizeToImage -> setEnabled(enable);
m_layerToImage -> setEnabled(enable);
m_layerTransform -> setEnabled(enable);
// m_layerTransform -> setEnabled(enable);
m_layerRaise -> setEnabled(enable && nlayers > 1 && layerPos);
m_layerLower -> setEnabled(enable && nlayers > 1 && layerPos != nlayers - 1);
m_layerTop -> setEnabled(enable && nlayers > 1 && layerPos);
......@@ -1371,6 +1373,18 @@ void KisView::export_image()
}
}
void KisView::slotImageProperties()
{
KisImageSP img = currentImg();
if (!img) return;
KisDlgImageProperties * dlg = new KisDlgImageProperties(img, this);
dlg -> exec();
delete dlg;
}
void KisView::slotInsertImageAsLayer()
{
if (importImage(true) > 0)
......
......@@ -168,8 +168,10 @@ public slots:
void previous_layer();
// image action slots
// XXX: Rename to make all names consistent with slotDoX() pattern
void slotImportImage();
void export_image();
void slotImageProperties();
void imgResizeToActiveLayer();
void add_new_image_tab();
void remove_current_image_tab();
......@@ -397,10 +399,11 @@ private:
KAction *m_layerSaveAs;
KAction *m_layerToImage;
KAction *m_layerTop;
KAction *m_layerTransform;
// KAction *m_layerTransform;
KAction *m_zoomIn;
KAction *m_zoomOut;
KAction *m_fullScreen;
KAction *m_imgProperties;
KToggleAction *m_RulerAction;
DCOPObject *m_dcop;
......
......@@ -52,9 +52,10 @@ bool KisProfile::loadAsync()
{
cmsErrorAction(LCMS_ERROR_IGNORE);
m_profile = cmsOpenProfileFromFile(filename().ascii(), "r");
// kdDebug() << "loading profile: " << filename() << "\n";
kdDebug() << "loading profile: " << filename() << "\n";
if (m_profile) {
m_colorSpace = cmsGetColorSpace(m_profile);
// kdDebug() << "\tColorspace: " << m_colorSpace << "\n";
......
......@@ -36,7 +36,6 @@ KisResourceServer::KisResourceServer()
m_pipebrushes.setAutoDelete(true);
m_patterns.setAutoDelete(true);
m_gradients.setAutoDelete(true);
m_profiles.setAutoDelete(true);
loadBrushes();
loadpipeBrushes();
......@@ -51,7 +50,6 @@ KisResourceServer::~KisResourceServer()
m_pipebrushes.clear();
m_patterns.clear();
m_gradients.clear();
// m_profiles.clear(); // Profiles are encapsulated in shared pointers
}
......@@ -224,13 +222,15 @@ void KisResourceServer::gradientLoaded(KisResource *gradient)
}
void KisResourceServer::profileLoaded(KisResource *profile)
void KisResourceServer::profileLoaded(KisResource *resource)
{
if (profile && profile -> valid()) {
m_profiles.append(profile);
emit loadedProfile(profile);
if (resource && resource -> valid()) {
KisProfile * p = static_cast<KisProfile*>(resource);
m_profiles.push_back(p);
emit loadedProfile(p);
kdDebug() << "Profiles loaded; " << m_profiles.count() << "\n";
} else {
delete profile;
delete resource;
}
loadProfile();
......@@ -301,10 +301,10 @@ QPtrList<KisResource> KisResourceServer::gradients()
}
QPtrList<KisResource> KisResourceServer::profiles()
vKisProfileSP KisResourceServer::profiles()
{
kdDebug()<< "Call to profiles\n";
if (m_profiles.isEmpty())
if (m_profiles.empty())
loadProfiles();
......
......@@ -31,6 +31,7 @@
#include "kis_pattern.h"
#include "kis_gradient.h"
#include "kis_profile.h"
#include "kis_types.h"
// XXX: Encapsulate resources in shared pointers.
class KisResourceServer : public QObject {
......@@ -61,7 +62,9 @@ public:
QPtrList<KisResource> pipebrushes();
QPtrList<KisResource> patterns();
QPtrList<KisResource> gradients();
QPtrList<KisResource> profiles();
// Profiles do not carry view-specified data, they can safely be shared,
// and will never be changed.
vKisProfileSP profiles();
signals:
......@@ -69,7 +72,7 @@ signals:
void loadedpipeBrush(KisResource *br);
void loadedPattern(KisResource *pat);
void loadedGradient(KisResource *pat);
void loadedProfile(KisResource *profile);
void loadedProfile(KisProfile *profile);
private:
......@@ -111,7 +114,7 @@ private:
QPtrList<KisResource> m_gradients;
QStringList m_gradientFilenames;
QPtrList<KisResource> m_profiles;
vKisProfileSP m_profiles;
QStringList m_profileFilenames;
};
......
......@@ -38,6 +38,7 @@
<Menu name="Image"><text>&amp;Image</text>
<Menu name="Mode"><text>&amp;Mode</text>
<Action name="img_properties"/>
</Menu>
<Separator/>
......
......@@ -87,7 +87,7 @@ void ColorspaceConversion::slotImgColorspaceConversion()
if (!image) return;
DlgColorspaceConversion * dlgColorspaceConversion = new DlgColorspaceConversion(m_view, "ColorspaceConversion");
dlgColorspaceConversion -> setCaption(i18n("Convert all layers"));
dlgColorspaceConversion -> setCaption(i18n("Convert all layers from ") + image -> colorStrategy() -> name());
dlgColorspaceConversion -> m_page -> chkAlpha -> setChecked(image -> alpha());
if (dlgColorspaceConversion -> exec() == QDialog::Accepted) {
......@@ -106,7 +106,7 @@ void ColorspaceConversion::slotLayerColorspaceConversion()
if (!dev) return;
DlgColorspaceConversion * dlgColorspaceConversion = new DlgColorspaceConversion(m_view, "ColorspaceConversion");
dlgColorspaceConversion -> setCaption(i18n("Convert current layer"));
dlgColorspaceConversion -> setCaption(i18n("Convert current layer from") + dev -> colorStrategy() -> name());
dlgColorspaceConversion -> m_page -> chkAlpha -> setChecked(dev -> alpha());
if (dlgColorspaceConversion -> exec() == QDialog::Accepted) {
......
/*
/*
* dlg_colorspaceconversion.cc - part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
......@@ -46,16 +46,11 @@ DlgColorspaceConversion::DlgColorspaceConversion( QWidget * parent,
m_page -> cmbColorSpaces -> insertStringList(KisColorSpaceRegistry::instance() -> listColorSpaceNames());
QPtrList<KisResource> resourceslist = KisFactory::rServer() -> profiles();
KisResource * resource;
KisProfile * profile;
for ( resource = resourceslist.first(); resource; resource = resourceslist.next() ) {
kdDebug() << "Adding profile: " << resource -> filename() << "\n";
Q_ASSERT(dynamic_cast<KisProfile*>(resource));
profile = static_cast<KisProfile*>(resource);
m_page -> cmbSourceProfile -> insertItem(profile -> productName());
m_page -> cmbDestProfile -> insertItem(profile -> productName());
vKisProfileSP profileList = KisFactory::rServer() -> profiles();
vKisProfileSP::iterator it;
for ( it = profileList.begin(); it != profileList.end(); ++it ) {
m_page -> cmbSourceProfile -> insertItem((*it) -> productName());
m_page -> cmbDestProfile -> insertItem((*it) -> productName());
}
// XXX: Until we have implemented high bit depth images
m_page -> cmbDepth -> setEnabled(false);
......
......@@ -134,6 +134,8 @@ KisGaussianBlurFilter::KisGaussianBlurFilter(KisView * view) : KisConvolutionCon
KisSharpenFilter::KisSharpenFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { 0, -2, 0 }, { -2, 11, -2 }, { 0, -2, 0} };
......@@ -147,6 +149,8 @@ KisSharpenFilter::KisSharpenFilter(KisView * view) : KisConvolutionConstFilter(n
KisMeanRemovalFilter::KisMeanRemovalFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { -1, -1, -1 }, { -1, 9, -1 }, { -1, -1, -1} };
......@@ -160,6 +164,8 @@ KisMeanRemovalFilter::KisMeanRemovalFilter(KisView * view) : KisConvolutionConst
KisEmbossLaplascianFilter::KisEmbossLaplascianFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { -1, 0, -1 }, { 0, 4, 0 }, { -1, 0, -1} };
......@@ -174,6 +180,8 @@ KisEmbossLaplascianFilter::KisEmbossLaplascianFilter(KisView * view) : KisConvol
KisEmbossInAllDirectionsFilter::KisEmbossInAllDirectionsFilter(KisView * view)
: KisConvolutionConstFilter(name(), view)
{
if(!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { -1, -1, -1 }, { -1, 8, -1 }, { -1, -1, -1} };
......@@ -188,6 +196,8 @@ KisEmbossInAllDirectionsFilter::KisEmbossInAllDirectionsFilter(KisView * view)
KisEmbossHorizontalVerticalFilter::KisEmbossHorizontalVerticalFilter(KisView * view)
: KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { 0, -1, 0 }, { -1, 4, -1 }, { 0, -1, 0} };
......@@ -201,6 +211,8 @@ KisEmbossHorizontalVerticalFilter::KisEmbossHorizontalVerticalFilter(KisView * v
KisEmbossVerticalFilter::KisEmbossVerticalFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { 0, -1, 0 }, { 0, 2, 0 }, { 0, -1, 0} };
......@@ -215,6 +227,8 @@ KisEmbossVerticalFilter::KisEmbossVerticalFilter(KisView * view) : KisConvolutio
KisEmbossHorizontalFilter::KisEmbossHorizontalFilter(KisView * view) :
KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { 0, 0, 0 }, { -1, 4, -1 }, { 0, 0, 0} };
......@@ -229,6 +243,8 @@ KisEmbossHorizontalFilter::KisEmbossHorizontalFilter(KisView * view) :
KisEmbossDiagonalFilter::KisEmbossDiagonalFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { -1, 0, -1 }, { 0, 4, 0 }, { -1, 0, -1} };
......@@ -243,6 +259,8 @@ KisEmbossDiagonalFilter::KisEmbossDiagonalFilter(KisView * view) : KisConvolutio
KisTopEdgeDetectionFilter::KisTopEdgeDetectionFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { 1, 1, 1 }, { 0, 0, 0 }, { -1, -1, -1} };
......@@ -257,6 +275,8 @@ KisTopEdgeDetectionFilter::KisTopEdgeDetectionFilter(KisView * view) : KisConvol
KisRightEdgeDetectionFilter::KisRightEdgeDetectionFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { -1, 0, 1 }, { -1, 0, 1 }, { -1, 0, 1} };
......@@ -270,6 +290,8 @@ KisRightEdgeDetectionFilter::KisRightEdgeDetectionFilter(KisView * view) : KisCo
KisBottomEdgeDetectionFilter::KisBottomEdgeDetectionFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { -1, -1, -1 }, { 0, 0, 0 }, { 1, 1, 1} };
......@@ -283,6 +305,8 @@ KisBottomEdgeDetectionFilter::KisBottomEdgeDetectionFilter(KisView * view) : Kis
KisLeftEdgeDetectionFilter::KisLeftEdgeDetectionFilter(KisView * view) : KisConvolutionConstFilter(name(), view)
{
if (!colorStrategy()) return;
Q_INT32 imgdepth = colorStrategy()->depth();
m_matrixes = new KisMatrix3x3[imgdepth];
int mat[3][3] = { { 1, 0, -1 }, { 1, 0, -1 }, { 1, 0, -1} };
......
......@@ -27,6 +27,10 @@
class KisView;
// XXX:; All these filters are loaded on document creation. A document
// can, theoretically, contain zero or more images of different
// depths. If there are zero images, then closing Krita will crash
// in the destructor.
class KisGaussianBlurFilter : public KisConvolutionConstFilter {
public:
KisGaussianBlurFilter(KisView * view);
......
......@@ -30,18 +30,23 @@ KisConvolutionFilter::KisConvolutionFilter(const QString& name, KisView * view)
}
void KisConvolutionFilter::process(KisPaintDeviceSP src, KisPaintDeviceSP dst, KisFilterConfiguration* configuration, const QRect& /*rect*/, KisTileCommand* command)
void KisConvolutionFilter::process(KisPaintDeviceSP src,
KisPaintDeviceSP dst,
KisFilterConfiguration* configuration,
const QRect& /*rect*/,
KisTileCommand* command)
{
KisConvolutionPainter painter( dst );
painter.beginTransaction(command);
KisMatrix3x3* amatrixes = ((KisConvolutionConfiguration*)configuration)->matrixes();
painter.applyConvolutionColorTransformation(amatrixes, src);
KisConvolutionPainter painter( dst );
painter.beginTransaction(command);
KisMatrix3x3* amatrixes = ((KisConvolutionConfiguration*)configuration)->matrixes();
painter.applyConvolutionColorTransformation(amatrixes, src);
painter.endTransaction();
}
KisConvolutionConstFilter::~KisConvolutionConstFilter()
{
delete m_matrixes;
if (m_matrixes)
delete m_matrixes;
}
KisFilterConfiguration* KisConvolutionConstFilter::configuration(KisFilterConfigurationWidget*)
......
......@@ -27,20 +27,22 @@
class KisConvolutionConfiguration : public KisFilterConfiguration {
public:
KisConvolutionConfiguration(KisMatrix3x3* matrixes) : m_matrixes(matrixes) {
};