Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/graphicsport.h
00001 #ifndef _GRAPHICS_PORT_H_
00002 #define _GRAPHICS_PORT_H_
00003 
00004 #include <nds.h>
00005 #include "gadget.h"
00006 #include "woopsiarray.h"
00007 #include "graphics.h"
00008 
00009 namespace WoopsiUI {
00010     
00011     class FontBase;
00012     class FrameBuffer;
00013     class BitmapBase;
00014     
00044     class GraphicsPort {
00045     public:
00046         
00089         GraphicsPort(const s16 x, const s16 y, const u16 width, const u16 height, const bool isEnabled, FrameBuffer* bitmap, const WoopsiArray<Rect>* clipRectList, const Rect* clipRect);
00090         
00094         virtual inline ~GraphicsPort() {
00095             delete _graphics;
00096         };
00097 
00107         void setClipRect(const Rect& clipRect);
00108 
00116         void getClipRect(Rect& rect) const;
00117 
00122         inline const s16 getX() const { return _rect.x; };
00123         
00128         const s16 getY() const { return _rect.y; };
00129         
00136         void drawPixel(s16 x, s16 y, u16 colour);
00137         
00146         void drawFilledRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
00147         
00156         void drawRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
00157         
00167         void drawBevelledRect(s16 x, s16 y, u16 width, u16 height, u16 shineColour, u16 shadowColour);
00168 
00176         virtual void drawXORPixel(s16 x, s16 y, u16 colour);
00177         
00186         virtual void drawXORHorizLine(s16 x, s16 y, u16 width, u16 colour);
00187         
00196         virtual void drawXORVertLine(s16 x, s16 y, u16 height, u16 colour);
00197         
00207         virtual void drawXORRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
00208         
00218         virtual void drawFilledXORRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
00219 
00225         virtual void drawXORPixel(s16 x, s16 y);
00226         
00233         void drawXORHorizLine(s16 x, s16 y, u16 width);
00234         
00241         void drawXORVertLine(s16 x, s16 y, u16 height);
00242         
00250         void drawXORRect(s16 x, s16 y, u16 width, u16 height);
00251         
00259         void drawFilledXORRect(s16 x, s16 y, u16 width, u16 height);
00260         
00268         void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string);
00269 
00282         void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string, s32 startIndex, s32 length, u16 colour = 0);
00283 
00297         void drawBaselineText(s16 x, s16 y, FontBase* font, const WoopsiString& string, s32 startIndex, s32 length, u16 colour = 0);
00298         
00311         void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY);
00312         
00329         void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY, u16 transparentColour);
00330         
00345         virtual void drawBitmapGreyScale(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY);
00346         
00355         void drawLine(s16 x1, s16 y1, s16 x2, s16 y2, u16 colour);
00356         
00371         void copy(s16 sourceX, s16 sourceY, s16 destX, s16 destY, u16 width, u16 height);
00372         
00389         void scroll(s16 x, s16 y, s16 xDistance, s16 yDistance, u16 width, u16 height, WoopsiArray<Rect>* revealedRects);
00390 
00398         void dim(s16 x, s16 y, u16 width, u16 height);
00399 
00407         void greyScale(s16 x, s16 y, u16 width, u16 height);
00408         
00417         virtual void drawEllipse(s16 xCentre, s16 yCentre, s16 horizRadius, s16 vertRadius, u16 colour);
00418         
00427         virtual void drawFilledEllipse(s16 xCentre, s16 yCentre, s16 horizRadius, s16 vertRadius, u16 colour);
00428 
00429     private:
00430         WoopsiArray<Rect> _clipRectList;        
00431         Rect _rect;                             
00432         bool _isEnabled;                        
00433         Graphics* _graphics;                    
00434         bool _isTopScreen;                      
00436         void convertPortToScreenSpace(s16* x, s16* y);
00437         void addClipRect(const Rect& clipRect);
00438     };
00439 }
00440 
00441 #endif
 All Classes Functions Variables Enumerations Enumerator