mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
Make a SharedGraphics directory for classes shared between Kernel and LibGUI.
This commit is contained in:
parent
b75ee4aacb
commit
7e5b81fe48
31 changed files with 49 additions and 41 deletions
47
SharedGraphics/Painter.h
Normal file
47
SharedGraphics/Painter.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
#pragma once
|
||||
|
||||
#include "Color.h"
|
||||
#include "Point.h"
|
||||
#include "Rect.h"
|
||||
#include "Size.h"
|
||||
#include <AK/AKString.h>
|
||||
|
||||
class CharacterBitmap;
|
||||
class GraphicsBitmap;
|
||||
class Font;
|
||||
class Widget;
|
||||
class Window;
|
||||
|
||||
class Painter {
|
||||
public:
|
||||
explicit Painter(Widget&);
|
||||
explicit Painter(GraphicsBitmap&);
|
||||
~Painter();
|
||||
void fill_rect(const Rect&, Color);
|
||||
void draw_rect(const Rect&, Color);
|
||||
void draw_bitmap(const Point&, const CharacterBitmap&, Color = Color());
|
||||
void set_pixel(const Point&, Color);
|
||||
void draw_line(const Point&, const Point&, Color);
|
||||
void draw_focus_rect(const Rect&);
|
||||
void blit(const Point&, const GraphicsBitmap&);
|
||||
|
||||
enum class TextAlignment { TopLeft, CenterLeft, Center };
|
||||
void draw_text(const Rect&, const String&, TextAlignment = TextAlignment::TopLeft, Color = Color());
|
||||
void draw_glyph(const Point&, char, Color);
|
||||
|
||||
const Font& font() const { return *m_font; }
|
||||
|
||||
enum class DrawOp { Copy, Xor };
|
||||
void set_draw_op(DrawOp op) { m_draw_op = op; }
|
||||
DrawOp draw_op() const { return m_draw_op; }
|
||||
|
||||
private:
|
||||
void set_pixel_with_draw_op(dword& pixel, const Color&);
|
||||
|
||||
const Font* m_font;
|
||||
Point m_translation;
|
||||
Rect m_clip_rect;
|
||||
RetainPtr<GraphicsBitmap> m_target;
|
||||
Window* m_window { nullptr };
|
||||
DrawOp m_draw_op { DrawOp::Copy };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue