Implement back text rendering (WIP)
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <Nazara/Core/SparsePtr.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -30,7 +31,7 @@ namespace Nz
|
||||
virtual void Free(SparsePtr<const Rectui> rects, SparsePtr<unsigned int> layers, unsigned int count) = 0;
|
||||
virtual AbstractImage* GetLayer(unsigned int layerIndex) const = 0;
|
||||
virtual std::size_t GetLayerCount() const = 0;
|
||||
virtual UInt32 GetStorage() const = 0;
|
||||
virtual DataStoreFlags GetStorage() const = 0;
|
||||
virtual bool Insert(const Image& image, Rectui* rect, bool* flipped, unsigned int* layerIndex) = 0;
|
||||
|
||||
AbstractAtlas& operator=(const AbstractAtlas&) = delete;
|
||||
|
||||
@@ -127,6 +127,13 @@ namespace Nz
|
||||
Max = Software
|
||||
};
|
||||
|
||||
template<>
|
||||
struct EnumAsFlags<DataStorage>
|
||||
{
|
||||
static constexpr DataStorage max = DataStorage::Max;
|
||||
};
|
||||
|
||||
using DataStoreFlags = Flags<DataStorage>;
|
||||
constexpr std::size_t DataStorageCount = static_cast<std::size_t>(DataStorage::Max) + 1;
|
||||
|
||||
enum class FaceFilling
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Nz
|
||||
void ClearKerningCache();
|
||||
void ClearSizeInfoCache();
|
||||
|
||||
bool Create(FontData* data);
|
||||
bool Create(std::unique_ptr<FontData> data);
|
||||
void Destroy();
|
||||
|
||||
bool ExtractGlyph(unsigned int characterSize, char32_t character, TextStyleFlags style, float outlineThickness, FontGlyph* glyph) const;
|
||||
@@ -74,7 +74,7 @@ namespace Nz
|
||||
bool Precache(unsigned int characterSize, TextStyleFlags style, float outlineThickness, char32_t character) const;
|
||||
bool Precache(unsigned int characterSize, TextStyleFlags style, float outlineThickness, const std::string& characterSet) const;
|
||||
|
||||
void SetAtlas(const std::shared_ptr<AbstractAtlas>& atlas);
|
||||
void SetAtlas(std::shared_ptr<AbstractAtlas> atlas);
|
||||
void SetGlyphBorder(unsigned int borderSize);
|
||||
void SetMinimumStepSize(unsigned int minimumStepSize);
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Nz
|
||||
static std::shared_ptr<Font> OpenFromMemory(const void* data, std::size_t size, const FontParams& params = FontParams());
|
||||
static std::shared_ptr<Font> OpenFromStream(Stream& stream, const FontParams& params = FontParams());
|
||||
|
||||
static void SetDefaultAtlas(const std::shared_ptr<AbstractAtlas>& atlas);
|
||||
static void SetDefaultAtlas(std::shared_ptr<AbstractAtlas> atlas);
|
||||
static void SetDefaultGlyphBorder(unsigned int borderSize);
|
||||
static void SetDefaultMinimumStepSize(unsigned int minimumStepSize);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Nz
|
||||
GuillotineBinPack::GuillotineSplitHeuristic GetRectSplitHeuristic() const;
|
||||
AbstractImage* GetLayer(unsigned int layerIndex) const override;
|
||||
std::size_t GetLayerCount() const override;
|
||||
UInt32 GetStorage() const override;
|
||||
DataStoreFlags GetStorage() const override;
|
||||
|
||||
bool Insert(const Image& image, Rectui* rect, bool* flipped, unsigned int* layerIndex) override;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Nz
|
||||
protected:
|
||||
struct Layer;
|
||||
|
||||
virtual AbstractImage* ResizeImage(AbstractImage* oldImage, const Vector2ui& size) const;
|
||||
virtual std::shared_ptr<AbstractImage> ResizeImage(const std::shared_ptr<AbstractImage>& oldImage, const Vector2ui& size) const;
|
||||
bool ResizeLayer(Layer& layer, const Vector2ui& size);
|
||||
|
||||
struct QueuedGlyph
|
||||
@@ -59,7 +59,7 @@ namespace Nz
|
||||
struct Layer
|
||||
{
|
||||
std::vector<QueuedGlyph> queuedGlyphs;
|
||||
std::unique_ptr<AbstractImage> image;
|
||||
std::shared_ptr<AbstractImage> image;
|
||||
GuillotineBinPack binPack;
|
||||
unsigned int freedRectangles = 0;
|
||||
};
|
||||
|
||||
@@ -70,18 +70,18 @@ namespace Nz
|
||||
bool FlipVertically();
|
||||
|
||||
const UInt8* GetConstPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, UInt8 level = 0) const;
|
||||
unsigned int GetDepth(UInt8 level = 0) const override;
|
||||
unsigned int GetDepth(UInt8 level = 0) const;
|
||||
PixelFormat GetFormat() const override;
|
||||
unsigned int GetHeight(UInt8 level = 0) const override;
|
||||
unsigned int GetHeight(UInt8 level = 0) const;
|
||||
UInt8 GetLevelCount() const override;
|
||||
UInt8 GetMaxLevel() const override;
|
||||
std::size_t GetMemoryUsage() const override;
|
||||
std::size_t GetMemoryUsage(UInt8 level) const override;
|
||||
UInt8 GetMaxLevel() const;
|
||||
std::size_t GetMemoryUsage() const;
|
||||
std::size_t GetMemoryUsage(UInt8 level) const;
|
||||
Color GetPixelColor(unsigned int x, unsigned int y = 0, unsigned int z = 0) const;
|
||||
UInt8* GetPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, UInt8 level = 0);
|
||||
Vector3ui GetSize(UInt8 level = 0) const override;
|
||||
ImageType GetType() const override;
|
||||
unsigned int GetWidth(UInt8 level = 0) const override;
|
||||
unsigned int GetWidth(UInt8 level = 0) const;
|
||||
|
||||
bool HasAlpha() const;
|
||||
|
||||
@@ -101,9 +101,8 @@ namespace Nz
|
||||
void SetLevelCount(UInt8 levelCount);
|
||||
bool SetPixelColor(const Color& color, unsigned int x, unsigned int y = 0, unsigned int z = 0);
|
||||
|
||||
bool Update(const UInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
|
||||
bool Update(const UInt8* pixels, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
|
||||
bool Update(const UInt8* pixels, const Rectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
|
||||
using AbstractImage::Update;
|
||||
bool Update(const void* pixels, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
|
||||
|
||||
Image& operator=(const Image& image);
|
||||
inline Image& operator=(Image&& image) noexcept;
|
||||
|
||||
Reference in New Issue
Block a user