CYD-UI
A C++ library for building native graphic user interfaces
Loading...
Searching...
No Matches
pixelmap.cppm
Go to the documentation of this file.
1// Copyright (c) 2024, Víctor Castillo Agüero.
2// SPDX-License-Identifier: GPL-3.0-or-later
3
5
6import std;
7
8import fabric.memory.multidim_data;
9import fabric.type_aliases;
10
11export {
12struct __attribute__((packed)) pixel_t {
13 u8 b;
14 u8 g;
15 u8 r;
16 u8 a;
17};
18
19struct pixelmap_t: public md_buffer_t<pixel_t, 2> {
20 pixelmap_t(unsigned long w, unsigned long h): md_buffer_t<pixel_t, 2>({w, h}) {
21 }
22 pixelmap_t(unsigned long w, unsigned long h, pixel_t*& data): md_buffer_t<pixel_t, 2>({w, h}, data) {
23 }
24
25 [[nodiscard]] size_t width() const {
26 return size[0];
27 }
28
29 [[nodiscard]] size_t height() const {
30 return size[1];
31 }
32};
33
35
36}
size_t width() const
Definition pixelmap.cppm:25
size_t height() const
Definition pixelmap.cppm:29
pixelmap_t(unsigned long w, unsigned long h, pixel_t *&data)
Definition pixelmap.cppm:22
pixelmap_t(unsigned long w, unsigned long h)
Definition pixelmap.cppm:20
struct __attribute__((packed)) pixel_t
Definition pixelmap.cppm:12
pixelmap_t image_t
Definition pixelmap.cppm:34