opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
liboscar
formats
image.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
liboscar/concepts/named_input_stream.h
>
4
#include <
liboscar/formats/image_loading_flags.h
>
5
#include <
liboscar/graphics/color_space.h
>
6
#include <
liboscar/graphics/texture2d.h
>
7
8
#include <iosfwd>
9
#include <utility>
10
11
namespace
osc
12
{
13
class
Image
final
{
14
public
:
15
// Read the given (named) image stream into a `Texture2D`.
16
//
17
// Throws if the image data isn't representable as a GPU texture (e.g. because it has
18
// an incorrect number of components).
19
static
Texture2D
read_into_texture
(
20
std::istream&,
21
std::string_view
input_name
,
22
ColorSpace
,
23
ImageLoadingFlags
= {}
24
);
25
26
template
<NamedInputStream Stream>
27
static
Texture2D
read_into_texture
(
28
Stream
&& stream,
29
ColorSpace
color_space,
30
ImageLoadingFlags
flags = {})
31
{
32
return
read_into_texture
(
33
std::forward<Stream>(stream),
34
stream.name(),
35
color_space,
36
flags
37
);
38
}
39
};
40
41
class
PNG
final
{
42
public
:
43
static
void
write
(std::ostream&,
const
Texture2D
&);
44
};
45
46
class
JPEG
final
{
47
public
:
48
static
void
write
(std::ostream&,
const
Texture2D
&,
float
quality
= 0.9f);
49
};
50
}
osc::Flags
Definition
flags.h:20
osc::Image
Definition
image.h:13
osc::Image::read_into_texture
static Texture2D read_into_texture(Stream &&stream, ColorSpace color_space, ImageLoadingFlags flags={})
Definition
image.h:27
osc::Image::read_into_texture
static Texture2D read_into_texture(std::istream &, std::string_view input_name, ColorSpace, ImageLoadingFlags={})
osc::JPEG
Definition
image.h:46
osc::JPEG::write
static void write(std::ostream &, const Texture2D &, float quality=0.9f)
osc::PNG
Definition
image.h:41
osc::PNG::write
static void write(std::ostream &, const Texture2D &)
osc::Texture2D
Definition
texture2d.h:22
color_space.h
image_loading_flags.h
named_input_stream.h
osc
Definition
custom_decoration_generator.h:5
osc::ColorSpace
ColorSpace
Definition
color_space.h:20
osc::to
constexpr U to(T &&value)
Definition
conversion.h:56
texture2d.h
Generated by
1.9.8