1 #ifndef DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H
2 #define DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H
5 * Copyright (c) 2021 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.
21 #include <dali/public-api/common/vector-wrapper.h>
22 #include <dali/public-api/object/base-object.h>
25 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
31 class AtlasGlyphManager;
33 } // namespace Toolkit
39 class AtlasGlyphManager;
40 typedef IntrusivePtr<AtlasGlyphManager> AtlasGlyphManagerPtr;
42 class AtlasGlyphManager : public Dali::BaseObject
45 struct GlyphRecordEntry
47 Text::GlyphIndex mIndex;
50 uint16_t mOutlineWidth;
55 struct FontGlyphRecord
58 Vector<GlyphRecordEntry> mGlyphRecords;
67 * @copydoc Toolkit::AtlasGlyphManager::Add
69 void Add(const Text::GlyphInfo& glyph,
70 const Toolkit::AtlasGlyphManager::GlyphStyle& style,
71 const PixelData& bitmap,
72 Dali::Toolkit::AtlasManager::AtlasSlot& slot);
75 * @copydoc Toolkit::AtlasGlyphManager::GenerateMeshData
77 void GenerateMeshData(uint32_t imageId,
78 const Vector2& position,
79 Toolkit::AtlasManager::Mesh2D& mesh);
82 * @copydoc Toolkit::AtlasGlyphManager::IsCached
84 bool IsCached(Text::FontId fontId,
85 Text::GlyphIndex index,
86 const Toolkit::AtlasGlyphManager::GlyphStyle& style,
87 Dali::Toolkit::AtlasManager::AtlasSlot& slot);
90 * @copydoc Toolkit::AtlasGlyphManager::GetAtlasSize
92 Vector2 GetAtlasSize(uint32_t atlasId);
95 * @copydoc Toolkit::AtlasGlyphManager::SetNewAtlasSize
97 void SetNewAtlasSize(uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight);
100 * @copydoc Toolkit::AtlasGlyphManager::GetPixelFormat
102 Pixel::Format GetPixelFormat(uint32_t atlasId);
105 * @copydoc toolkit::AtlasGlyphManager::AdjustReferenceCount
107 void AdjustReferenceCount(Text::FontId fontId, Text::GlyphIndex index, const Toolkit::AtlasGlyphManager::GlyphStyle& style, int32_t delta);
110 * @copydoc Toolkit::AtlasGlyphManager::GetTextures
112 TextureSet GetTextures(uint32_t atlasId) const;
115 * @copydoc Toolkit::AtlasGlyphManager::GetMetrics
117 const Toolkit::AtlasGlyphManager::Metrics& GetMetrics();
121 * A reference counted object may only be deleted by calling Unreference()
123 virtual ~AtlasGlyphManager();
126 Dali::Toolkit::AtlasManager mAtlasManager; ///> Atlas Manager created by GlyphManager
127 std::vector<FontGlyphRecord> mFontGlyphRecords;
128 Toolkit::AtlasGlyphManager::Metrics mMetrics; ///> Metrics to pass back on GlyphManager status
132 } // namespace Internal
134 inline const Internal::AtlasGlyphManager& GetImplementation(const Toolkit::AtlasGlyphManager& manager)
136 DALI_ASSERT_ALWAYS(manager && "AtlasGlyphManager handle is empty");
138 const BaseObject& handle = manager.GetBaseObject();
140 return static_cast<const Internal::AtlasGlyphManager&>(handle);
143 inline Internal::AtlasGlyphManager& GetImplementation(Toolkit::AtlasGlyphManager& manager)
145 DALI_ASSERT_ALWAYS(manager && "AtlasGlyphManager handle is empty");
147 BaseObject& handle = manager.GetBaseObject();
149 return static_cast<Internal::AtlasGlyphManager&>(handle);
152 } // namespace Toolkit
156 #endif // DALI_TOOLKIT_ATLAS_GLYPH_MANAGER_IMPL_H