karbon

vpattern.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002, The Karbon Developers
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library 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 GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __VPATTERN_H__
00021 #define __VPATTERN_H__
00022 
00023 #include <KoPoint.h>
00024 #include <koIconChooser.h>
00025 #include <qimage.h>
00026 #include <qpixmap.h>
00027 #include <koffice_export.h>
00028 class QDomElement;
00029 
00030 
00031 class KARBONBASE_EXPORT VPattern : public KoIconItem
00032 {
00033 public:
00034     VPattern();
00035     VPattern( const QString &tilename );
00036 
00037     unsigned char *pixels();
00038     unsigned int tileWidth() const;
00039     unsigned int tileHeight() const;
00040 
00041     KoPoint origin() const { return m_origin; }
00042     void setOrigin( const KoPoint &origin ) { m_origin = origin; }
00043 
00044     KoPoint vector() const { return m_vector; }
00045     void setVector( const KoPoint &vector ) { m_vector = vector; }
00046 
00047     void load( const QString &tilename );
00048 
00049     void save( QDomElement& element ) const;
00050     void load( const QDomElement& element );
00051 
00052     void transform( const QWMatrix& m );
00053 
00054     // for KoIconItem
00055     QPixmap& pixmap() const ;
00056     QPixmap& thumbPixmap() const;
00057 
00058     bool isValid() const { return m_valid; }
00059 
00060     QString tilename() const { return m_tilename; }
00061 
00062 private:
00063     // coordinates:
00064     KoPoint m_origin;
00065     KoPoint m_vector;
00066     QImage m_image;
00067     QPixmap m_pixmap;
00068     QPixmap m_pixmapThumb;
00069     QString m_tilename;
00070     bool m_valid;
00071 };
00072 
00073 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys