pixel_buffer_set.h
1 /*
2 ** UICore
3 ** Copyright (c) 1997-2015 The UICore 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 UICore 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 "UICore/Display/Render/texture.h"
34 #include "texture_format.h"
35 
36 namespace uicore
37 {
38  class PixelBuffer;
39  typedef std::shared_ptr<PixelBuffer> PixelBufferPtr;
40 
43  {
44  public:
46  static std::shared_ptr<PixelBufferSet> create(TextureDimensions dimensions, TextureFormat format, int width, int height = 1, int slices = 1);
47 
49  static std::shared_ptr<PixelBufferSet> create(const PixelBufferPtr &image);
50 
52  virtual TextureDimensions dimensions() const = 0;
53 
55  virtual TextureFormat format() const = 0;
56 
58  virtual int width() const = 0;
59 
61  virtual int height() const = 0;
62 
64  virtual int slice_count() const = 0;
65 
67  virtual int base_level() const = 0;
68 
70  virtual int max_level() const = 0;
71 
73  virtual PixelBufferPtr image(int slice, int level) = 0;
74 
76  virtual void set_image(int slice, int level, const PixelBufferPtr &image) = 0;
77  };
78 
79  typedef std::shared_ptr<PixelBufferSet> PixelBufferSetPtr;
80 }
virtual void set_image(int slice, int level, const PixelBufferPtr &image)=0
Set the pixel buffer to be used for the specified slice and level.
virtual TextureDimensions dimensions() const =0
Returns the texture dimensions used by the image set.
static std::shared_ptr< PixelBufferSet > create(TextureDimensions dimensions, TextureFormat format, int width, int height=1, int slices=1)
Constructs an image set of the specified dimensions type and internal format.
virtual int slice_count() const =0
Returns the number of depth/array/cube slices in the set.
TextureFormat
Texture format.
Definition: texture_format.h:35
Set of images that combined form a complete texture.
Definition: pixel_buffer_set.h:42
virtual PixelBufferPtr image(int slice, int level)=0
Returns the pixel buffer for a specific slice and level.
virtual TextureFormat format() const =0
Returns the internal texture format used by the image.
TextureDimensions
Texture dimensions.
Definition: texture.h:82
virtual int base_level() const =0
Returns the lowest mip level specified in the set.
virtual int height() const =0
Returns the height of the image.
virtual int max_level() const =0
Returns the highest mip level specified in the set.
std::shared_ptr< PixelBuffer > PixelBufferPtr
Definition: d3d_target.h:39
virtual int width() const =0
Returns the width of the image.
std::shared_ptr< PixelBufferSet > PixelBufferSetPtr
Definition: pixel_buffer_set.h:79
Definition: Application/application.h:35