2
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
2
* Copyright (c) 2010 Sven Langkamp <sven.langkamp@gmail.com>
4
4
* This program is free software; you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License as published by
44
45
#include <KoShapeController.h>
45
46
#include <KoShapeSavingContext.h>
46
47
#include <KoStoreDevice.h>
48
#include <KoShapeTransformCommand.h>
49
50
#include "kis_painter.h"
50
51
#include "kis_paint_device.h"
407
// TODO same code as in shape layer, refactor!
408
QUndoCommand* KisShapeSelection::transform(double xscale, double yscale, double xshear, double yshear, double angle, qint32 translatex, qint32 translatey) {
412
QPointF transF = m_converter->viewToDocument(QPoint(translatex, translatey));
413
QList<KoShape*> shapes = m_canvas->shapeManager()->shapes();
418
matrix.translate(transF.x(), transF.y());
419
matrix.scale(xscale,yscale);
420
matrix.rotate(angle*180/M_PI);
422
QList<QTransform> oldTransformations;
423
QList<QTransform> newTransformations;
425
// this code won't work if there are shapes, that inherit the transformation from the parent container.
426
// the chart and tree shapes are examples for that, but they aren't used in krita and there are no other shapes like that.
427
foreach(const KoShape* shape, shapes) {
428
QTransform oldTransform = shape->transformation();
429
oldTransformations.append(oldTransform);
432
newTransformations.append(oldTransform*matrix);
435
return new KoShapeTransformCommand(shapes, oldTransformations, newTransformations);
403
439
#include "kis_shape_selection.moc"