Fix Monochrome class with new data structure, unit tests. There is work to be done still
All checks were successful
Build ptprnt / build (push) Successful in 3m51s

This commit is contained in:
2025-09-11 10:02:43 +02:00
parent 5132eab6fa
commit 3dc5da6fc8
16 changed files with 436 additions and 131 deletions

View File

@@ -19,19 +19,17 @@
#pragma once
#include <stdint.h>
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <vector>
namespace ptprnt::graphics {
typedef uint8_t ALPHA8; // Alpha only, 8 bit per pixel
typedef uint32_t RGBX8; // RGB, least significant byte unused, 8 bit per channel
typedef uint32_t RGBA8; // RGB, least significant byte alpha, 8 bit per channel
typedef uint32_t ARGB8; // RGB, most significant byte alpha, 8 bit per channel
using ALPHA8 = std::uint8_t; // Alpha only, 8 bit per pixel
using RGBX8 = std::uint32_t; // RGB, least significant byte unused, 8 bit per channel
using RGBA8 = std::uint32_t; // RGB, least significant byte alpha, 8 bit per channel
using ARGB8 = std::uint32_t; // RGB, most significant byte alpha, 8 bit per channel
template <class T>
class Bitmap {
@@ -48,8 +46,8 @@ class Bitmap {
[[nodiscard]] uint16_t getHeight() const;
bool setPixels(const std::vector<T>& pixels);
[[nodiscard]] std::vector<T> getPixelsCpy() const;
[[nodiscard]] std::optional<std::vector<T>> getLine(uint16_t line) const;
[[nodiscard]] std::optional<std::vector<T>> getCol(uint16_t col) const;
[[nodiscard]] std::vector<T> getLine(uint16_t line) const;
[[nodiscard]] std::vector<T> getCol(uint16_t col) const;
void visualize() const;
private: