6#include "fifechan/graphics.hpp"
14#include "fifechan/platform.hpp"
17#include "fifechan/cliprectangle.hpp"
18#include "fifechan/exception.hpp"
19#include "fifechan/font.hpp"
20#include "fifechan/image.hpp"
21#include "fifechan/rectangle.hpp"
29 assert(
"Width must be non-negative" && area.
width >= 0);
30 assert(
"Height must be non-negative" && area.
height >= 0);
85 if (image ==
nullptr) {
105 if (
mFont ==
nullptr) {
110 case Alignment::Left:
111 mFont->drawString(
this, text, x, y);
113 case Alignment::Center:
114 mFont->drawString(
this, text, x - (
mFont->getWidth(text) / 2), y);
116 case Alignment::Right:
117 mFont->drawString(
this, text, x -
mFont->getWidth(text), y);
A rectangle specifically used for clipping rendering regions.
int xOffset
Holds the x offset of the x coordinate.
int yOffset
Holds the y offset of the y coordinate.
Abstract interface for font rendering.
Font * mFont
Holds the current font.
Alignment
Horizontal alignments for text drawing.
virtual void popClipArea()
Removes the top most clip area from the stack.
virtual void drawImage(Image const *image, int srcX, int srcY, int dstX, int dstY, int width, int height)=0
Draws a part of an image.
void drawText(std::string const &text, int x, int y)
Draws text with a default left alignment.
virtual ClipRectangle const & getCurrentClipArea()
Gets the current clip area.
virtual bool pushClipArea(Rectangle area)
Pushes a clip area onto the stack.
virtual void setFont(Font *font)
Sets the font to use when drawing text.
virtual std::shared_ptr< Font > createFont(std::string const &filename, int size)
Creates a font for this graphics backend.
std::stack< ClipRectangle > mClipStack
Holds the clip area stack.
Abstract holder for image data.
virtual int getHeight() const =0
Gets the height of the image.
virtual int getWidth() const =0
Gets the width of the image.
Represents a rectangular area (X, Y, Width, Height).
int width
Holds the width of the rectangle.
Rectangle intersection(Rectangle const &rh) const
Gets the intersection between two rectangles.
int y
Holds the x coordinate of the rectangle.
int x
Holds the x coordinate of the rectangle.
int height
Holds the height of the rectangle.
bool isEmpty() const
Checks whether the rectangle is empty or not.
Used replacement tokens by configure_file():
void throwException(std::string const &message, std::source_location location=std::source_location::current())
Throw an Exception capturing the current source location.