rewrite time

This commit is contained in:
Jorijn van der Graaf 2025-11-22 20:58:42 +01:00
commit 4428cfe12c
24 changed files with 1208 additions and 893 deletions

View file

@ -0,0 +1,51 @@
/*
Crafter®.Graphics
Copyright (C) 2025 Catcrafts®
catcrafts.net
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 3.0 as published by the Free Software Foundation;
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
export module Crafter.Graphics:UiElementBuffer;
import std;
import :Types;
export namespace Crafter {
class UiElementBase;
class WindowFramebuffer;
class UiElementBuffer {
public:
UiElementBase& parent;
std::uint_fast32_t width;
std::uint_fast32_t height;
std::vector<Pixel_BU8_GU8_RU8_AU8> buffer;
UiElementBuffer(UiElementBase& parent);
UiElementBuffer(UiElementBase& parent, std::uint_fast32_t width, std::uint_fast32_t height);
void DrawNearestNeighbour(Pixel_BU8_GU8_RU8_AU8* dst, std::uint_fast32_t dstWidth, std::uint_fast32_t dstHeight) const;
ScaleData ScaleElement(const UiElementBase& element, ScaleData own, WindowFramebuffer& window) const;
void Create(std::uint_fast32_t width, std::uint_fast32_t height);
void Destroy();
void Write(Pixel_BU8_GU8_RU8_AU8* pixels);
void Write(std::uint_fast32_t x, std::uint_fast32_t y, Pixel_BU8_GU8_RU8_AU8 pixel);
Pixel_BU8_GU8_RU8_AU8 Read(std::uint_fast32_t x, std::uint_fast32_t y);
Pixel_BU8_GU8_RU8_AU8* Read();
Pixel_BU8_GU8_RU8_AU8* Get();
void Store();
};
}