hyprgraphics/src/resource/resources/ImageResource.cpp
Vaxry 510efd0a36
Some checks are pending
Build & Test (Arch) / Arch: Build and Test (gcc) (push) Waiting to run
Build & Test (Arch) / Arch: Build and Test (clang) (push) Waiting to run
Build & Test / nix (hyprgraphics) (push) Waiting to run
Build & Test / nix (hyprgraphics-with-tests) (push) Waiting to run
image: add svg support
2025-09-30 19:32:17 +01:00

25 lines
No EOL
778 B
C++

#include <hyprgraphics/resource/resources/ImageResource.hpp>
#include <hyprgraphics/image/Image.hpp>
#include <hyprutils/memory/Atomic.hpp>
#include <hyprutils/memory/Casts.hpp>
#include <cairo/cairo.h>
#include <pango/pangocairo.h>
using namespace Hyprgraphics;
using namespace Hyprutils::Memory;
CImageResource::CImageResource(const std::string& path) : m_path(path) {
;
}
CImageResource::CImageResource(const std::string& svg, const Hyprutils::Math::Vector2D& size) : m_path(svg), m_svgSize(size) {
;
}
void CImageResource::render() {
auto image = CImage(m_path);
m_asset.cairoSurface = image.cairoSurface();
m_asset.pixelSize = m_asset.cairoSurface && m_asset.cairoSurface->cairo() ? m_asset.cairoSurface->size() : Hyprutils::Math::Vector2D{};
}