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;
54 uint32_t mOutlineWidth;
59 struct FontGlyphRecord
62 Vector< GlyphRecordEntry > mGlyphRecords;
71 * @copydoc Toolkit::AtlasGlyphManager::Add
73 void Add( const Text::GlyphInfo& glyph,
74 const uint32_t outlineWidth,
75 const PixelData& bitmap,
76 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
79 * @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
81 void GenerateMeshData( uint32_t imageId,
82 const Vector2& position,
83 Toolkit::AtlasManager::Mesh2D& mesh );
86 * @copydoc Toolkit::AtlasGlyphManager::IsCached
88 bool IsCached( Text::FontId fontId,
89 Text::GlyphIndex index,
90 uint32_t outlineWidth,
91 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
94 * @copydoc Toolkit::AtlasGlyphManager::GetAtlasSize
96 Vector2 GetAtlasSize( uint32_t atlasId );
99 * @copydoc Toolkit::AtlasGlyphManager::SetNewAtlasSize
101 void SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight );
104 * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
106 Pixel::Format GetPixelFormat( uint32_t atlasId );
109 * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
111 void AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, uint32_t outlineWidth, int32_t delta );
114 * @copydoc Toolkit::AtlasGlyphManager::GetTextures
116 TextureSet GetTextures( uint32_t atlasId ) const;
119 * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
121 const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
126 * A reference counted object may only be deleted by calling Unreference()
128 virtual ~AtlasGlyphManager();
132 Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
133 std::vector< FontGlyphRecord > mFontGlyphRecords;
134 Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
137 } // namespace Internal
139 inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
141 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
143 const BaseObject& handle = manager.GetBaseObject();
145 return static_cast<const Internal::AtlasGlyphManager&>(handle);
148 inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
150 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
152 BaseObject& handle = manager.GetBaseObject();
154 return static_cast<Internal::AtlasGlyphManager&>(handle);
157 } // namespace Toolkit
161 #endif // __DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H__