summaryrefslogtreecommitdiff
path: root/src/image.h
blob: b4e8a589e53340d46ed06e53ad6a570665dadf2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "constants.h"
#include "typedefs.h"

#define USER_PTR

class Pixels;

// TODO: template
struct Image
{
    int width{0};
    int height{0};
    // uint8_t data[img_height][img_width] = {{0}};

    using row_t = std::array<uint8_t, img_width>;
    using data_t = std::array<row_t, img_height>;
    using rotated_row_t = std::array<uint8_t, img_height>;
    using column_t = rotated_row_t;
    using rotated_data_t = std::array<column_t, img_width>;
    // data_t d;
    data_t data;
    // data_t *data;
    // uint8_t *data = {nullptr};
    // uint8_t &dataAt(size_t row, size_t col);
    // uint8_t rotated_cw[img_width][img_height] = {{0}};
    rotated_data_t rotated_cw;
    // size_t dataSize{0};
    // unsigned int stride{0};
    libcamera::PixelFormat pixelFormat{0};
    Counters counters{};

    void rotate();
    std::shared_ptr<Pixels> pixels() const;
    void copyFromData(const void* src, size_t size);
};