opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
image.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <iosfwd>
9#include <utility>
10
11namespace 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).
20 std::istream&,
21 std::string_view input_name,
24 );
25
26 template<NamedInputStream Stream>
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}
Definition flags.h:20
Definition image.h:13
static Texture2D read_into_texture(Stream &&stream, ColorSpace color_space, ImageLoadingFlags flags={})
Definition image.h:27
static Texture2D read_into_texture(std::istream &, std::string_view input_name, ColorSpace, ImageLoadingFlags={})
Definition image.h:46
static void write(std::ostream &, const Texture2D &, float quality=0.9f)
Definition image.h:41
static void write(std::ostream &, const Texture2D &)
Definition texture2d.h:22
Definition custom_decoration_generator.h:5
ColorSpace
Definition color_space.h:20
constexpr U to(T &&value)
Definition conversion.h:56