NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
gl2d_texture_interface.h
Go to the documentation of this file.
1 #ifndef SDK_GL2D_TEXTURE_INTERFACE_H_
11 #define SDK_GL2D_TEXTURE_INTERFACE_H_
12 #pragma once
13 
14 #include <base/inc/platform.h>
15 #include <base/inc/base_types.h>
16 #include <base/inc/sdk_component_base.h>
19 #include <visualizationlayer/inc/gl2d/gl2d_canvas_func/gl2d_canvas_utils_interface.h>
20 
21 SDK_GL2D_BEGIN_NAMESPACE
22 
25 
29 {
33 
38 };
39 
43 {
44  // Given textures can be created via IGL2DCanvas::CreateTexture method
45  // GetBits/Clone/CopyTo/SaveTexture operations can be unavailable for some formats
46  kGL2DTextureFormat_RGBA = 0, // R8G8B8A8, 0xAABBGGRR
47  kGL2DTextureFormat_BGRA = 1, // B8G8R8A8, 0xAARRGGBB <- Not recommended for iMX6
48  kGL2DTextureFormat_RGB = 2, // R8G8B8, 0xBBGGRR
49  kGL2DTextureFormat_RGB16 = 3, // B5G6R5, 0xR5G6B5
50 
51  // Given texture can be created via IGL2DCanvas::CreateClippingTexture method
52  // (Device should support R8/A8 textures)
53  // Clone operation is not supported
54  // GetBits/CopyTo/SaveTexture operation can be unavailable
55  kGL2DTextureFormat_Grayscale = 4, // X8, 0xX8 <- Create/Clone are not allowed
56  // GetBits/CopyTo can be unavailable
57 
58  // Given texture can be created via IGL2DCanvas::CreateIndexedTexture method
59  // GetBits/Clone/CopyTo operations can be unavailable
60  // SaveTexture operation is not supported
61  kGL2DTextureFormat_Indexed_I8 = 5, // I8, 0xI8 <- GetBits/Clone/CopyTo can be unavailable
62  // Each I8 index points to appropriate
63  // color from 256 colors palette
64 
65  // Given set of textures can't be created externally, they are for
66  // internal usage only.
67  // GetBits/Clone/CopyTo/SaveTexture operations are not supported
68  kGL2DTextureFormat_Data_Float = 1000, // Internal data (float) texture
69  kGL2DTextureFormat_Depth = 1001, // Internal depth texture
70 };
71 
75 {
76  kGL2DNativeTextureFormat_RGBA = 0, // R8G8B8A8, 0xAABBGGRR
77  kGL2DNativeTextureFormat_BGRA = 1, // B8G8R8A8, 0xAARRGGBB
78  kGL2DNativeTextureFormat_RGB = 2, // R8G8B8, 0xBBGGRR
79  kGL2DNativeTextureFormat_RGB16 = 3, // B5G6R5, 0xR5G6B5
80  kGL2DNativeTextureFormat_R8 = 4, // R8, 0xR8
81  kGL2DNativeTextureFormat_A8 = 5, // A8, 0xA8
82 
83  // Given set of textures can't be created externally, they are for
84  // internal usage only
85  kGL2DNativeTextureFormat_Data_Float = 1000, // Internal data (float) texture format
86  kGL2DNativeTextureFormat_Depth_Int = 1001, // Internal depth (integer) texture format
87 };
88 
91 class IGL2DTexture : public ISDKProperties
92 {
93 public:
95  virtual void SDK_CALLTYPE Dump() const throw() = 0;
96 
98  virtual IGL2DCanvasSP SDK_CALLTYPE GetParent() const throw() = 0;
99 
101  virtual SDKSize SDK_CALLTYPE GetSize() const throw() = 0;
103  virtual GL2DTextureFormat SDK_CALLTYPE GetFormat() const throw() = 0;
105  virtual GL2DNativeTextureFormat SDK_CALLTYPE GetNativeFormat() const throw() = 0;
107  virtual bool SDK_CALLTYPE IsPremultipliedColors() const throw() = 0;
109  virtual SDKUInt32 SDK_CALLTYPE GetMemSize() const throw() = 0;
110 
112  virtual SDKInt32 SDK_CALLTYPE GetID() const throw() = 0;
113 
122  virtual SDKResult SDK_CALLTYPE GetBits(
123  void* const data) const throw() = 0;
124 
130  virtual SDKResult SDK_CALLTYPE Clone(IGL2DTextureSP& cloned_tex) throw() = 0;
131 
140  virtual SDKResult SDK_CALLTYPE CopyTo(const SDKRect2D& src_tex_rect,
141  const SDKPointI2D& dst_pos, const IGL2DTextureSP& dst_tex) throw() = 0;
143  inline SDKResult SDK_CALLTYPE CopyTo(
144  const SDKPointI2D& dst_pos, const IGL2DTextureSP& dst_tex)
145  {
146  const SDKSize src_tex_size = GetSize();
147  const SDKRect2D src_tex_rect =
148  { 0L, 0L, src_tex_size.width, src_tex_size.height };
149 
150  return CopyTo(src_tex_rect, dst_pos, dst_tex);
151  }
152 
155  virtual SDKResult SDK_CALLTYPE SaveTexture(
156  const SDKAny& file_path, const GL2DImageFormat& format) const throw() = 0;
157 
158  SDK_IMPLEMENT_IID(IGL2DTexture)
159  SDK_END_INTERFACE(IGL2DTexture)
160 };
161 SDK_DECLARE_IID(IGL2DTexture)
162 
163 SDK_GL2D_END_NAMESPACE
164 
165 #endif // SDK_GL2D_TEXTURE_INTERFACE_H_
IGL2DTexture::GetParent
virtual IGL2DCanvasSP SDK_CALLTYPE GetParent() const =0
Returns parent canvas object.
IGL2DTexture::SaveTexture
virtual SDKResult SDK_CALLTYPE SaveTexture(const SDKAny &file_path, const GL2DImageFormat &format) const =0
Saves given texture in requested format See IGL2DCanvasUtils::SaveTexture.
IGL2DTexture
GL2D Texture object.
Definition: gl2d_texture_interface.h:91
IGL2DTexture::IsPremultipliedColors
virtual bool SDK_CALLTYPE IsPremultipliedColors() const =0
Returns pre-multiplied/non pre-multiplied colors flag.
GL2DTexturePropertyIDs
GL2DTexturePropertyIDs
Generic GL2D Texture properties.
Definition: gl2d_texture_interface.h:28
IGL2DTexture::GetID
virtual SDKInt32 SDK_CALLTYPE GetID() const =0
Returns texture OpenGL ID.
IGL2DTexture::GetSize
virtual SDKSize SDK_CALLTYPE GetSize() const =0
Returns texture dimensions.
base_types.h
SDK base types.
IGL2DTexture::Dump
virtual void SDK_CALLTYPE Dump() const =0
Dumps given object.
IGL2DTexture::Clone
virtual SDKResult SDK_CALLTYPE Clone(IGL2DTextureSP &cloned_tex)=0
Clones given texture NOTE: Not all of textures can be cloned due of it's format. Mostly it's about Op...
GL2DTextureFormat
GL2DTextureFormat
Texture pixel format.
Definition: gl2d_texture_interface.h:42
properties_interface.h
Object generic properties interface.
kGL2DTexturePropertyID_AntiAliasing
@ kGL2DTexturePropertyID_AntiAliasing
Definition: gl2d_texture_interface.h:32
kGL2DTexturePropertyID_CanClip
@ kGL2DTexturePropertyID_CanClip
Definition: gl2d_texture_interface.h:37
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
IGL2DTexture::GetBits
virtual SDKResult SDK_CALLTYPE GetBits(void *const data) const =0
Returns texture bits Bottom-left corner pixel color is a first byte, strides goes from bottom to top ...
IGL2DTexture::GetFormat
virtual GL2DTextureFormat SDK_CALLTYPE GetFormat() const =0
Returns texture format.
GL2DNativeTextureFormat
GL2DNativeTextureFormat
Native (internal) texture pixel format.
Definition: gl2d_texture_interface.h:74
platform.h
Describes the platform constants.
IGL2DCanvas
GL2D Canvas to use to drawing NOTE! Create/Draw functionality was moved to appropriate GL2D Canvas Fu...
Definition: gl2d_canvas_interface.h:435
geometry_base_types.h
Geometry base types.
SDKPointI2D
Single 2D point.
Definition: geometry_base_types.h:178
IGL2DTexture::CopyTo
virtual SDKResult SDK_CALLTYPE CopyTo(const SDKRect2D &src_tex_rect, const SDKPointI2D &dst_pos, const IGL2DTextureSP &dst_tex)=0
Copies requested part of given texture to destination texture src_tex_rect - Describes rectangle of s...
IGL2DTexture::GetNativeFormat
virtual GL2DNativeTextureFormat SDK_CALLTYPE GetNativeFormat() const =0
Returns native (internal) texture format.
IGL2DTexture::GetMemSize
virtual SDKUInt32 SDK_CALLTYPE GetMemSize() const =0
Returns texture memory size.
SDKSize
SizeUI.
Definition: geometry_base_types.h:1235
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.