- Main Page
- Classes
- Files

- File List

# 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
    00155                 void drawHorizLine(s16 x, s16 y, s16 width, u16 colour);
    00156
    00164                 void drawVertLine(s16 x, s16 y, s16 height, u16 colour);
    00165
    00174                 void drawRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00175
    00185                 void drawBevelledRect(s16 x, s16 y, u16 width, u16 height, u16 shineColour, u16 shadowColour);
    00186
    00194                 virtual void drawCircle(s16 x0, s16 y0, u16 radius, u16 colour);
    00195
    00203                 void drawFilledCircle(s16 x0, s16 y0, u16 radius, u16 colour);
    00204
    00212                 virtual void drawXORPixel(s16 x, s16 y, u16 colour);
    00213
    00222                 virtual void drawXORHorizLine(s16 x, s16 y, u16 width, u16 colour);
    00223
    00232                 virtual void drawXORVertLine(s16 x, s16 y, u16 height, u16 colour);
    00233
    00243                 virtual void drawXORRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00244
    00254                 virtual void drawFilledXORRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00255
    00261                 virtual void drawXORPixel(s16 x, s16 y);
    00262
    00269                 void drawXORHorizLine(s16 x, s16 y, u16 width);
    00270
    00277                 void drawXORVertLine(s16 x, s16 y, u16 height);
    00278
    00286                 void drawXORRect(s16 x, s16 y, u16 width, u16 height);
    00287
    00295                 void drawFilledXORRect(s16 x, s16 y, u16 width, u16 height);
    00296
    00304                 void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string);
    00305
    00317                 void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string, s32 startIndex, s32 length, u16 colour);
    00318
    00329                 void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string, s32 startIndex, s32 length);
    00330
    00343                 void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY);
    00344
    00361                 void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY, u16 transparentColour);
    00362
    00377                 virtual void drawBitmapGreyScale(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY);
    00378
    00387                 void drawLine(s16 x1, s16 y1, s16 x2, s16 y2, u16 colour);
    00388
    00403                 void copy(s16 sourceX, s16 sourceY, s16 destX, s16 destY, u16 width, u16 height);
    00404
    00418                 void scroll(s16 x, s16 y, s16 xDistance, s16 yDistance, u16 width, u16 height, WoopsiArray<Rect>* revealedRects);
    00419
    00427                 void dim(s16 x, s16 y, u16 width, u16 height);
    00428
    00436                 void greyScale(s16 x, s16 y, u16 width, u16 height);
    00437
    00446                 virtual void drawEllipse(s16 xCentre, s16 yCentre, s16 horizRadius, s16 vertRadius, u16 colour);
    00447
    00456                 virtual void drawFilledEllipse(s16 xCentre, s16 yCentre, s16 horizRadius, s16 vertRadius, u16 colour);
    00457
    00458         private:
    00459                 WoopsiArray<Rect> _clipRectList;
    00460                 Rect _rect;
    00461                 bool _isEnabled;
    00462                 Graphics* _graphics;
    00464                 void convertPortToScreenSpace(s16* x, s16* y);
    00465                 void addClipRect(const Rect& clipRect);
    00466         };
    00467 }
    00468
    00469 #endif