pixel_buffer_set.h Source File - ClanLib SDK
Description: pixel_buffer_set.h Source File

pixel_buffer_set.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 The ClanLib Team
4**
5** This software is provided 'as-is', without any express or implied
6** warranty. In no event will the authors be held liable for any damages
7** arising from the use of this software.
8**
9** Permission is granted to anyone to use this software for any purpose,
10** including commercial applications, and to alter it and redistribute it
11** freely, subject to the following restrictions:
12**
13** 1. The origin of this software must not be misrepresented; you must not
14** claim that you wrote the original software. If you use this software
15** in a product, an acknowledgment in the product documentation would be
16** appreciated but is not required.
17** 2. Altered source versions must be plainly marked as such, and must not be
18** misrepresented as being the original software.
19** 3. This notice may not be removed or altered from any source distribution.
20**
21** Note: Some of the libraries ClanLib may link to may have additional
22** requirements or restrictions.
23**
24** File Author(s):
25**
26** Magnus Norddahl
27*/
28
29#pragma once
30
31#include <memory>
32#include "../../Core/Math/rect.h"
33#include "../Render/texture.h"
34#include "texture_format.h"
35
36namespace clan
37{
40
41 class PixelBuffer;
42 class PixelBufferSet_Impl;
43
45 class PixelBufferSet
46 {
47 public:
49 PixelBufferSet();
50
52 PixelBufferSet(TextureDimensions dimensions, TextureFormat format, int width, int height = 1, int slices = 1);
53
55 PixelBufferSet(const PixelBuffer &image);
56
58 bool is_null() const { return !impl; }
59 explicit operator bool() const { return bool(impl); }
60
62 void throw_if_null() const;
63
65 TextureDimensions get_dimensions() const;
66
68 TextureFormat get_format() const;
69
71 int get_width() const;
72
74 int get_height() const;
75
77 int get_slice_count() const;
78
80 int get_base_level() const;
81
83 int get_max_level() const;
84
86 PixelBuffer get_image(int slice, int level);
87
89 void set_image(int slice, int level, const PixelBuffer &image);
90
91 private:
92 std::shared_ptr<PixelBufferSet_Impl> impl;
93 };
94
96}
clan::PixelBufferSet
Set of images that combined form a complete texture.
Definition pixel_buffer_set.h:46
clan::PixelBufferSet::is_null
bool is_null() const
Returns true if this object is invalid.
Definition pixel_buffer_set.h:58
clan::PixelBufferSet::PixelBufferSet
PixelBufferSet()
Constructs a null instance.
clan::PixelBufferSet::throw_if_null
void throw_if_null() const
Throw an exception if this object is invalid.
clan::PixelBufferSet::get_image
PixelBuffer get_image(int slice, int level)
Returns the pixel buffer for a specific slice and level.
clan::PixelBufferSet::PixelBufferSet
PixelBufferSet(TextureDimensions dimensions, TextureFormat format, int width, int height=1, int slices=1)
Constructs an image set of the specified dimensions type and internal format.
clan::PixelBufferSet::get_height
int get_height() const
Returns the height of the image.
clan::PixelBufferSet::PixelBufferSet
PixelBufferSet(const PixelBuffer &image)
Constructs an image set with a single image using the dimensions and internal format of the pixel buf...
clan::PixelBufferSet::get_slice_count
int get_slice_count() const
Returns the number of depth/array/cube slices in the set.
clan::PixelBufferSet::get_base_level
int get_base_level() const
Returns the lowest mip level specified in the set.
clan::PixelBufferSet::get_format
TextureFormat get_format() const
Returns the internal texture format used by the image.
clan::PixelBufferSet::get_width
int get_width() const
Returns the width of the image.
clan::PixelBufferSet::set_image
void set_image(int slice, int level, const PixelBuffer &image)
Set the pixel buffer to be used for the specified slice and level.
clan::PixelBufferSet::get_max_level
int get_max_level() const
Returns the highest mip level specified in the set.
clan::PixelBufferSet::get_dimensions
TextureDimensions get_dimensions() const
Returns the texture dimensions used by the image set.
clan::PixelBuffer
Pixel data container.
Definition pixel_buffer.h:68
clan::TextureFormat
TextureFormat
Texture format.
Definition texture_format.h:39
clan::TextureDimensions
TextureDimensions
Texture dimensions.
Definition texture.h:91
clan
Definition clanapp.h:36
clan::BrushType::image
@ image