hyprgraphics/src/resource/resources/ImageResource.cpp
Vaxry b86c4d9ed3
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
asyncResourceGatherer: add new module (#36)
Adds a new module based on the hyprlock gatherer

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-09-17 14:42:36 +02:00

21 lines
No EOL
642 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) {
;
}
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{};
}