1 #ifndef DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H
2 #define DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H
5 * Copyright (c) 2019 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;
56 uint16_t mOutlineWidth;
61 struct FontGlyphRecord
64 Vector< GlyphRecordEntry > mGlyphRecords;
73 * @copydoc Toolkit::AtlasGlyphManager::Add
75 void Add( const Text::GlyphInfo& glyph,
76 const Toolkit::AtlasGlyphManager::GlyphStyle& style,
77 const PixelData& bitmap,
78 Dali::Toolkit::AtlasManager::AtlasSlot& slot );
81 * @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
83 void GenerateMeshData( uint32_t imageId,
84 const Vector2& position,
85 Toolkit::AtlasManager::Mesh2D& mesh );
88 * @copydoc Toolkit::AtlasGlyphManager::IsCached
90 bool IsCached( Text::FontId fontId,
91 Text::GlyphIndex index,
92 const Toolkit::AtlasGlyphManager::GlyphStyle& style,
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::GetPixelFormat
108 Pixel::Format GetPixelFormat( uint32_t atlasId );
111 * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
113 void AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, const Toolkit::AtlasGlyphManager::GlyphStyle& style, int32_t delta );
116 * @copydoc Toolkit::AtlasGlyphManager::GetTextures
118 TextureSet GetTextures( uint32_t atlasId ) const;
121 * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
123 const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
128 * A reference counted object may only be deleted by calling Unreference()
130 virtual ~AtlasGlyphManager();
134 Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
135 std::vector< FontGlyphRecord > mFontGlyphRecords;
136 Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
139 } // namespace Internal
141 inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
143 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
145 const BaseObject& handle = manager.GetBaseObject();
147 return static_cast<const Internal::AtlasGlyphManager&>(handle);
150 inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
152 DALI_ASSERT_ALWAYS( manager && "AtlasGlyphManager handle is empty" );
154 BaseObject& handle = manager.GetBaseObject();
156 return static_cast<Internal::AtlasGlyphManager&>(handle);
159 } // namespace Toolkit
163 #endif // DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H