Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

BImage.h

Go to the documentation of this file.
00001 // BImage.h (this is -*- C++ -*-)
00002 // 
00003 // \author: Bjoern Giesler <bjoern@giesler.de>
00004 // 
00005 // 
00006 // 
00007 // $Author: giesler $
00008 // $Locker$
00009 // $Revision$
00010 // $Date: 2002-08-19 10:41:28 +0200 (Mon, 19 Aug 2002) $
00011 
00012 #ifndef BIMAGE_H
00013 #define BIMAGE_H
00014 
00015 /* system includes */
00016 #include <string>
00017 
00018 /* my includes */
00019 #include "BGraphics.h"
00020 
00021 class BPoint;
00022 class BRect;
00023 class BFont;
00024 class BWidget;
00025 
00037 class BImage {
00038 public:
00039 
00040   typedef enum {
00041     FMT_RGB15,
00042     FMT_GREY5
00043   } ImageFormat; 
00044 
00050   BImage(char** xpmData);
00051 
00057   BImage(int width, int height,
00058          ImageFormat format = FMT_RGB15);
00059 
00067   BImage(int width, int height,
00068          uint8* image, ImageFormat format = FMT_RGB15,
00069          bool copy = false);
00070   BImage(const BImage& img);
00071 
00072   virtual ~BImage();
00073 
00074   void operator=(const BImage& img);
00075 
00077   virtual int width() const { return _width; }
00079   virtual int height() const { return _height; }
00081   virtual int format() const { return _format; }
00082 
00088   virtual void blit(const BPoint& pt, uint16* screenStart);
00089 
00100 
00101   void drawPixel(const BPoint& pt, uint16 color);
00103   void drawPixel(int x, int y, uint16 color);
00105   void drawLine(const BPoint& pt1, const BPoint& pt2, uint16 color);
00107   void drawRect(const BRect& rect, uint16 color);
00109   BPoint drawText(BFont* font, const std::string& text,
00110                   int cursorPos, const BRect& clip,
00111                   const BWidget& widget, uint16 color);
00112 
00117 
00118   uint8* bytes() { return _image; }
00120   const uint8* bytes() const { return _image; }
00121 
00123   void fill(uint16 color);
00124 
00125 private:
00126   uint8* _image;
00127   bool _freeImage;
00128   int _width, _height;
00129   ImageFormat _format;
00130 };
00131 
00132 #endif /* BIMAGE_H */

Generated on Sat Dec 29 09:59:23 2007 for DSGUI by doxygen1.3-rc3