texture_1d.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 ** Harry Storbacka
28 */
29 
30 #pragma once
31 
32 #include "texture.h"
33 
34 namespace uicore
35 {
37  class Texture1D : public virtual Texture
38  {
39  public:
43  static std::shared_ptr<Texture1D> create(const GraphicContextPtr &context, int size, TextureFormat texture_format = tf_rgba8, int levels = 1);
44  static std::shared_ptr<Texture1D> create(const GraphicContextPtr &context, const PixelBufferPtr &image, bool is_srgb = false);
45  static std::shared_ptr<Texture1D> create(const GraphicContextPtr &context, const PixelBufferPtr &image, int src_x, int width, bool is_srgb = false);
46 
48  virtual int size() const = 0;
49 
51  virtual TextureWrapMode wrap_mode_s() const = 0;
52 
58  virtual void set_image(const GraphicContextPtr &context, const PixelBufferPtr &image, int level = 0) = 0;
59 
65  virtual void set_subimage(const GraphicContextPtr &context, int x, const PixelBufferPtr &image, const int src_x, const int src_width, int level = 0) = 0;
66 
67  virtual void set_wrap_mode(TextureWrapMode wrap_s) = 0;
68  };
69 }
Texture object class.
Definition: texture.h:94
virtual int size() const =0
Get the texture width.
static std::shared_ptr< Texture1D > create(const GraphicContextPtr &context, int size, TextureFormat texture_format=tf_rgba8, int levels=1)
Constructs a 1D texture.
virtual void set_image(const GraphicContextPtr &context, const PixelBufferPtr &image, int level=0)=0
Upload image to texture.
1D texture object class.
Definition: texture_1d.h:37
TextureFormat
Texture format.
Definition: texture_format.h:35
Definition: texture_format.h:38
virtual TextureWrapMode wrap_mode_s() const =0
Get the texture wrap mode for the s coordinate.
std::shared_ptr< PixelBuffer > PixelBufferPtr
Definition: d3d_target.h:39
std::shared_ptr< GraphicContext > GraphicContextPtr
Definition: d3d_target.h:49
TextureWrapMode
Texture coordinate wrapping modes.
Definition: texture.h:56
virtual void set_subimage(const GraphicContextPtr &context, int x, const PixelBufferPtr &image, const int src_x, const int src_width, int level=0)=0
Upload image to sub texture.
Definition: Application/application.h:35
virtual void set_wrap_mode(TextureWrapMode wrap_s)=0