|
@@ -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());
|