summaryrefslogtreecommitdiff
path: root/Widgets/Painter.h
blob: 11b6aa7600e6006a22a2cc8b648cbc37e00c5dca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include "Color.h"
#include "Point.h"
#include "Rect.h"
#include "Size.h"
#include <AK/String.h>

class CBitmap;
class Font;
class Widget;

class Painter {
public:
    enum class TextAlignment { TopLeft, Center };
    explicit Painter(Widget&);
    ~Painter();
    void fillRect(const Rect&, Color);
    void drawRect(const Rect&, Color);
    void drawText(const Rect&, const String&, TextAlignment = TextAlignment::TopLeft, Color = Color());
    void drawBitmap(const Point&, const CBitmap&, Color = Color());
    void drawPixel(const Point&, Color);
    void drawLine(const Point& p1, const Point& p2, Color);

    void xorRect(const Rect&, Color);

    const Font& font() const;

private:
    Widget& m_widget;
    Font& m_font;
    Point m_translation;

    Rect m_clipRect;
};