view ostc45_icon.h @ 5:115cfa4a3239 default tip

Added icon upload function for OSTC 4/5 For the upload the same process as the one for the firmware update is used => CRC functionality has been copied from the ostc_pack SW
author Ideenmodellierer
date Tue, 30 Dec 2025 21:41:02 +0100
parents
children
line wrap: on
line source

#ifndef OSTC45_ICON_H
#define OSTC45_ICON_H

#include <cstdint>
#include <vector>
#include <stdexcept>
#include <iostream>
#include <QString>
#include <QVector>
#include <QIODevice>
#include <QFile>
#include <QByteArray>

class BmpToArray
{
public:
    struct CLUTEntry {
        uint8_t b;
        uint8_t g;
        uint8_t r;
        uint8_t a; // BMP setzt meist 0
    };

    QByteArray getTransferBytes() const;
    void getImageXY(uint32_t* x, uint32_t* y);
    BmpToArray(const QString& fileName);

private:
    void loadBMP(const QString& filename);

    QVector<CLUTEntry> clut;
    QVector<uint8_t> pixelData;     // Pixel-Indizes
    QVector<uint32_t> clut32;       // 32-Bit Palette
    uint32_t width = 0;
    uint32_t height = 0;
};
#endif // OSTC45_ICON_H