26 #include <fifechan/font.hpp> 51 void SdlGuiGraphics::drawImage(
const fcn::Image* image, int32_t srcX, int32_t srcY, int32_t dstX, int32_t dstY, int32_t width, int32_t height) {
56 const fcn::ClipRectangle& clip = getCurrentClipArea();
57 Rect rect(dstX, dstY, width, height);
58 rect.
x += clip.xOffset;
59 rect.
y += clip.yOffset;
67 throw GuiException(
"SdlGuiGraphics::drawText() - No font set!");
73 mFont->drawString(
this, text, x, y);
76 mFont->drawString(
this, text, x - mFont->getWidth(text) / 2, y);
79 mFont->drawString(
this, text, x - mFont->getWidth(text), y);
82 FL_WARN(
_log,
LMsg(
"SdlGuiGraphics::drawText() - ") <<
"Unknown alignment: " << alignment);
83 mFont->drawString(
this, text, x, y);
88 const fcn::ClipRectangle& top = mClipStack.top();
90 mColor.r, mColor.g, mColor.b, mColor.a);
94 const fcn::ClipRectangle& top = mClipStack.top();
99 const fcn::ClipRectangle& top = mClipStack.top();
104 const fcn::ClipRectangle& top = mClipStack.top();
105 std::vector<Point> npoints;
106 fcn::PointVector::const_iterator it = points.begin();
107 for (; it != points.end(); ++it) {
108 npoints.push_back(
Point((*it).x+top.xOffset, (*it).y+top.yOffset));
114 const fcn::ClipRectangle& top = mClipStack.top();
115 std::vector<Point> npoints;
116 fcn::PointVector::const_iterator it = points.begin();
117 for (; it != points.end(); ++it) {
118 npoints.push_back(
Point((*it).x+top.xOffset, (*it).y+top.yOffset));
124 const fcn::ClipRectangle& top = mClipStack.top();
126 Point(rectangle.x + top.xOffset, rectangle.y + top.yOffset),
127 rectangle.width, rectangle.height,
128 mColor.r, mColor.g, mColor.b, mColor.a);
132 const fcn::ClipRectangle& top = mClipStack.top();
134 Point(rectangle.x + top.xOffset, rectangle.y + top.yOffset),
135 rectangle.width, rectangle.height,
136 mColor.r, mColor.g, mColor.b, mColor.a);
140 const fcn::ClipRectangle& top = mClipStack.top();
145 const fcn::ClipRectangle& top = mClipStack.top();
150 const fcn::ClipRectangle& top = mClipStack.top();
155 const fcn::ClipRectangle& top = mClipStack.top();
160 fcn::Rectangle area(0, 0, mTarget->w, mTarget->h);
161 fcn::Graphics::pushClipArea(area);
167 fcn::Graphics::popClipArea();
172 fcn::Graphics::pushClipArea(area);
177 const fcn::ClipRectangle& top = mClipStack.top();
180 Rect(top.x, top.y, top.width, top.height),
false);
186 fcn::Graphics::popClipArea();
#define FL_WARN(logger, msg)
virtual void drawRectangle(const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws an axis parallel rectangle.
virtual void drawRectangle(const fcn::Rectangle &rectangle)
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
SdlGuiGraphics()
Constructor.
virtual void setColor(const fcn::Color &color)
virtual void drawCircleSegment(const fcn::Point &p, uint32_t radius, int32_t sangle, int32_t eangle)
static Logger _log(LM_AUDIO)
std::vector< Point > PointVector
virtual void drawThickLine(const Point &p1, const Point &p2, uint8_t width, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws line between given points with given RGBA and width.
virtual void drawCircle(const Point &p, uint32_t radius, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws a circle.
virtual void drawFillCircleSegment(const fcn::Point &p, uint32_t radius, int32_t sangle, int32_t eangle)
static RenderBackend * instance()
virtual void drawPolyLine(const std::vector< Point > &points, uint8_t width, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws lines between given points with given RGBA and width.
virtual void drawFillCircle(const Point &p, uint32_t radius, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws a filled circle.
virtual void drawCircleSegment(const Point &p, uint32_t radius, int32_t sangle, int32_t eangle, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws a circle segment.
virtual void drawPoint(int32_t x, int32_t y)
PointType2D< int32_t > Point
void pushClipArea(const Rect &cliparea, bool clear=true)
Pushes clip area to clip stack Clip areas define which area is drawn on screen.
virtual void drawText(const std::string &text, int32_t x, int32_t y, uint32_t alignment)
virtual void popClipArea()
SDL_Surface * getScreenSurface()
Returns screen render surface.
virtual bool putPixel(int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Writes pixel to given position.
void popClipArea()
Pops clip area from clip stack.
virtual void drawLine(const Point &p1, const Point &p2, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws line between given points with given RGBA.
virtual void drawImage(const fcn::Image *image, int32_t srcX, int32_t srcY, int32_t dstX, int32_t dstY, int32_t width, int32_t height)
virtual void drawPolyLine(const fcn::PointVector &points, uint32_t width)
virtual bool pushClipArea(fcn::Rectangle area)
virtual void render(const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)=0
Renders itself to the current render target (main screen or attached destination image) at the rectan...
virtual void fillRectangle(const fcn::Rectangle &rectangle)
virtual void drawFillCircle(const fcn::Point &p, uint32_t radius)
virtual void fillRectangle(const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws a filled axis parallel rectangle.
virtual void _beginDraw()
virtual void drawCircle(const fcn::Point &p, uint32_t radius)
virtual void drawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
virtual void drawBezier(const fcn::PointVector &points, int32_t steps, uint32_t width)
virtual void drawBezier(const std::vector< Point > &points, int32_t steps, uint8_t width, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws bezier curve between given points with given RGBA and width.
RenderBackend * m_renderbackend
virtual void drawFillCircleSegment(const Point &p, uint32_t radius, int32_t sangle, int32_t eangle, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws a filled circle segment.
ImagePtr getFIFEImage() const