F:/KPlato/koffice/libs/pigment/KoHistogramProducer.h

Aller à la documentation de ce fichier.
00001 /*
00002  *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef _KIS_HISTOGRAM_PRODUCER_
00020 #define _KIS_HISTOGRAM_PRODUCER_
00021 
00022 #include <qglobal.h>
00023 #include <ksharedptr.h>
00024 
00025 #include <koffice_export.h>
00026 
00027 #include <KoColorSpace.h>
00028 
00029 #include "KoGenericRegistry.h"
00030 
00031 class QString;
00032 class KoChannelInfo;
00033 
00051 class /*PIGMEMT_EXPORT*/ KoHistogramProducer : public KShared {
00052 public:
00053     KoHistogramProducer() : m_skipTransparent(true), m_skipUnselected(true) {}
00054     virtual ~KoHistogramProducer() {}
00055 
00056     // Methods to change the bins
00057 
00059     virtual void clear() = 0;
00060 
00071     virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, KoColorSpace* colorSpace) = 0;
00072 
00073     // Methods to set what exactly is being added to the bins
00074     virtual void setView(double from, double width) = 0;
00075     virtual void setSkipTransparent(bool set) { m_skipTransparent = set; }
00076     virtual void setSkipUnselected(bool set) { m_skipUnselected = set; }
00077 
00078     // Methods with general information about this specific producer
00079     virtual const KoID& id() const = 0;
00080     virtual Q3ValueVector<KoChannelInfo *> channels() = 0;
00081     virtual qint32 numberOfBins() = 0;
00082     virtual QString positionToString(double pos) const = 0;
00083     virtual double viewFrom() const = 0;
00084     virtual double viewWidth() const = 0;
00085     virtual double maximalZoom() const = 0;
00086 
00087     // Methods to get information on the data we have seen
00088     virtual qint32 count() = 0;
00089     virtual qint32 getBinAt(qint32 channel, qint32 position) = 0;
00090     virtual qint32 outOfViewLeft(qint32 channel) = 0;
00091     virtual qint32 outOfViewRight(qint32 channel) = 0;
00092 protected:
00093     bool m_skipTransparent;
00094     bool m_skipUnselected;
00095 };
00096 
00097 typedef KSharedPtr<KoHistogramProducer> KoHistogramProducerSP;
00098 
00099 class /*PIGMEMT_EXPORT*/ KoHistogramProducerFactory {
00100 public:
00101     KoHistogramProducerFactory(const KoID& id) : m_id(id) {}
00102     virtual ~KoHistogramProducerFactory() {}
00104     virtual KoHistogramProducerSP generate() = 0;
00106     virtual bool isCompatibleWith(KoColorSpace* colorSpace) const = 0;
00108     virtual float preferrednessLevelWith(KoColorSpace* colorSpace) const = 0;
00109     virtual const KoID& id() const { return m_id; }
00110 protected:
00111     KoID m_id;
00112 };
00113 
00114 class /*PIGMEMT_EXPORT*/ KoHistogramProducerFactoryRegistry
00115     : public KoGenericRegistry<KoHistogramProducerFactory*> {
00116 public:
00117     virtual ~KoHistogramProducerFactoryRegistry();
00118     static KoHistogramProducerFactoryRegistry* instance();
00120     QList<KoID> listKeysCompatibleWith(KoColorSpace* colorSpace) const;
00121 
00122 private:
00123    KoHistogramProducerFactoryRegistry();
00124    KoHistogramProducerFactoryRegistry(const KoHistogramProducerFactoryRegistry&);
00125    KoHistogramProducerFactoryRegistry operator=(const KoHistogramProducerFactoryRegistry&);
00126 
00127    static KoHistogramProducerFactoryRegistry* m_singleton;
00128 };
00129 
00130 #endif // _KIS_HISTOGRAM_PRODUCER

Généré le Wed Nov 22 23:41:13 2006 pour KPlato par  doxygen 1.5.1-p1