#pragma once #include "types.h" #include namespace metin2::texture { class SubImage { public: SubImage() = default; ~SubImage() = default; bool LoadFromString(const std::string& content); bool LoadFromFile(const std::string& file_path); const std::string& GetImagePath() const { return m_image_path; } const Rect2D& GetRect() const { return m_rect; } int32_t GetWidth() const { return m_rect.GetWidth(); } int32_t GetHeight() const { return m_rect.GetHeight(); } UVRect ComputeUV(uint32_t atlas_width, uint32_t atlas_height) const; // Generate 9-Slice mesh for UI window / button rendering NineSliceMesh BuildNineSliceMesh(float x, float y, float width, float height, float border_l, float border_t, float border_r, float border_b, uint32_t atlas_width, uint32_t atlas_height, uint32_t color = 0xFFFFFFFF) const; private: std::string m_image_path; Rect2D m_rect; }; } // namespace metin2::texture