File indexing completed on 2024-05-12 15:56:40
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2010 Jan Hambrecht <jaham@gmx.net> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef KOFILTEREFFECTLOADINGCONTEXT_H 0008 #define KOFILTEREFFECTLOADINGCONTEXT_H 0009 0010 #include "kritaflake_export.h" 0011 0012 class QRectF; 0013 class QPointF; 0014 0015 #include <QtGlobal> 0016 #include <QString> 0017 0018 /// This class provides a loading context for filter effects 0019 class KRITAFLAKE_EXPORT KoFilterEffectLoadingContext 0020 { 0021 public: 0022 /** 0023 * Constructs a new filter effect loading context 0024 * @param basePath the xml document base path 0025 */ 0026 explicit KoFilterEffectLoadingContext(const QString &basePath = QString()); 0027 0028 /// Destructor 0029 virtual ~KoFilterEffectLoadingContext(); 0030 0031 /** 0032 * Sets the bounding box of the shape a filter is loaded for. 0033 * The shapes bounding box is used to convert from user space 0034 * coordinates to bounding box coordinates for filter attributes. 0035 * @param shapeBound the shapes bounding box 0036 */ 0037 void setShapeBoundingBox(const QRectF &shapeBound); 0038 0039 /// Enables conversion of filter units 0040 void enableFilterUnitsConversion(bool enable); 0041 0042 /// Enables conversion of filter primitive units 0043 void enableFilterPrimitiveUnitsConversion(bool enable); 0044 0045 /// Converts a point value from user space to bounding box coordinates 0046 QPointF convertFilterUnits(const QPointF &value) const; 0047 0048 /// Converts an x value from user space to bounding box coordinates 0049 qreal convertFilterUnitsX(qreal value) const; 0050 0051 /// Converts an y value from user space to bounding box coordinates 0052 qreal convertFilterUnitsY(qreal value) const; 0053 0054 QPointF convertFilterPrimitiveUnits(const QPointF &value) const; 0055 0056 /// Converts an x value from user space to bounding box coordinates 0057 qreal convertFilterPrimitiveUnitsX(qreal value) const; 0058 0059 /// Converts an y value from user space to bounding box coordinates 0060 qreal convertFilterPrimitiveUnitsY(qreal value) const; 0061 0062 /// Converts a href to an absolute path name 0063 QString pathFromHref(const QString &href) const; 0064 0065 private: 0066 class Private; 0067 Private * const d; 0068 }; 0069 0070 #endif // KOFILTEREFFECTLOADINGCONTEXT_H 0071