Draw checkers for transparent color in ui::color_view
This commit is contained in:
parent
8e0c27c8c0
commit
17bb412140
1 changed files with 22 additions and 1 deletions
|
|
@ -29,7 +29,28 @@ namespace psemek::ui
|
|||
box[1] = geom::expand(geom::interval<float>::singleton(box[1].center()), box[0].length() / 2.f);
|
||||
}
|
||||
|
||||
p.draw_rect(box, color_);
|
||||
if (color_[3] != 255)
|
||||
{
|
||||
p.draw_rect(box, {255, 255, 255, 255});
|
||||
|
||||
int const n = 4;
|
||||
geom::vector<float, 2> d = box.dimensions() / (n * 1.f);
|
||||
|
||||
for (int x = 0; x < n; ++x)
|
||||
{
|
||||
for (int y = 0; y < n; ++y)
|
||||
{
|
||||
if ((x + y) % 2 == 0) continue;
|
||||
|
||||
auto origin = box.corner(0.f, 0.f) + geom::pointwise_mult(d, {x * 1.f, y});
|
||||
|
||||
p.draw_rect(geom::span(origin, origin + d), {191, 191, 191, 255});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (color_[3] != 0)
|
||||
p.draw_rect(box, color_);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue