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
52 struct GlyphRecordEntry
54 Text::GlyphIndex mIndex;
59 struct FontGlyphRecord
62 Vector< GlyphRecordEntry > mGlyphRecords;
67 virtual ~AtlasGlyphManager();
70 * Create a new AtlasGlyphManager
72 static AtlasGlyphManagerPtr New();
75 * @copydoc Toolkit::AtlasGlyphManager::Add
77 void Add( const Text::GlyphInfo& glyph,
78 const BufferImage& bitmap,
79 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
82 * @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
84 void GenerateMeshData( uint32_t imageId,
85 const Vector2& position,
86 Toolkit::AtlasManager::Mesh2D& mesh );
89 * @copydoc Toolkit::AtlasGlyphManager::StitchMesh
91 void StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
92 const Toolkit::AtlasManager::Mesh2D& second );
95 * @copydoc Toolkit::AtlasGlyphManager::Cached
97 bool Cached( Text::FontId fontId,
98 Text::GlyphIndex index,
99 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
102 * @copydoc Toolkit::AtlasGlyphManager::GetAtlasSize
104 Vector2 GetAtlasSize( uint32_t atlasId );
107 * @copydoc Toolkit::AtlasGlyphManager::SetNewAtlasSize
109 void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
112 * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
114 Pixel::Format GetPixelFormat( uint32_t atlasId );
117 * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
119 void AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta );
122 * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
124 Material GetMaterial( uint32_t atlasId ) const;
127 * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
129 Sampler GetSampler( uint32_t atlasId ) const;
132 * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
134 const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
137 * @copydoc Toolkit::AtlasGlyphManager::GetEffectBufferShader
139 Shader GetEffectBufferShader() const
141 return mEffectBufferShader;
145 * @copydoc Toolkit::AtlasGlyphManager::GetGlyphShadowShader
147 Shader GetGlyphShadowShader() const
149 return mShadowShader;
154 Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
155 std::vector< FontGlyphRecord > mFontGlyphRecords;
156 Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
157 Shader mEffectBufferShader; ///> Shader used to render drop shadow buffer textures
158 Shader mShadowShader; ///> Shader used to render drop shadow into buffer
161 } // namespace Internal
163 inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
165 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
167 const BaseObject& handle = manager.GetBaseObject();
169 return static_cast<const Internal::AtlasGlyphManager&>(handle);
172 inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
174 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
176 BaseObject& handle = manager.GetBaseObject();
178 return static_cast<Internal::AtlasGlyphManager&>(handle);
181 } // namespace Toolkit
186 #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__