Files
Upsilon/kandinsky/include/kandinsky/context.h
Émilie Feral 9d0354f3bd [kandinsky] Add a default font size : large
Change-Id: I6b9f1a7b09292f120074c8957e328ddc33023c67
2017-01-27 12:03:06 +01:00

43 lines
1.6 KiB
C++

#ifndef KANDINSKY_CONTEXT_H
#define KANDINSKY_CONTEXT_H
#include <kandinsky/color.h>
#include <kandinsky/rect.h>
#include <kandinsky/text.h>
class KDContext {
public:
void setOrigin(KDPoint origin);
void setClippingRect(KDRect clippingRect);
// Pixel manipulation
void setPixel(KDPoint p, KDColor c);
KDColor getPixel(KDPoint p);
// Text
void drawChar(char character, KDPoint p, KDText::FontSize size = KDText::FontSize::Large, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void drawString(const char * text, KDPoint p, KDText::FontSize size = KDText::FontSize::Large, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void blendChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor = KDColorBlack);
void blendString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor = KDColorBlack);
// Line. Not anti-aliased.
void drawLine(KDPoint p1, KDPoint p2, KDColor c);
// Rect
void fillRect(KDRect rect, KDColor color);
void fillRectWithPixels(KDRect rect, const KDColor * pixels, KDColor * workingBuffer);
void blendRectWithMask(KDRect rect, KDColor color, const uint8_t * mask, KDColor * workingBuffer);
void drawRect(KDRect rect, KDColor color);
protected:
KDContext(KDPoint origin, KDRect clippingRect);
virtual void pushRect(KDRect, const KDColor * pixels) = 0;
virtual void pushRectUniform(KDRect rect, KDColor color) = 0;
virtual void pullRect(KDRect rect, KDColor * pixels) = 0;
private:
KDRect absoluteFillRect(KDRect rect);
KDPoint m_origin;
KDRect m_clippingRect;
};
#endif