#include <wg_painter.h>
Definition at line 40 of file wg_painter.h.
A mode for painting the surface can be specified currently this does not work for the DrawHLine, DrawVLine, or DrawRect methods
Definition at line 45 of file wg_painter.h.
wGui::CPainter::CPainter | ( | SDL_Surface * | pSurface, | |
EPaintMode | ePaintMode = PAINT_NORMAL | |||
) |
Construct a new Painter object
pSurface | A pointer to the SDL surface to draw to | |
ePaintMode | The painting mode to use, defaults to PAINT_NORMAL |
Definition at line 35 of file wg_painter.cpp.
References m_pSurface.
wGui::CPainter::CPainter | ( | CWindow * | pWindow, | |
EPaintMode | ePaintMode = PAINT_NORMAL | |||
) |
Construct a new Painter object
pWindow | A pointer to the CWindow to draw to, this will only allow drawing to the window's client area | |
ePaintMode | The painting mode to use, defaults to PAINT_NORMAL |
Definition at line 47 of file wg_painter.cpp.
References wGui::CWindow::GetSDLSurface(), m_pSurface, and m_pWindow.
void wGui::CPainter::DrawHLine | ( | int | xStart, | |
int | xEnd, | |||
int | y, | |||
const CRGBColor & | LineColor = DEFAULT_LINE_COLOR | |||
) |
Draw a horizontal line
xStart | The start position of the line | |
xEnd | The end position of the line | |
y | The vertical location of the line | |
LineColor | The color of the line |
Definition at line 64 of file wg_painter.cpp.
References wGui::CWindow::GetClientRect(), m_pSurface, m_pWindow, wGui::CRGBColor::SDLColor(), wGui::CRect::TopLeft(), wGui::CPoint::XPos(), and wGui::CPoint::YPos().
Referenced by wGui::CScrollBar::Draw(), wGui::CProgress::Draw(), wGui::CPopupMenu::Draw(), wGui::CFrame::Draw(), wGui::CCheckBox::Draw(), wGui::CPictureButton::Draw(), wGui::CButton::Draw(), and DrawRect().
void wGui::CPainter::DrawVLine | ( | int | yStart, | |
int | yEnd, | |||
int | x, | |||
const CRGBColor & | LineColor = DEFAULT_LINE_COLOR | |||
) |
Draw a vertical line
yStart | The start position of the line | |
yEnd | The end position of the line | |
x | The horizontal location of the line | |
LineColor | The color of the line |
Definition at line 82 of file wg_painter.cpp.
References wGui::CWindow::GetClientRect(), m_pSurface, m_pWindow, wGui::CRGBColor::SDLColor(), wGui::CRect::TopLeft(), wGui::CPoint::XPos(), and wGui::CPoint::YPos().
Referenced by wGui::CTextBox::Draw(), wGui::CScrollBar::Draw(), wGui::CProgress::Draw(), wGui::CPopupMenu::Draw(), wGui::CMenu::Draw(), wGui::CFrame::Draw(), wGui::CEditBox::Draw(), wGui::CCheckBox::Draw(), wGui::CPictureButton::Draw(), wGui::CButton::Draw(), DrawLine(), and DrawRect().
void wGui::CPainter::DrawRect | ( | const CRect & | Rect, | |
bool | bFilled, | |||
const CRGBColor & | BorderColor = DEFAULT_LINE_COLOR , |
|||
const CRGBColor & | FillColor = DEFAULT_FOREGROUND_COLOR | |||
) |
Draw a rectangle (this has been optimized to work much faster for filled rects in PAINT_REPLACE mode)
Rect | A CRect that describes the rectangle | |
bFilled | If true, rectangle will be filled with the FillColor, otherwise only the border is drawn | |
BorderColor | The color for the border | |
FillColor | The color to fill the rectangle with |
Definition at line 100 of file wg_painter.cpp.
References wGui::CRect::Bottom(), wGui::CRect::ClipTo(), DrawHLine(), DrawPoint(), DrawVLine(), wGui::CWindow::GetClientRect(), wGui::CRect::Grow(), wGui::CRect::Left(), m_PaintMode, m_pSurface, m_pWindow, PAINT_REPLACE, wGui::CRect::Right(), wGui::CRGBColor::SDLColor(), wGui::CRect::SDLRect(), wGui::CRect::Top(), and wGui::CRect::TopLeft().
Referenced by wGui::CWindow::Draw(), wGui::CToolTip::Draw(), wGui::CTextBox::Draw(), wGui::CScrollBar::Draw(), wGui::CProgress::Draw(), wGui::CPopupMenu::Draw(), wGui::CMenu::Draw(), wGui::CListBox::Draw(), wGui::CGroupBox::Draw(), wGui::CFrame::Draw(), wGui::CEditBox::Draw(), wGui::CCheckBox::Draw(), wGui::CPictureButton::Draw(), and wGui::CButton::Draw().
void wGui::CPainter::DrawLine | ( | const CPoint & | StartPoint, | |
const CPoint & | EndPoint, | |||
const CRGBColor & | LineColor = DEFAULT_LINE_COLOR | |||
) |
Draw a line between two points
StartPoint | The beginning point of the line | |
EndPoint | The end point of the line | |
LineColor | The color to use for drawing the line |
Definition at line 138 of file wg_painter.cpp.
References DrawPoint(), DrawVLine(), wGui::CPoint::XPos(), and wGui::CPoint::YPos().
Referenced by wGui::CCheckBox::Draw().
void wGui::CPainter::DrawPoint | ( | const CPoint & | Point, | |
const CRGBColor & | PointColor = DEFAULT_LINE_COLOR | |||
) |
Draw a pixel
Point | The location of the pixel to set | |
PointColor | The color to set the pixel to |
Definition at line 169 of file wg_painter.cpp.
References wGui::CWindow::GetClientRect(), LockSurface(), m_pSurface, m_pWindow, MixColor(), ReadPoint(), wGui::CRect::RELPOS_INSIDE, wGui::CRGBColor::SDLColor(), wGui::CRect::TopLeft(), UnlockSurface(), wGui::CPoint::XPos(), and wGui::CPoint::YPos().
Referenced by wGui::CRenderedString::Draw(), DrawLine(), DrawRect(), and ReplaceColor().
Get the color of the pixel at the given point
Point | The location of the pixel to read |
Definition at line 207 of file wg_painter.cpp.
References wGui::CWindow::GetClientRect(), m_pSurface, m_pWindow, wGui::CRect::RELPOS_INSIDE, wGui::CRect::TopLeft(), wGui::CPoint::XPos(), and wGui::CPoint::YPos().
Referenced by DrawPoint(), and ReplaceColor().
Replace all pixels of a certain color with a new color
NewColor | The color value to replace the pixels with | |
OldColor | The color of the pixels to be replaced |
Definition at line 301 of file wg_painter.cpp.
References DrawPoint(), m_pSurface, and ReadPoint().
void wGui::CPainter::TransparentColor | ( | const CRGBColor & | TransparentColor | ) |
Sets the transparent pixel
TransparentColor | The pixel color to be treated as transparent |
Definition at line 317 of file wg_painter.cpp.
References m_pSurface.
CRGBColor wGui::CPainter::MixColor | ( | const CRGBColor & | ColorBase, | |
const CRGBColor & | ColorAdd | |||
) | [protected] |
Mixes thje two colors based on the painting mode
ColorBase | The color to use as the base | |
ColorAdd | The color to add to the base |
Definition at line 269 of file wg_painter.cpp.
References wGui::COLOR_TRANSPARENT, m_PaintMode, wGui::CRGBColor::MixNormal(), PAINT_ADDITIVE, PAINT_AND, PAINT_IGNORE, PAINT_NORMAL, PAINT_OR, PAINT_REPLACE, and PAINT_XOR.
Referenced by DrawPoint().