acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
header.h
1#pragma once
2
3
4//#include "acme/prototype/geometry2d/_geometry2d.h"
5//#include "acme/prototype/prototype/_u32hash.h"
6#include "acme/prototype/geometry2d/size.h"
7
8
9//#pragma pack(push, image_header, 1)
10
11
12#ifdef __cplusplus
13struct CLASS_DECL_ACME image_header
14#else
16#endif
17{
18
19
20 enum_image_type m_etype;
21 ::color::color m_color;
22 ::i32_size m_size;
23
24
25#ifdef __cplusplus
26
27
28 image_header() :
29 m_size(0, 0)
30 {
31
32 m_etype = e_image_type_complex;
33 // m_cr = 0;
34
35 }
36
37 bool operator == (const image_header & imageheader) const
38 {
39
40 if (m_etype != imageheader.m_etype)
41 return false;
42
43 if (m_size != imageheader.m_size)
44 return false;
45
46 switch (m_etype)
47 {
48 case e_image_type_plain_color:
49 return m_color == imageheader.m_color;
50 default:
51 return true;
52 };
53
54 }
55
56 bool operator != (const image_header & d) const
57 {
58 return !operator ==(d);
59 }
60
61 ::i32 width() const { return m_size.cx; }
62 ::i32 height() const { return m_size.cy; }
63 ::i32 area() const { return m_size.area(); }
64 ::i32_size size() const { return m_size; }
65
66 void reset()
67 {
68
69 m_size.Null();
70 m_color = {};
71 m_etype = e_image_type_complex;
72
73
74 }
75
76
77#endif
78
79
80 constexpr operator ::hash32() const
81 {
82 ::u32 u = (::u32)m_etype;
83 if(m_etype == ::e_image_type_plain_color)
84 {
85 u |= m_color.m_u32;
86 }
87 u |= m_size.cx << 16;
88 u |= m_size.cy << 24;
89 return { u };
90 }
91
92
93
94};
95
96
97
98
99//#pragma pack(pop, image_header)
100
101
102
Definition color.h:162
Definition header.h:17