mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +00:00
LibGUI+LibGfx: Paint scollbar tracks with a dithered pattern
Instead of a solid color, we now paint the track/gutter of scrollbars using a 2-color dither pattern for a pleasant millennium feel. :^)
This commit is contained in:
parent
ac701cb589
commit
9e74793ce2
3 changed files with 22 additions and 1 deletions
|
@ -136,6 +136,26 @@ void Painter::fill_rect(const Rect& a_rect, Color color)
|
|||
}
|
||||
}
|
||||
|
||||
void Painter::fill_rect_with_dither_pattern(const Rect& a_rect, Color color_a, Color color_b)
|
||||
{
|
||||
auto rect = a_rect.translated(translation()).intersected(clip_rect());
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
|
||||
RGBA32* dst = m_target->scanline(rect.top()) + rect.left();
|
||||
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
|
||||
|
||||
for (int i = 0; i < rect.height(); ++i) {
|
||||
for (int j = 0; j < rect.width(); ++j) {
|
||||
if (i & 1)
|
||||
dst[j] = (j & 1) ? color_a.value() : color_b.value();
|
||||
else
|
||||
dst[j] = (j & 1) ? color_b.value() : color_a.value();
|
||||
}
|
||||
dst += dst_skip;
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::fill_rect_with_checkerboard(const Rect& a_rect, const Size& cell_size, Color color_dark, Color color_light)
|
||||
{
|
||||
auto rect = a_rect.translated(translation()).intersected(clip_rect());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue