1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
  
     | 
    
      /* This file is part of the KDE project
 * Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */
#ifndef KOFILTEREFFECTSTACK
#define KOFILTEREFFECTSTACK
#include "flake_export.h"
#include <QList>
#include <QRectF>
class KoFilterEffect;
class KoXmlWriter;
/// This class manages a stack of filter effects
class FLAKE_EXPORT KoFilterEffectStack
{
public:
    /// Creates an empty filter effect stack
    KoFilterEffectStack();
    /// Destroys the filter effect stack, deleting all filter effects
    ~KoFilterEffectStack();
    /**
    * The first filter of the list is the first to be applied.
    *
    * @return the list of filter effects applied on the shape when rendering.
    */
    QList<KoFilterEffect*> filterEffects() const;
    /**
    * Returns if the filter effect stack is empty.
    * @return false if the stack contains filter effects, otherwise true
    */
    bool isEmpty() const;
    /**
    * Inserts a new filter at the given position in the filter list.
    *
    * The filter stack take ownership of the inserted filter effect.
    *
    * @param index the list index to insert the new filter at
    * @param filter the new filter to insert
    */
    void insertFilterEffect(int index, KoFilterEffect *filter);
    /**
    * Appends a new filter at the end of the filter list.
    *
    * The filter stack take ownership of the appended filter effect.
    *
    * @param filter the new filter to append
    */
    void appendFilterEffect(KoFilterEffect *filter);
    /**
    * Removes the filter with the given index from the filter list.
    *
    * The filter gets deleted after removal from the list.
    *
    * @param index the index of the filter to remove
    */
    void removeFilterEffect(int index);
    /**
     * Take filter effect with given index from the stack and returns it.
     * @param index the index of the filter to take
     * @return the filter effect, of 0 if no filter effect with the given index exists
     */
    KoFilterEffect* takeFilterEffect(int index);
    /// Sets the clipping rectangle used for this filter in bounding box units
    void setClipRect(const QRectF &clipRect);
    /// Returns the clipping rectangle used for this filter in bounding box units
    QRectF clipRect() const;
    /// Returns the clipping rectangle for the given bounding rect
    QRectF clipRectForBoundingRect(const QRectF &boundingRect) const;
    /**
     * Increments the use-value.
     * Returns true if the new value is non-zero, false otherwise.
     */
    bool ref();
    /**
     * Decrements the use-value.
     * Returns true if the new value is non-zero, false otherwise.
     */
    bool deref();
    /// Return reference counter
    int useCount() const;
    /**
    * Saves filter stack using given xml writer.
    * @param writer the xml writer to write data to
    * @param id the filter id to write, used for referencing the filter
    */
    void save(KoXmlWriter &writer, const QString &filterId);
    /// Returns list of required standard inputs
    QSet<QString> requiredStandarsInputs() const;
private:
    class Private;
    Private * const d;
};
#endif // KOFILTEREFFECTSTACK
 
     |