Haio
0.2.X
Homebrew Asset IO/CDN
Toggle main menu visibility
Loading...
Searching...
No Matches
detect.cpp
Go to the documentation of this file.
1
#include <
haio_codec.hpp
>
2
#include <
haio_util.hpp
>
3
4
namespace
{
5
6
constexpr
std::array<uint8_t, 6> signature87a = {
7
'G'
,
'I'
,
'F'
,
'8'
,
'7'
,
'a'
8
};
9
10
constexpr
std::array<uint8_t, 6> signature89a = {
11
'G'
,
'I'
,
'F'
,
'8'
,
'9'
,
'a'
12
};
13
14
bool
headerSays(
Haio::Bytes
data) {
15
return
Haio::Util::matches
(data, signature87a)
16
||
Haio::Util::matches
(data, signature89a);
17
}
18
19
}
20
21
namespace
Haio::Codecs
{
22
23
/** what a gif holds when nobody asks for something else */
24
template
<>
struct
DefaultColor
<
Format
::
GIF
> {
static
constexpr
Color
value
=
Color::RGBA8888
; };
25
26
/**
27
* @addtogroup detect
28
* @{
29
*/
30
template
<>
31
bool
Detect<Format::GIF, Color::RGBA8888>
(
Bytes
data) {
32
return
headerSays(data);
33
}
34
/** @} */
35
36
/**
37
* @addtogroup detect
38
* @{
39
*/
40
/**
41
* GIF has a palette rather than an RGB colour type, but the decoder expands
42
* it directly to RGB888.
43
*/
44
template
<>
45
bool
Detect<Format::GIF, Color::RGB888>
(
Bytes
data) {
46
return
headerSays(data);
47
}
48
/** @} */
49
50
}
Haio::Codecs::Detect< Format::GIF, Color::RGB888 >
bool Detect< Format::GIF, Color::RGB888 >(Bytes data)
Definition
detect.cpp:45
Haio::Codecs::Detect< Format::GIF, Color::RGBA8888 >
bool Detect< Format::GIF, Color::RGBA8888 >(Bytes data)
Definition
detect.cpp:31
haio_codec.hpp
haio_util.hpp
Haio::Codecs
Definition
haio_codec.hpp:136
Haio::Codecs::DefaultColor
Definition
haio_codec.hpp:143
Haio::Util::matches
bool matches(Bytes data, Bytes magic)
Definition
matches.cpp:7
Haio::Color
Color
Definition
haio_formats.hpp:106
Haio::Color::RGBA8888
@ RGBA8888
Definition
haio_formats.hpp:107
Haio::Format
Format
Definition
haio_formats.hpp:17
Haio::Format::GIF
@ GIF
Definition
haio_formats.hpp:99
Haio::Bytes
std::span< const uint8_t > Bytes
Definition
haio_codec.hpp:14
Haio::Codecs::DefaultColor< Format::GIF >::value
static constexpr Color value
Definition
detect.cpp:24
library
backend
codecs
container
gif
detect.cpp
Generated by
1.18.0