[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: Re: Krita and scaling
From: Michael Thaler <michael.thaler () ph ! tum ! de>
Date: 2004-09-20 16:38:49
Message-ID: 200409201838.49052.michael.thaler () physik ! tu-muenchen ! de
[Download RAW message or body]
Hi,
> I've checked the plugin in; I'll try find some time to make the dialog look
> like Kolourpaint's -- no sense in having two different designs in KDE apps
> for functions that are the same.
I attached the patch again, please apply it. This time it is the right one
against a fresh checkout of krita. I won't be able to work on the actual
rotation code today, but I hope I will find some time during this week,
Greetings,
Michael
["mydiff" (text/x-diff)]
? mydiff
? core/compositeop/Makefile
? core/compositeop/Makefile.in
? plugins/colorspace_cmyk/Makefile
? plugins/colorspace_cmyk/Makefile.in
Index: core/kis_image.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_image.cc,v
retrieving revision 1.154
diff -u -3 -u -p -r1.154 kis_image.cc
--- core/kis_image.cc 16 Sep 2004 20:18:03 -0000 1.154
+++ core/kis_image.cc 20 Sep 2004 16:33:42 -0000
@@ -424,6 +424,28 @@ void KisImage::scale(double sx, double s
}
+void KisImage::rotate(double angle)
+{
+ //kdDebug() << "KisImage::rotate. ANGLE: "
+ // << angle
+ // << "\n";
+
+
+ if (m_layers.empty()) return; // Nothing to scale
+
+ //fix undo
+ undoAdapter()->beginMacro("Rotate image");
+
+ vKisLayerSP_it it;
+ for ( it = m_layers.begin(); it != m_layers.end(); ++it ) {
+ KisLayerSP layer = (*it);
+ layer -> rotate(angle);
+ }
+
+ undoAdapter()->endMacro();
+
+}
+
void KisImage::convertTo( KisStrategyColorSpaceSP colorStrategy)
{
if (m_layers.empty()) return; // Nothing to convert
Index: core/kis_image.h
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_image.h,v
retrieving revision 1.86
diff -u -3 -u -p -r1.86 kis_image.h
--- core/kis_image.h 9 Sep 2004 12:52:35 -0000 1.86
+++ core/kis_image.h 20 Sep 2004 16:33:42 -0000
@@ -71,7 +71,8 @@ public:
void resize(const QRect& rc);
void scale(double sx, double sy);
-
+ void rotate(double angle);
+
void convertTo(KisStrategyColorSpaceSP colorStrategy);
void enableUndo(KoCommandHistory *history);
Index: core/kis_paint_device.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_paint_device.cc,v
retrieving revision 1.97
diff -u -3 -u -p -r1.97 kis_paint_device.cc
--- core/kis_paint_device.cc 19 Sep 2004 19:24:47 -0000 1.97
+++ core/kis_paint_device.cc 20 Sep 2004 16:33:43 -0000
@@ -658,6 +658,10 @@ double KisPaintDevice::Mitchell_filter(d
return(0.0);
}
+void KisPaintDevice::rotate(double angle)
+{
+ kdDebug() << "Rotating Code called! Going to rotate image by (angle): " << angle << "\n";
+}
// XXX: also allow transform on part of paint device?
void KisPaintDevice::transform(const QWMatrix & matrix)
Index: core/kis_paint_device.h
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_paint_device.h,v
retrieving revision 1.76
diff -u -3 -u -p -r1.76 kis_paint_device.h
--- core/kis_paint_device.h 17 Sep 2004 13:38:31 -0000 1.76
+++ core/kis_paint_device.h 20 Sep 2004 16:33:43 -0000
@@ -199,7 +199,7 @@ public:
void resize(const QSize& size);
void resize();
void scale(double sx, double sy);
-
+ void rotate(double angle);
/**
Apply the transformation matrix _in place_.
Index: core/kis_view.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_view.cc,v
retrieving revision 1.330
diff -u -3 -u -p -r1.330 kis_view.cc
--- core/kis_view.cc 16 Sep 2004 20:18:04 -0000 1.330
+++ core/kis_view.cc 20 Sep 2004 16:33:46 -0000
@@ -1513,6 +1513,23 @@ void KisView::scaleLayer(double sx, doub
canvasRefresh();
}
+void KisView::rotateLayer(double angle)
+{
+ kdDebug() << "RotateLayer called: " << angle << "\n";
+ if (!currentImg()) return;
+
+ KisLayerSP layer = currentImg() -> activeLayer();
+ if (!layer) return;
+
+ layer -> rotate(angle);
+
+ m_doc -> setModified(true);
+ layersUpdated();
+ resizeEvent(0);
+ updateCanvas();
+ canvasRefresh();
+}
+
void KisView::add_new_image_tab()
{
m_doc -> slotNewImage();
@@ -2588,6 +2605,18 @@ void KisView::scaleCurrentImage(double s
canvasRefresh();
}
+void KisView::rotateCurrentImage(double angle)
+{
+ if (!currentImg()) return;
+ //kdDebug() << "Going to rotate image by (angle): " << angle << "\n";
+ currentImg() -> rotate(angle);
+ m_doc -> setModified(true);
+
+ resizeEvent(0);
+ layersUpdated();
+ updateCanvas();
+ canvasRefresh();
+}
QPoint KisView::viewToWindow(const QPoint& pt)
Index: core/kis_view.h
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_view.h,v
retrieving revision 1.162
diff -u -3 -u -p -r1.162 kis_view.h
--- core/kis_view.h 10 Sep 2004 12:51:43 -0000 1.162
+++ core/kis_view.h 20 Sep 2004 16:33:46 -0000
@@ -155,7 +155,8 @@ public slots:
void remove_current_image_tab();
void resizeCurrentImage(Q_INT32 w, Q_INT32 h);
void scaleCurrentImage(double sx, double sy);
-
+ void rotateCurrentImage(double angle);
+
// Layer action slots
void rotateLayer180();
void rotateLayerLeft90();
@@ -165,7 +166,8 @@ public slots:
void mirrorLayerY();
void resizeLayer(Q_INT32 w, Q_INT32 h);
void scaleLayer(double sx, double sy);
-
+ void rotateLayer(double angle);
+
// settings action slots
void preferences();
Index: plugins/rotateimage/rotateimage.cc
===================================================================
RCS file: /home/kde/koffice/krita/plugins/rotateimage/rotateimage.cc,v
retrieving revision 1.1
diff -u -3 -u -p -r1.1 rotateimage.cc
--- plugins/rotateimage/rotateimage.cc 20 Sep 2004 09:17:20 -0000 1.1
+++ plugins/rotateimage/rotateimage.cc 20 Sep 2004 16:33:47 -0000
@@ -93,7 +93,7 @@ void RotateImage::slotRotateImage()
if (dlgRotateImage -> exec() == QDialog::Accepted) {
Q_INT32 angle = dlgRotateImage -> angle();
- // m_view -> rotateCurrentImage(angle);
+ m_view -> rotateCurrentImage(angle);
}
delete dlgRotateImage;
}
@@ -109,7 +109,7 @@ void RotateImage::slotRotateLayer()
if (dlgRotateImage -> exec() == QDialog::Accepted) {
Q_INT32 angle = dlgRotateImage -> angle();
- //m_view -> rotateLayer(angle);
+ m_view -> rotateLayer(angle);
}
delete dlgRotateImage;
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic