- Main Page
- Classes
- Files

- File List

# C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/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 "graphicsunclipped.h"
    00008
    00009 namespace WoopsiUI {
    00010
    00011         class FontBase;
    00012         class FrameBuffer;
    00013         class BitmapBase;
    00014
    00022         class GraphicsPort : public GraphicsUnclipped {
    00023         public:
    00024
    00036                 GraphicsPort(Gadget* const gadget, const s16 x, const s16 y, const u16 width, const u16 height, FrameBuffer* bitmap, const WoopsiArray<Rect>* clipRectList, const Rect* clipRect);
    00037
    00041                 inline ~GraphicsPort() {
    00042                         delete _clipRect;
    00043                 };
    00044
    00049                 inline const s16 getX() const { return _rect.x + _gadget->getX(); };
    00050
    00055                 const s16 getY() const { return _rect.y + _gadget->getY(); };
    00056
    00063                 void drawPixel(s16 x, s16 y, u16 colour);
    00064
    00073                 void drawFilledRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00074
    00082                 void drawHorizLine(s16 x, s16 y, s16 width, u16 colour);
    00083
    00091                 void drawVertLine(s16 x, s16 y, s16 height, u16 colour);
    00092
    00101                 void drawRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00102
    00112                 void drawBevelledRect(s16 x, s16 y, u16 width, u16 height, u16 shineColour, u16 shadowColour);
    00113
    00122                 void drawBevelledRect(s16 x, s16 y, u16 width, u16 height);
    00123
    00131                 virtual void drawCircle(s16 x0, s16 y0, u16 radius, u16 colour);
    00132
    00140                 void drawFilledCircle(s16 x0, s16 y0, u16 radius, u16 colour);
    00141
    00147                 virtual void drawXORPixel(s16 x, s16 y);
    00148
    00155                 void drawXORHorizLine(s16 x, s16 y, s16 width);
    00156
    00163                 void drawXORVertLine(s16 x, s16 y, s16 height);
    00164
    00172                 void drawXORRect(s16 x, s16 y, u16 width, u16 height);
    00173
    00181                 void drawFilledXORRect(s16 x, s16 y, u16 width, u16 height);
    00182
    00190                 void drawText(s16 x, s16 y, FontBase* font, const char* string);
    00191
    00200                 void drawText(s16 x, s16 y, FontBase* font, u16 length, const char* string);
    00201
    00211                 void drawText(s16 x, s16 y, FontBase* font, u16 length, const char* string, u16 colour);
    00212
    00220                 void drawText(s16 x, s16 y, FontBase* font, char letter);
    00221
    00230                 void drawText(s16 x, s16 y, FontBase* font, const char* string, u16 colour);
    00231
    00240                 void drawText(s16 x, s16 y, FontBase* font, char letter, u16 colour);
    00241
    00252                 void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY);
    00253
    00267                 void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY, u16 transparentColour);
    00268
    00277                 void drawLine(s16 x1, s16 y1, s16 x2, s16 y2, u16 colour);
    00278
    00282                 void clear();
    00283
    00298                 void copy(s16 sourceX, s16 sourceY, s16 destX, s16 destY, u16 width, u16 height);
    00299
    00313                 void scroll(s16 x, s16 y, s16 xDistance, s16 yDistance, u16 width, u16 height, WoopsiArray<Rect>* revealedRects);
    00314
    00322                 void dim(s16 x, s16 y, u16 width, u16 height);
    00323
    00324         private:
    00325                 Gadget* _gadget;
    00326                 Rect* _clipRect;
    00327                 const WoopsiArray<Rect>* _clipRectList;
    00328                 Rect _rect;
    00330                 // Internal clipping routines
    00331                 void clipPixel(s16 x, s16 y, u16 colour, const Rect& clipRect);
    00332                 void clipFilledRect(s16 x, s16 y, u16 width, u16 height, u16 colour, const Rect& clipRect);
    00333                 void clipHorizLine(s16 x, s16 y, s16 width, u16 colour, const Rect& clipRect);
    00334                 void clipVertLine(s16 x, s16 y, s16 height, u16 colour, const Rect& clipRect);
    00335                 void clipBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY, const Rect& clipRect);
    00336                 void clipBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY, u16 transparentColour, const Rect& clipRect);
    00337                 void clipText(s16 x, s16 y, FontBase* font, u16 length, const char* string, const Rect& clipRect);
    00338                 void clipCircle(s16 x0, s16 y0, u16 radius, u16 colour, const Rect& clipRect);
    00339                 void clipFilledCircle(s16 x0, s16 y0, u16 radius, u16 colour, const Rect& clipRect);
    00340                 void clipXORPixel(s16 x, s16 y, const Rect& clipRect);
    00341                 void clipXORHorizLine(s16 x, s16 y, s16 width, const Rect& clipRect);
    00342                 void clipXORVertLine(s16 x, s16 y, s16 height, const Rect& clipRect);
    00343                 void clipLine(s16 x1, s16 y1, s16 x2, s16 y2, u16 colour, const Rect& clipRect);
    00344                 void clipScroll(s16 x, s16 y, s16 xDistance, s16 yDistance, u16 width, u16 height, const Rect& clipRect, WoopsiArray<Rect>* revealedRects);
    00345                 void clipDim(s16 x, s16 y, u16 width, u16 height, const Rect& clipRect);
    00346
    00347                 void convertPortToScreenSpace(s16* x, s16* y);
    00348                 bool clipCoordinates(s16* x1, s16* y1, s16* x2, s16* y2, const Rect& clipRect);
    00349                 u8 getClipLineOutCode(s16 x, s16 y, s16 xMin, s16 yMin, s16 xMax, s16 yMax);
    00350         };
    00351 }
    00352
    00353 #endif