mirror of
https://github.com/RGBCube/serenity
synced 2025-07-19 09:27:34 +00:00
LibGfx: Add a way to get the Painter's current 2D translation
This commit is contained in:
parent
46a13c3d2e
commit
a494bd24f1
1 changed files with 2 additions and 1 deletions
|
@ -142,6 +142,8 @@ public:
|
||||||
void translate(int dx, int dy) { translate({ dx, dy }); }
|
void translate(int dx, int dy) { translate({ dx, dy }); }
|
||||||
void translate(IntPoint const& delta) { state().translation.translate_by(delta); }
|
void translate(IntPoint const& delta) { state().translation.translate_by(delta); }
|
||||||
|
|
||||||
|
IntPoint translation() const { return state().translation; }
|
||||||
|
|
||||||
Gfx::Bitmap* target() { return m_target.ptr(); }
|
Gfx::Bitmap* target() { return m_target.ptr(); }
|
||||||
|
|
||||||
void save() { m_state_stack.append(m_state_stack.last()); }
|
void save() { m_state_stack.append(m_state_stack.last()); }
|
||||||
|
@ -156,7 +158,6 @@ public:
|
||||||
int scale() const { return state().scale; }
|
int scale() const { return state().scale; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IntPoint translation() const { return state().translation; }
|
|
||||||
IntRect to_physical(IntRect const& r) const { return r.translated(translation()) * scale(); }
|
IntRect to_physical(IntRect const& r) const { return r.translated(translation()) * scale(); }
|
||||||
IntPoint to_physical(IntPoint const& p) const { return p.translated(translation()) * scale(); }
|
IntPoint to_physical(IntPoint const& p) const { return p.translated(translation()) * scale(); }
|
||||||
void set_physical_pixel_with_draw_op(u32& pixel, Color const&);
|
void set_physical_pixel_with_draw_op(u32& pixel, Color const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue