Warning, file /office/calligra/libs/flake/KoShapePainter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 * 0003 * Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net> 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Library General Public 0007 * License as published by the Free Software Foundation; either 0008 * version 2 of the License, or (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, write to 0017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KOSHAPEPAINTER_H 0022 #define KOSHAPEPAINTER_H 0023 0024 #include "flake_export.h" 0025 0026 #include <QList> 0027 #include <QRectF> 0028 0029 class KoShape; 0030 class KoViewConverter; 0031 class KoShapeManagerPaintingStrategy; 0032 class QPainter; 0033 class QImage; 0034 0035 /** 0036 * A utility class to paint a subset of shapes onto a QPainter. 0037 * Notice that using setShapes repeatedly is very expensive, as it populates 0038 * the shapeManager and all its caching every time. If at all possible use 0039 * a shapeManager directly and avoid loosing the cache between usages. 0040 */ 0041 class FLAKE_EXPORT KoShapePainter 0042 { 0043 public: 0044 explicit KoShapePainter(KoShapeManagerPaintingStrategy *strategy = 0); 0045 ~KoShapePainter(); 0046 0047 /** 0048 * Sets the shapes to be painted. 0049 * @param shapes the shapes to paint 0050 */ 0051 void setShapes(const QList<KoShape*> &shapes); 0052 0053 /** 0054 * Paints the shapes on the given painter and using the zoom handler. 0055 * @param painter the painter to paint on 0056 * @param converter the view converter defining the zoom to use 0057 */ 0058 void paint(QPainter &painter, KoViewConverter &converter); 0059 0060 /** 0061 * Paints the shapes on the given painter. 0062 * The given document rectangle is painted to fit into the given painter rectangle. 0063 * 0064 * @param painter the painter to paint on 0065 * @param painterRect the destination rectangle on the painter 0066 * @param documentRect the document region to paint 0067 */ 0068 void paint(QPainter &painter, const QRect &painterRect, const QRectF &documentRect); 0069 0070 /** 0071 * Paints shapes to the given image, so that all shapes fit onto it. 0072 * @param image the image to paint into 0073 * @return false if image is empty, else true 0074 */ 0075 void paint(QImage &image); 0076 0077 /// Returns the bounding rect of the shapes to paint 0078 QRectF contentRect() const; 0079 0080 private: 0081 class Private; 0082 Private * const d; 0083 }; 0084 0085 #endif // KOSHAPEPAINTER_H