1 #ifndef __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
2 #define __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/object/base-object.h>
26 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
34 class AtlasGlyphManager;
36 } // namespace Toolkit
44 class AtlasGlyphManager;
45 typedef IntrusivePtr<AtlasGlyphManager> AtlasGlyphManagerPtr;
47 class AtlasGlyphManager : public Dali::BaseObject
51 struct GlyphRecordEntry
53 Text::GlyphIndex mIndex;
58 struct FontGlyphRecord
61 Vector< GlyphRecordEntry > mGlyphRecords;
70 * @copydoc Toolkit::AtlasGlyphManager::Add
72 void Add( const Text::GlyphInfo& glyph,
73 const PixelData& bitmap,
74 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
77 * @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
79 void GenerateMeshData( uint32_t imageId,
80 const Vector2& position,
81 Toolkit::AtlasManager::Mesh2D& mesh );
84 * @copydoc Toolkit::AtlasGlyphManager::IsCached
86 bool IsCached( Text::FontId fontId,
87 Text::GlyphIndex index,
88 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
91 * @copydoc Toolkit::AtlasGlyphManager::GetAtlasSize
93 Vector2 GetAtlasSize( uint32_t atlasId );
96 * @copydoc Toolkit::AtlasGlyphManager::SetNewAtlasSize
98 void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
101 * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
103 Pixel::Format GetPixelFormat( uint32_t atlasId );
106 * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
108 void AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, int32_t delta );
111 * @copydoc Toolkit::AtlasGlyphManager::GetTextures
113 TextureSet GetTextures( uint32_t atlasId ) const;
116 * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
118 const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
123 * A reference counted object may only be deleted by calling Unreference()
125 virtual ~AtlasGlyphManager();
129 Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
130 std::vector< FontGlyphRecord > mFontGlyphRecords;
131 Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
134 } // namespace Internal
136 inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
138 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
140 const BaseObject& handle = manager.GetBaseObject();
142 return static_cast<const Internal::AtlasGlyphManager&>(handle);
145 inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
147 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
149 BaseObject& handle = manager.GetBaseObject();
151 return static_cast<Internal::AtlasGlyphManager&>(handle);
154 } // namespace Toolkit
158 #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__