6#ifndef INCLUDE_FIFECHAN_BACKENDS_SDL_GRAPHICS_HPP_
7#define INCLUDE_FIFECHAN_BACKENDS_SDL_GRAPHICS_HPP_
14#include "fifechan/color.hpp"
15#include "fifechan/graphics.hpp"
16#include "fifechan/platform.hpp"
40 Graphics(Graphics
const &) =
delete;
41 Graphics& operator=(Graphics
const &) =
delete;
42 Graphics(Graphics&&) =
delete;
43 Graphics& operator=(Graphics&&) =
delete;
52 virtual void setTarget(SDL_Renderer* renderer,
int width,
int height);
66 virtual void drawSDLTexture(SDL_Texture* texture, SDL_Rect source, SDL_Rect destination);
75 fcn::Image const * image,
int srcX,
int srcY,
int dstX,
int dstY,
int width,
int height)
override;
77 void drawLine(
int x1,
int y1,
int x2,
int y2)
override;
78 void drawLine(
int x1,
int y1,
int x2,
int y2,
unsigned int width)
override;
79 void drawRoundStroke(
int x1,
int y1,
int x2,
int y2,
unsigned int width)
override;
84 void drawPolyLine(PointVector
const & points,
unsigned int width)
override;
85 void drawBezier(PointVector
const & points,
int segments,
unsigned int width)
override;
94 std::shared_ptr<Font>
createFont(std::string
const & filename,
int size)
override;
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Abstract holder for image data.
Represents a 2D coordinate (X, Y).
Represents a rectangular area (X, Y, Width, Height).
Color mColor
Current drawing color.
void drawPolyLine(PointVector const &points, unsigned int width) override
Draws lines between points with given width.
Uint8 r
Cached renderer color components (previous renderer color).
Uint8 a
Previous alpha component from renderer.
virtual void drawSDLTexture(SDL_Texture *texture, SDL_Rect source, SDL_Rect destination)
Draws an SDL_Texture on the target surface.
void drawLine(int x1, int y1, int x2, int y2) override
Draws a line.
void popClipArea() override
Removes the top most clip area from the stack.
void drawFillCircleSegment(Point const ¢er, unsigned int radius, int startAngle, int endAngle) override
Draws a filled circle segment.
void restoreRenderColor()
Restore the rendering color after drawing.
void drawRoundStroke(int x1, int y1, int x2, int y2, unsigned int width) override
Draws a round brush stroke along the line segment.
void _beginDraw() override
Initializes drawing.
virtual void setTarget(SDL_Renderer *renderer, int width, int height)
Sets the target SDL_Renderer to use for drawing.
int mHeight
Screen height.
void drawHorizontalLine(int x1, int y, int x2)
Draws a horizontal line.
void saveRenderColor()
Save the current rendering color before drawing.
void drawFillCircle(Point const ¢er, unsigned int radius) override
Draws a filled circle.
void drawImage(fcn::Image const *image, int srcX, int srcY, int dstX, int dstY, int width, int height) override
Draws a part of an image.
std::shared_ptr< Font > createFont(std::string const &filename, int size) override
Creates a font for this graphics backend.
Uint8 g
Previous green component from renderer.
SDL_Renderer * mRenderTarget
The SDL_Renderer used for accelerated drawing.
bool pushClipArea(fcn::Rectangle area) override
Pushes a clip area onto the stack.
void drawPoint(int x, int y) override
Draws a single point/pixel.
Color const & getColor() const override
Gets the color to use when drawing.
void drawCircleSegment(Point const ¢er, unsigned int radius, int startAngle, int endAngle) override
Draws a simple, non-filled circle segment with a one pixel width.
Uint8 b
Previous blue component from renderer.
void setColor(Color const &color) override
Sets the color to use when drawing.
void drawVerticalLine(int x, int y1, int y2)
Draws a vertical line.
bool mAlpha
Whether alpha blending is enabled.
void drawRectangle(Rectangle const &rectangle) override
Draws a simple, non-filled rectangle with a one pixel width.
virtual SDL_Renderer * getRenderTarget() const
Gets the target SDL_Renderer.
void _endDraw() override
Deinitializes the drawing process.
void fillRectangle(Rectangle const &rectangle) override
Draws a filled rectangle.
void drawCircle(Point const ¢er, unsigned int radius) override
Draws a simple, non-filled circle with a one pixel width.
void drawBezier(PointVector const &points, int segments, unsigned int width) override
Draws a bezier curve.
Unified header for the SDL backend.