rework label drawable and text drawable's API
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
#if __has_include("msdfgen.h")
|
||||
|
||||
#include "Scene/AtlasMetadata.hpp"
|
||||
#include "Scene/AtlasData.hpp"
|
||||
#include "IFontAtlasGenerator.hpp"
|
||||
#include "Scene/Texture.hpp"
|
||||
#include <msdfgen.h>
|
||||
@@ -41,7 +41,6 @@ namespace OpenVulkano::Scene
|
||||
msdf_atlas::BitmapAtlasStorage<msdfgen::byte, 3>>;
|
||||
public:
|
||||
using Generator = std::conditional<Channels == 1, SdfGenerator, MsdfGenerator>::type;
|
||||
using AtlasData = std::conditional<Channels == 1, msdfgen::Bitmap<msdfgen::byte, 1>, msdfgen::Bitmap<msdfgen::byte, 4>>::type;
|
||||
using Config = FontAtlasGeneratorConfig;
|
||||
static constexpr int channelsCount = (Channels == 1 ? 1 : 4);
|
||||
static msdf_atlas::Charset LoadAllGlyphs(const std::variant<std::string, Array<char>>& data);
|
||||
@@ -57,9 +56,7 @@ namespace OpenVulkano::Scene
|
||||
const std::optional<std::string>& pngOutput = std::nullopt);
|
||||
void SaveAtlasMetadataInfo(const std::string& outputFile, bool packIntoSingleFile = true) const override;
|
||||
void SetGeneratorConfig(const Config& config) { m_config = config; }
|
||||
const Texture& GetAtlas() const override { return m_atlasTex; }
|
||||
std::map<uint32_t, GlyphInfo>& GetGlyphsInfo() override { return m_symbols; }
|
||||
AtlasMetadata& GetAtlasMetadata() override { return m_meta; }
|
||||
std::shared_ptr<AtlasData> GetAtlasData() const { return m_atlasData; }
|
||||
Config& GetGeneratorConfig() { return m_config; }
|
||||
private:
|
||||
void InitFreetypeFromFile(msdfgen::FreetypeHandle*& ft, msdfgen::FontHandle*& font, const std::string& file);
|
||||
@@ -70,11 +67,8 @@ namespace OpenVulkano::Scene
|
||||
void SavePng(const std::string& output) const;
|
||||
|
||||
private:
|
||||
Texture m_atlasTex;
|
||||
AtlasMetadata m_meta;
|
||||
Config m_config;
|
||||
std::map<uint32_t, GlyphInfo> m_symbols;
|
||||
AtlasData m_atlasStorage;
|
||||
std::shared_ptr<AtlasData> m_atlasData;
|
||||
};
|
||||
using SdfFontAtlasGenerator = FontAtlasGenerator<1>;
|
||||
using MsdfFontAtlasGenerator = FontAtlasGenerator<3>;
|
||||
|
||||
Reference in New Issue
Block a user