00001 #ifndef KDE__PIXMAP_H
00002 #define KDE__PIXMAP_H
00003
00004 #include <faith/paintdevice.h>
00005 #include <faith/application.h>
00006 #include <faith/image.h>
00007
00008 namespace Faith
00009 {
00010
00011 class Bitmap;
00012
00020 class FAITH_CORE_EXPORT Pixmap : public PaintDevice
00021 {
00022 struct KDEPixmapPrivate;
00023 KDEPixmapPrivate *d;
00024
00025 public:
00026 Pixmap();
00035 Pixmap(const Image &image);
00039 Pixmap(const Pixmap &pixmap);
00044 Pixmap(int w, int h, int depth=-1);
00049 Pixmap(const Size &size, int depth=-1);
00050 virtual ~Pixmap();
00051 virtual Handle handle();
00052
00057 void resize(int w, int h);
00058
00062 Pixmap &operator =(const Pixmap ©);
00063
00067 Pixmap &operator =(const Image &image);
00068
00072 const Bitmap *mask() const;
00073
00079 void setMask(const Bitmap &mask);
00080
00084 Size size() const;
00088 Rect rect() const;
00089
00093 int width() const { return size().width(); }
00094
00098 int height() const { return size().height(); }
00099
00107 int depth() const;
00108
00112 bool isNull() const;
00113
00118 Faith::Image toImage(int fromx=0, int fromy=0, int w=-1, int h=-1) const;
00122 Faith::Image convertToImage() const { return toImage(); }
00123
00128 void fromImage(const Image &image);
00129
00133 void convertFromImage(const Image &image)
00134 {
00135 fromImage(image);
00136 }
00137
00138 void detach() const;
00143 void reset();
00144
00145 protected:
00149 virtual void init(const Size &size, int depth);
00150
00151 private:
00152 virtual Internal::Drawable *getDrawable();
00153 };
00154
00155 }
00156
00157 #endif