mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibGfx: Reduce code duplication in Painter::draw_text
Use the same logic for all variants for Painter::draw_text. Also, add an overload that allows taking a callback function for custom gylph drawing. This allows drawing some glyphs differently in the correct location when drawing more complex strings (e.g. multi-line, elisions, etc).
This commit is contained in:
parent
25e7225782
commit
f239fbaa58
2 changed files with 132 additions and 172 deletions
|
@ -79,6 +79,9 @@ public:
|
|||
void draw_text(const IntRect&, const StringView&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
|
||||
void draw_text(const IntRect&, const Utf32View&, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
|
||||
void draw_text(const IntRect&, const Utf32View&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
|
||||
void draw_text(Function<void(const IntRect&, u32)>, const IntRect&, const StringView&, const Font&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None);
|
||||
void draw_text(Function<void(const IntRect&, u32)>, const IntRect&, const Utf8View&, const Font&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None);
|
||||
void draw_text(Function<void(const IntRect&, u32)>, const IntRect&, const Utf32View&, const Font&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None);
|
||||
void draw_glyph(const IntPoint&, u32, Color);
|
||||
void draw_glyph(const IntPoint&, u32, const Font&, Color);
|
||||
void draw_emoji(const IntPoint&, const Gfx::Bitmap&, const Font&);
|
||||
|
@ -135,9 +138,6 @@ protected:
|
|||
void blit_with_opacity(const IntPoint&, const Gfx::Bitmap&, const IntRect& src_rect, float opacity);
|
||||
void draw_pixel(const IntPoint&, Color, int thickness = 1);
|
||||
|
||||
void draw_text_line(const IntRect&, const Utf8View&, const Font&, TextAlignment, Color, TextElision);
|
||||
void draw_text_line(const IntRect&, const Utf32View&, const Font&, TextAlignment, Color, TextElision);
|
||||
|
||||
struct State {
|
||||
const Font* font;
|
||||
IntPoint translation;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue