2 #ifndef __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
3 #define __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
6 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 #include <dali/public-api/common/vector-wrapper.h>
24 #include <dali/public-api/object/base-object.h>
27 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
35 class AtlasGlyphManager;
37 } // namespace Toolkit
45 class AtlasGlyphManager;
46 typedef IntrusivePtr<AtlasGlyphManager> AtlasGlyphManagerPtr;
48 class AtlasGlyphManager : public Dali::BaseObject
55 Text::GlyphIndex mIndex;
61 virtual ~AtlasGlyphManager();
64 * Create a new AtlasGlyphManager
66 static AtlasGlyphManagerPtr New();
69 * @copydoc Toolkit::AtlasGlyphManager::Add
71 void Add( const Text::GlyphInfo& glyph,
72 const BufferImage& bitmap,
73 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
76 * @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
78 void GenerateMeshData( uint32_t imageId,
79 const Vector2& position,
80 Toolkit::AtlasManager::Mesh2D& mesh );
83 * @copydoc Toolkit::AtlasGlyphManager::StitchMesh
85 void StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
86 const Toolkit::AtlasManager::Mesh2D& second );
89 * @copydoc Toolkit::AtlasGlyphManager::Cached
91 void Cached( Text::FontId fontId,
92 Text::GlyphIndex index,
93 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
96 * @copydoc Toolkit::AtlasGlyphManager::GetAtlasSize
98 Vector2 GetAtlasSize( uint32_t atlasId );
101 * @copydoc Toolkit::AtlasGlyphManager::SetNewAtlasSize
103 void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
106 * @copydoc Toolkit::AtlasGlyphManager::Remove
108 void Remove( uint32_t imageId );
111 * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
113 Pixel::Format GetPixelFormat( uint32_t atlasId );
116 * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
118 Material GetMaterial( uint32_t atlasId ) const;
121 * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
123 Sampler GetSampler( uint32_t atlasId ) const;
126 * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
128 const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
131 * @copydoc Toolkit::AtlasGlyphManager::GetEffectBufferShader
133 Shader GetEffectBufferShader() const
135 return mEffectBufferShader;
139 * @copydoc Toolkit::AtlasGlyphManager::GetGlyphShadowShader
141 Shader GetGlyphShadowShader() const
143 return mShadowShader;
148 Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
149 Vector< GlyphRecord > mGlyphRecords; ///> Cached glyph information
150 Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
151 Shader mEffectBufferShader; ///> Shader used to render drop shadow buffer textures
152 Shader mShadowShader; ///> Shader used to render drop shadow into buffer
155 } // namespace Internal
157 inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
159 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
161 const BaseObject& handle = manager.GetBaseObject();
163 return static_cast<const Internal::AtlasGlyphManager&>(handle);
166 inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
168 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
170 BaseObject& handle = manager.GetBaseObject();
172 return static_cast<Internal::AtlasGlyphManager&>(handle);
175 } // namespace Toolkit
180 #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__