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( Text::FontId fontId,
78 const Text::GlyphInfo& glyph,
79 const BufferImage& bitmap,
80 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
83 * @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
85 void GenerateMeshData( uint32_t imageId,
86 const Vector2& position,
87 Toolkit::AtlasManager::Mesh2D& mesh );
90 * @copydoc Toolkit::AtlasGlyphManager::StitchMesh
92 void StitchMesh( Toolkit::AtlasManager::Mesh2D& first,
93 const Toolkit::AtlasManager::Mesh2D& second );
96 * @copydoc Toolkit::AtlasGlyphManager::Cached
98 bool Cached( Text::FontId fontId,
99 Text::GlyphIndex index,
100 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
103 * @copydoc Toolkit::AtlasGlyphManager::GetAtlasSize
105 Vector2 GetAtlasSize( uint32_t atlasId );
108 * @copydoc Toolkit::AtlasGlyphManager::SetNewAtlasSize
110 void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
113 * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
115 Pixel::Format GetPixelFormat( uint32_t atlasId );
118 * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
120 void AdjustReferenceCount( Text::FontId fontId, uint32_t imageId, int32_t delta );
123 * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
125 Material GetMaterial( uint32_t atlasId ) const;
128 * @copydoc Toolkit::AtlasGlyphManager::GetMaterial
130 Sampler GetSampler( uint32_t atlasId ) const;
133 * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
135 const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
138 * @copydoc Toolkit::AtlasGlyphManager::GetEffectBufferShader
140 Shader GetEffectBufferShader() const
142 return mEffectBufferShader;
146 * @copydoc Toolkit::AtlasGlyphManager::GetGlyphShadowShader
148 Shader GetGlyphShadowShader() const
150 return mShadowShader;
155 Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
156 std::vector< FontGlyphRecord > mFontGlyphRecords;
157 Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
158 Shader mEffectBufferShader; ///> Shader used to render drop shadow buffer textures
159 Shader mShadowShader; ///> Shader used to render drop shadow into buffer
162 } // namespace Internal
164 inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
166 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
168 const BaseObject& handle = manager.GetBaseObject();
170 return static_cast<const Internal::AtlasGlyphManager&>(handle);
173 inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
175 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
177 BaseObject& handle = manager.GetBaseObject();
179 return static_cast<Internal::AtlasGlyphManager&>(handle);
182 } // namespace Toolkit
187 #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__