mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-20 23:17:35 -04:00
Add new window to allow convenient display and globally change used color intensities for design and testing purposes. Changes were introduced to Renderer as well as GUI service to allow global change of used color scheme. When using list, screen is deep refreshed each time the color is changed. Known issues: Item focus borders (top,bottom) with changed black intensity may not render properly, however it doesn't obscure the target functionality.
31 lines
885 B
C++
31 lines
885 B
C++
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "PixelRenderer.hpp"
|
|
#include "Context.hpp"
|
|
|
|
#include <cstring>
|
|
|
|
namespace gui::renderer
|
|
{
|
|
static ColorScheme colorScheme = ::gui::Color::defaultColorScheme;
|
|
|
|
void PixelRenderer::draw(Context *ctx, Point point, Color color)
|
|
{
|
|
const auto contextWidth = ctx->getW();
|
|
const auto position = point.y * contextWidth + point.x;
|
|
|
|
std::memset(ctx->getData() + position, colorScheme.intensity[color.intensity], 1);
|
|
}
|
|
|
|
void PixelRenderer::updateColorScheme(const std::unique_ptr<ColorScheme> &scheme)
|
|
{
|
|
colorScheme = *scheme;
|
|
}
|
|
|
|
auto PixelRenderer::getColor(const uint8_t intensity) -> uint8_t
|
|
{
|
|
return colorScheme.intensity[intensity];
|
|
}
|
|
} // namespace gui::renderer
|