kpixmapio.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  *
00004  * This file is part of the KDE project, module kdeui.
00005  * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
00006  *
00007  * You can Freely distribute this program under the GNU Library General
00008  * Public License. See the file "COPYING.LIB" for the exact licensing terms.
00009  */
00010 
00011 #ifndef __KPixmapIO_h_Included__
00012 #define __KPixmapIO_h_Included__
00013 
00014 #include <kdelibs_export.h>
00015 
00016 class QPixmap;
00017 class QImage;
00018 class QPoint;
00019 class QRect;
00020 struct KPixmapIOPrivate;
00087 class KDEUI_EXPORT KPixmapIO
00088 {
00089 public:
00090     KPixmapIO();
00091     ~KPixmapIO();
00092 
00098     QPixmap convertToPixmap(const QImage &image);
00099 
00105     QImage convertToImage(const QPixmap &pixmap);
00106 
00114     void putImage(QPixmap *dst, int dx, int dy, const QImage *src);
00115 
00120     void putImage(QPixmap *dst, const QPoint &offset, const QImage *src);
00121 
00131     QImage getImage(const QPixmap *src, int sx, int sy, int sw, int sh);
00132 
00137     QImage getImage(const QPixmap *src, const QRect &rect);
00138 
00142     enum ShmPolicies {
00143     ShmDontKeep,
00144     ShmKeepAndGrow
00145     };
00146 
00152     void setShmPolicy(int policy);
00153 
00159     void preAllocShm(int size);
00160 
00161 private:
00162     /*
00163      * Supported XImage byte orders. The notation ARGB means bytes
00164      * containing A:R:G:B succeed in memory.
00165      */
00166     enum ByteOrders {
00167     bo32_ARGB, bo32_BGRA, bo24_RGB, bo24_BGR,
00168     bo16_RGB_565, bo16_BGR_565, bo16_RGB_555,
00169     bo16_BGR_555, bo8
00170     };
00171 
00172     bool m_bShm;
00173     bool initXImage(int w, int h);
00174     void doneXImage();
00175     bool createXImage(int w, int h);
00176     void destroyXImage();
00177     bool createShmSegment(int size);
00178     void destroyShmSegment();
00179     void convertToXImage(const QImage &);
00180     QImage convertFromXImage();
00181 private:
00182     KPixmapIOPrivate* d;
00183 };
00184 
00185 #endif // __KPixmapIO_h_Included__
KDE Home | KDE Accessibility Home | Description of Access Keys