00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _WG_GRAPHICS_H_
00026 #define _WG_GRAPHICS_H_
00027
00028 #include "wg_rect.h"
00029 #include "wg_color.h"
00030 #include "wg_point.h"
00031 #include "wg_window.h"
00032 #include "SDL.h"
00033
00034
00035 namespace wGui
00036 {
00037
00039
00040 class CPainter
00041 {
00042 public:
00045 enum EPaintMode {
00046 PAINT_IGNORE = 0,
00047 PAINT_REPLACE,
00048 PAINT_NORMAL,
00049 PAINT_OR,
00050 PAINT_AND,
00051 PAINT_XOR,
00052 PAINT_ADDITIVE
00053 };
00054
00058 CPainter(SDL_Surface* pSurface, EPaintMode ePaintMode = PAINT_NORMAL);
00059
00063 CPainter(CWindow* pWindow, EPaintMode ePaintMode = PAINT_NORMAL);
00064
00066 virtual ~CPainter(void) { }
00067
00068
00074 void DrawHLine(int xStart, int xEnd, int y, const CRGBColor& LineColor = DEFAULT_LINE_COLOR);
00075
00081 void DrawVLine(int yStart, int yEnd, int x, const CRGBColor& LineColor = DEFAULT_LINE_COLOR);
00082
00088 void DrawRect(const CRect& Rect, bool bFilled, const CRGBColor& BorderColor = DEFAULT_LINE_COLOR,
00089 const CRGBColor& FillColor = DEFAULT_FOREGROUND_COLOR);
00090
00095 void DrawLine(const CPoint& StartPoint, const CPoint& EndPoint, const CRGBColor& LineColor = DEFAULT_LINE_COLOR);
00096
00100 void DrawPoint(const CPoint& Point, const CRGBColor& PointColor = DEFAULT_LINE_COLOR);
00101
00105 CRGBColor ReadPoint(const CPoint& Point);
00106
00110 void ReplaceColor(const CRGBColor& NewColor, const CRGBColor& OldColor);
00111
00114 void TransparentColor(const CRGBColor& TransparentColor);
00115
00116
00117 protected:
00119 void LockSurface(void);
00120
00122 void UnlockSurface(void);
00123
00128 CRGBColor MixColor(const CRGBColor& ColorBase, const CRGBColor& ColorAdd);
00129
00130 SDL_Surface* m_pSurface;
00131 CWindow* m_pWindow;
00132 EPaintMode m_PaintMode;
00133 };
00134
00135
00136 }
00137
00138 #endif // _WG_GRAPHICS_H_
00139