Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package hyprgraphics for openSUSE:Factory 
checked in at 2026-01-08 15:28:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hyprgraphics (Old)
 and      /work/SRC/openSUSE:Factory/.hyprgraphics.new.1928 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hyprgraphics"

Thu Jan  8 15:28:22 2026 rev:5 rq:1325865 version:0.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/hyprgraphics/hyprgraphics.changes        
2025-11-09 21:08:20.432246274 +0100
+++ /work/SRC/openSUSE:Factory/.hyprgraphics.new.1928/hyprgraphics.changes      
2026-01-08 15:29:08.025314224 +0100
@@ -1,0 +2,11 @@
+Wed Jan  7 22:14:26 UTC 2026 - Avindra Goolcharan <[email protected]>
+
+- Update to version 0.5.0:
+  * image: cleanup format detection
+  * image/svg: implement embeded
+  * resource/image: add byte stream
+  * image: fix missing svg byte stream
+- Changes from version 0.4.0:
+  * resource/AsyncResource: add await() for resources
+
+-------------------------------------------------------------------

Old:
----
  hyprgraphics-0.3.0.tar.xz

New:
----
  hyprgraphics-0.5.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hyprgraphics.spec ++++++
--- /var/tmp/diff_new_pack.SKmMJW/_old  2026-01-08 15:29:08.525334980 +0100
+++ /var/tmp/diff_new_pack.SKmMJW/_new  2026-01-08 15:29:08.525334980 +0100
@@ -1,8 +1,7 @@
 #
 # spec file for package hyprgraphics
 #
-# Copyright (c) 2025 SUSE LLC
-# Copyright (c) 2025 SUSE LLC and contributors
+# Copyright (c) 2026 SUSE LLC and contributors
 # Copyright (c) 2024/25 Florian "sp1rit" <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
@@ -18,10 +17,10 @@
 #
 
 
-%define sover 2
+%define sover 4
 
 Name:           hyprgraphics
-Version:        0.3.0
+Version:        0.5.0
 Release:        0
 Summary:        Hyprland graphics / resource utilities
 License:        BSD-3-Clause

++++++ hyprgraphics-0.3.0.tar.xz -> hyprgraphics-0.5.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/CMakeLists.txt 
new/hyprgraphics-0.5.0/CMakeLists.txt
--- old/hyprgraphics-0.3.0/CMakeLists.txt       2025-11-06 21:47:32.000000000 
+0100
+++ new/hyprgraphics-0.5.0/CMakeLists.txt       2025-12-28 19:25:35.000000000 
+0100
@@ -95,7 +95,7 @@
   PUBLIC "./include"
   PRIVATE "./src")
 set_target_properties(hyprgraphics PROPERTIES VERSION ${HYPRGRAPHICS_VERSION}
-                                              SOVERSION 2)
+                                              SOVERSION 4)
 target_link_libraries(hyprgraphics PkgConfig::deps)
 if(JXL_FOUND)
   target_link_libraries(hyprgraphics PkgConfig::JXL)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/VERSION 
new/hyprgraphics-0.5.0/VERSION
--- old/hyprgraphics-0.3.0/VERSION      2025-11-06 21:47:32.000000000 +0100
+++ new/hyprgraphics-0.5.0/VERSION      2025-12-28 19:25:35.000000000 +0100
@@ -1 +1 @@
-0.3.0
+0.5.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/include/hyprgraphics/image/Image.hpp 
new/hyprgraphics-0.5.0/include/hyprgraphics/image/Image.hpp
--- old/hyprgraphics-0.3.0/include/hyprgraphics/image/Image.hpp 2025-11-06 
21:47:32.000000000 +0100
+++ new/hyprgraphics-0.5.0/include/hyprgraphics/image/Image.hpp 2025-12-28 
19:25:35.000000000 +0100
@@ -10,12 +10,20 @@
     enum eImageFormat : uint8_t {
         IMAGE_FORMAT_PNG,
         IMAGE_FORMAT_AVIF,
+        IMAGE_FORMAT_JPEG,
+        IMAGE_FORMAT_JXL,
+        IMAGE_FORMAT_BMP,
+        IMAGE_FORMAT_SVG,
+        IMAGE_FORMAT_WEBP,
+
+        IMAGE_FORMAT_ERROR,
+        IMAGE_FORMAT_AUTO, // take an educated guess
     };
 
     class CImage {
       public:
-        CImage(const std::string& path, const Hyprutils::Math::Vector2D& size 
= {} /* for SVG */);
-        CImage(const std::span<const uint8_t>, eImageFormat);
+        CImage(const std::string& path, const Hyprutils::Math::Vector2D& size 
= {} /* Ignored if not svg */);
+        CImage(std::span<const uint8_t>, eImageFormat format = 
IMAGE_FORMAT_AUTO, const Hyprutils::Math::Vector2D& size = {} /* Ignored if not 
svg */);
         ~CImage();
 
         CImage(const CImage&)            = delete;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/include/hyprgraphics/resource/AsyncResourceGatherer.hpp 
new/hyprgraphics-0.5.0/include/hyprgraphics/resource/AsyncResourceGatherer.hpp
--- 
old/hyprgraphics-0.3.0/include/hyprgraphics/resource/AsyncResourceGatherer.hpp  
    2025-11-06 21:47:32.000000000 +0100
+++ 
new/hyprgraphics-0.5.0/include/hyprgraphics/resource/AsyncResourceGatherer.hpp  
    2025-12-28 19:25:35.000000000 +0100
@@ -17,6 +17,9 @@
 
         void enqueue(Hyprutils::Memory::CAtomicSharedPointer<IAsyncResource> 
resource);
 
+        // Synchronously await the resource being available
+        void await(Hyprutils::Memory::CAtomicSharedPointer<IAsyncResource> 
resource);
+
       private:
         std::thread m_gatherThread;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/include/hyprgraphics/resource/resources/AsyncResource.hpp
 
new/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/AsyncResource.hpp
--- 
old/hyprgraphics-0.3.0/include/hyprgraphics/resource/resources/AsyncResource.hpp
    2025-11-06 21:47:32.000000000 +0100
+++ 
new/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/AsyncResource.hpp
    2025-12-28 19:25:35.000000000 +0100
@@ -7,9 +7,11 @@
 #include <atomic>
 
 namespace Hyprgraphics {
+    struct SAsyncResourceImpl;
+
     class IAsyncResource {
       public:
-        IAsyncResource()          = default;
+        IAsyncResource();
         virtual ~IAsyncResource() = default;
 
         virtual void render() = 0;
@@ -29,5 +31,7 @@
             Hyprutils::Memory::CSharedPointer<CCairoSurface> cairoSurface;
             Hyprutils::Math::Vector2D                        pixelSize;
         } m_asset;
+
+        Hyprutils::Memory::CUniquePointer<SAsyncResourceImpl> m_impl;
     };
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/include/hyprgraphics/resource/resources/ImageResource.hpp
 
new/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/ImageResource.hpp
--- 
old/hyprgraphics-0.3.0/include/hyprgraphics/resource/resources/ImageResource.hpp
    2025-11-06 21:47:32.000000000 +0100
+++ 
new/hyprgraphics-0.5.0/include/hyprgraphics/resource/resources/ImageResource.hpp
    2025-12-28 19:25:35.000000000 +0100
@@ -18,6 +18,7 @@
 
         CImageResource(const std::string& path);
         CImageResource(const std::string& svg, const 
Hyprutils::Math::Vector2D& size);
+        CImageResource(const std::span<const uint8_t>& data, const 
Hyprutils::Math::Vector2D& size = {} /* unused if not svg */);
         virtual ~CImageResource() = default;
 
         virtual void render();
@@ -25,5 +26,6 @@
       private:
         std::string               m_path;
         Hyprutils::Math::Vector2D m_svgSize;
+        std::span<const uint8_t>  m_data;
     };
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/src/image/Image.cpp 
new/hyprgraphics-0.5.0/src/image/Image.cpp
--- old/hyprgraphics-0.3.0/src/image/Image.cpp  2025-11-06 21:47:32.000000000 
+0100
+++ new/hyprgraphics-0.5.0/src/image/Image.cpp  2025-12-28 19:25:35.000000000 
+0100
@@ -1,4 +1,5 @@
 #include <hyprgraphics/image/Image.hpp>
+#include "utils/Format.hpp"
 #include "formats/Bmp.hpp"
 #include "formats/Jpeg.hpp"
 #ifdef JXL_FOUND
@@ -17,22 +18,26 @@
 using namespace Hyprutils::Memory;
 using namespace Hyprutils::Math;
 
-Hyprgraphics::CImage::CImage(const std::span<const uint8_t> data, eImageFormat 
format) {
-    std::expected<cairo_surface_t*, std::string> CAIROSURFACE;
-    if (format == eImageFormat::IMAGE_FORMAT_PNG) {
-        CAIROSURFACE = PNG::createSurfaceFromPNG(data);
-        mime         = "image/png";
-    } else if (format == eImageFormat::IMAGE_FORMAT_AVIF) {
-#ifndef HEIF_FOUND
-        lastError = "hyprgraphics compiled without HEIF support";
+Hyprgraphics::CImage::CImage(std::span<const uint8_t> data, eImageFormat 
format, const Vector2D& size) {
+
+    const auto FORMAT = format == IMAGE_FORMAT_AUTO ? formatFromStream(data) : 
format;
+
+    if (FORMAT == IMAGE_FORMAT_ERROR) {
+        lastError = "invalid file";
         return;
+    }
+
+    std::expected<cairo_surface_t*, std::string> CAIROSURFACE;
+
+    switch (FORMAT) {
+        case IMAGE_FORMAT_PNG: CAIROSURFACE = PNG::createSurfaceFromPNG(data); 
break;
+#ifdef HEIF_FOUND
+        case IMAGE_FORMAT_AVIF: CAIROSURFACE = 
AVIF::createSurfaceFromAvif(data); break;
 #else
-        CAIROSURFACE = AVIF::createSurfaceFromAvif(data);
-        mime         = "image/avif";
+        case IMAGE_FORMAT_AVIF: lastError = "hyprgraphics compiled without 
HEIF support"; return;
 #endif
-    } else {
-        lastError = "Currently only PNG and AVIF images are supported for 
embedding";
-        return;
+        case IMAGE_FORMAT_SVG: CAIROSURFACE = SVG::createSurfaceFromData(data, 
size); break;
+        default: lastError = "Currently only PNG and AVIF images are supported 
for embedding"; return;
     }
 
     if (!CAIROSURFACE) {
@@ -50,90 +55,35 @@
 }
 
 Hyprgraphics::CImage::CImage(const std::string& path, const Vector2D& size) : 
filepath(path), m_svgSize(size) {
-    std::expected<cairo_surface_t*, std::string> CAIROSURFACE;
-    if (path.ends_with(".png") || path.ends_with(".PNG")) {
-        CAIROSURFACE = PNG::createSurfaceFromPNG(path);
-        mime         = "image/png";
-    } else if (path.ends_with(".jpg") || path.ends_with(".JPG") || 
path.ends_with(".jpeg") || path.ends_with(".JPEG")) {
-        CAIROSURFACE  = JPEG::createSurfaceFromJPEG(path);
-        imageHasAlpha = false;
-        mime          = "image/jpeg";
-    } else if (path.ends_with(".bmp") || path.ends_with(".BMP")) {
-        CAIROSURFACE  = BMP::createSurfaceFromBMP(path);
-        imageHasAlpha = false;
-        mime          = "image/bmp";
-    } else if (path.ends_with(".webp") || path.ends_with(".WEBP")) {
-        CAIROSURFACE = WEBP::createSurfaceFromWEBP(path);
-        mime         = "image/webp";
-    } else if (path.ends_with(".svg") || path.ends_with(".SVG")) {
-        CAIROSURFACE = SVG::createSurfaceFromSVG(path, m_svgSize);
-        mime         = "image/svg";
-    } else if (path.ends_with(".jxl") || path.ends_with(".JXL")) {
 
-#ifdef JXL_FOUND
-        CAIROSURFACE = JXL::createSurfaceFromJXL(path);
-        mime         = "image/jxl";
-#else
-        lastError = "hyprgraphics compiled without JXL support";
+    const auto FORMAT = formatFromFile(path);
+
+    if (FORMAT == IMAGE_FORMAT_ERROR) {
+        lastError = "invalid file";
         return;
-#endif
+    }
+
+    std::expected<cairo_surface_t*, std::string> CAIROSURFACE;
 
-    } else if (path.ends_with(".avif") || path.ends_with(".AVIF")) {
+    mime = mimeOf(FORMAT);
 
+    switch (FORMAT) {
+        case IMAGE_FORMAT_PNG: CAIROSURFACE = PNG::createSurfaceFromPNG(path); 
break;
+        case IMAGE_FORMAT_BMP: CAIROSURFACE = BMP::createSurfaceFromBMP(path); 
break;
 #ifdef HEIF_FOUND
-        CAIROSURFACE = AVIF::createSurfaceFromAvif(path);
-        mime         = "image/avif";
+        case IMAGE_FORMAT_AVIF: CAIROSURFACE = 
AVIF::createSurfaceFromAvif(path); break;
 #else
-        lastError = "hyprgraphics compiled without HEIF support";
-        return;
+        case IMAGE_FORMAT_AVIF: lastError = "hyprgraphics compiled without 
HEIF support"; return;
 #endif
-
-    } else {
-        // magic is slow, so only use it when no recognized extension is found
-        auto handle = magic_open(MAGIC_NONE | MAGIC_COMPRESS | MAGIC_SYMLINK);
-        magic_load(handle, nullptr);
-
-        const auto type_str = std::string(magic_file(handle, path.c_str()));
-
-        magic_close(handle);
-
-        const auto first_word = type_str.substr(0, type_str.find(' '));
-
-        if (first_word == "PNG") {
-            CAIROSURFACE = PNG::createSurfaceFromPNG(path);
-            mime         = "image/png";
-        } else if (first_word == "JPEG" && !type_str.contains("XL") && 
!type_str.contains("2000")) {
-            CAIROSURFACE  = JPEG::createSurfaceFromJPEG(path);
-            imageHasAlpha = false;
-            mime          = "image/jpeg";
-        } else if (first_word == "JPEG" && type_str.contains("XL")) {
 #ifdef JXL_FOUND
-            CAIROSURFACE = JXL::createSurfaceFromJXL(path);
-            mime         = "image/jxl";
-#else
-            lastError = "hyprgraphics compiled without JXL support";
-            return;
-#endif
-        } else if (type_str.contains("AVIF")) { // libmagic can identify AVIF 
images as "ISO Media, AVIF Image"
-#ifdef HEIF_FOUND
-            CAIROSURFACE = AVIF::createSurfaceFromAvif(path);
-            mime         = "image/avif";
+        case IMAGE_FORMAT_JXL: CAIROSURFACE = JXL::createSurfaceFromJXL(path); 
break;
 #else
-            lastError = "hyprgraphics compiled without AVIF support";
-            return;
+        case IMAGE_FORMAT_JXL: lastError = "hyprgraphics compiled without JXL 
support"; return;
 #endif
-        } else if (first_word == "BMP") {
-            CAIROSURFACE  = BMP::createSurfaceFromBMP(path);
-            imageHasAlpha = false;
-            mime          = "image/bmp";
-        } else if (first_word == "SVG") {
-            CAIROSURFACE  = SVG::createSurfaceFromSVG(path, m_svgSize);
-            imageHasAlpha = false;
-            mime          = "image/svg";
-        } else {
-            lastError = "unrecognized image";
-            return;
-        }
+        case IMAGE_FORMAT_JPEG: CAIROSURFACE = 
JPEG::createSurfaceFromJPEG(path); break;
+        case IMAGE_FORMAT_SVG: CAIROSURFACE = SVG::createSurfaceFromSVG(path, 
size); break;
+        case IMAGE_FORMAT_WEBP: CAIROSURFACE = 
WEBP::createSurfaceFromWEBP(path); break;
+        default: lastError = "internal error"; return;
     }
 
     if (!CAIROSURFACE) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/src/image/formats/Svg.cpp 
new/hyprgraphics-0.5.0/src/image/formats/Svg.cpp
--- old/hyprgraphics-0.3.0/src/image/formats/Svg.cpp    2025-11-06 
21:47:32.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/image/formats/Svg.cpp    2025-12-28 
19:25:35.000000000 +0100
@@ -60,4 +60,37 @@
     g_object_unref(handle);
 
     return cairoSurface;
+}
+
+std::expected<cairo_surface_t*, std::string> SVG::createSurfaceFromData(const 
std::span<const uint8_t>& data, const Vector2D& size) {
+    if (size.x < 1 || size.y < 1)
+        return std::unexpected("loading svg: invalid size");
+
+    auto       cairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 
size.x, size.y);
+
+    const auto PCAIRO = cairo_create(cairoSurface);
+
+    cairo_save(PCAIRO);
+    cairo_set_operator(PCAIRO, CAIRO_OPERATOR_CLEAR);
+    cairo_paint(PCAIRO);
+    cairo_restore(PCAIRO);
+
+    GError*     error = nullptr;
+
+    RsvgHandle* handle = rsvg_handle_new_from_data((unsigned 
char*)data.data(), data.size(), &error);
+
+    if (!handle)
+        return std::unexpected("loading svg: rsvg failed to read data");
+
+    RsvgRectangle rect = {0, 0, (double)size.x, (double)size.y};
+
+    if (!rsvg_handle_render_document(handle, PCAIRO, &rect, &error))
+        return std::unexpected("loading svg: rsvg failed to render");
+
+    // done
+    cairo_surface_flush(cairoSurface);
+    cairo_destroy(PCAIRO);
+    g_object_unref(handle);
+
+    return cairoSurface;
 }
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/src/image/formats/Svg.hpp 
new/hyprgraphics-0.5.0/src/image/formats/Svg.hpp
--- old/hyprgraphics-0.3.0/src/image/formats/Svg.hpp    2025-11-06 
21:47:32.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/image/formats/Svg.hpp    2025-12-28 
19:25:35.000000000 +0100
@@ -8,4 +8,5 @@
 
 namespace SVG {
     std::expected<cairo_surface_t*, std::string> createSurfaceFromSVG(const 
std::string&, const Hyprutils::Math::Vector2D& size);
+    std::expected<cairo_surface_t*, std::string> createSurfaceFromData(const 
std::span<const uint8_t>&, const Hyprutils::Math::Vector2D& size);
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/src/image/utils/Format.cpp 
new/hyprgraphics-0.5.0/src/image/utils/Format.cpp
--- old/hyprgraphics-0.3.0/src/image/utils/Format.cpp   1970-01-01 
01:00:00.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/image/utils/Format.cpp   2025-12-28 
19:25:35.000000000 +0100
@@ -0,0 +1,88 @@
+#include "Format.hpp"
+
+#include <magic.h>
+
+#include <hyprutils/utils/ScopeGuard.hpp>
+
+using namespace Hyprgraphics;
+using namespace Hyprutils::Utils;
+
+static eImageFormat formatFromStr(const std::string& r) {
+    if (r == "image/png")
+        return IMAGE_FORMAT_PNG;
+    if (r == "image/jpeg" || r == "image/jpg")
+        return IMAGE_FORMAT_JPEG;
+    if (r == "image/bmp")
+        return IMAGE_FORMAT_BMP;
+    if (r == "image/webp")
+        return IMAGE_FORMAT_WEBP;
+    if (r == "image/svg" || r.starts_with("image/svg") /* +xml */)
+        return IMAGE_FORMAT_SVG;
+    if (r == "image/jxl")
+        return IMAGE_FORMAT_JXL;
+    if (r == "image/avif")
+        return IMAGE_FORMAT_AVIF;
+
+    return IMAGE_FORMAT_ERROR;
+}
+
+static eImageFormat formatOf(const std::span<const uint8_t>& data) {
+    magic_t m = magic_open(MAGIC_MIME_TYPE);
+    if (!m)
+        return IMAGE_FORMAT_ERROR;
+
+    CScopeGuard x([&] {
+        magic_close(m); //
+    });
+
+    if (magic_load(m, nullptr) != 0)
+        return IMAGE_FORMAT_ERROR;
+
+    const char* result = magic_buffer(m, data.data(), data.size());
+    if (!result)
+        return IMAGE_FORMAT_ERROR;
+
+    auto r = std::string{result};
+    return formatFromStr(r);
+}
+
+static eImageFormat formatOf(const std::string& path) {
+    magic_t m = magic_open(MAGIC_MIME_TYPE | MAGIC_SYMLINK);
+    if (!m)
+        return IMAGE_FORMAT_ERROR;
+
+    CScopeGuard x([&] {
+        magic_close(m); //
+    });
+
+    if (magic_load(m, nullptr) != 0)
+        return IMAGE_FORMAT_ERROR;
+
+    const char* result = magic_file(m, path.c_str());
+    if (!result)
+        return IMAGE_FORMAT_ERROR;
+
+    auto r = std::string{result};
+    return formatFromStr(r);
+}
+
+eImageFormat Hyprgraphics::formatFromStream(const std::span<const uint8_t>& 
data) {
+    return formatOf(data);
+}
+
+eImageFormat Hyprgraphics::formatFromFile(const std::string& path) {
+    return formatOf(path);
+}
+
+const char* Hyprgraphics::mimeOf(eImageFormat f) {
+    switch (f) {
+        case IMAGE_FORMAT_PNG: return "image/png";
+        case IMAGE_FORMAT_AVIF: return "image/avif";
+        case IMAGE_FORMAT_BMP: return "image/bmp";
+        case IMAGE_FORMAT_JPEG: return "image/jpeg";
+        case IMAGE_FORMAT_JXL: return "image/jxl";
+        case IMAGE_FORMAT_SVG: return "image/svg";
+        case IMAGE_FORMAT_WEBP: return "image/webp";
+        default: return "error";
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/src/image/utils/Format.hpp 
new/hyprgraphics-0.5.0/src/image/utils/Format.hpp
--- old/hyprgraphics-0.3.0/src/image/utils/Format.hpp   1970-01-01 
01:00:00.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/image/utils/Format.hpp   2025-12-28 
19:25:35.000000000 +0100
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <hyprgraphics/image/Image.hpp>
+
+namespace Hyprgraphics {
+    eImageFormat formatFromStream(const std::span<const uint8_t>& data);
+    eImageFormat formatFromFile(const std::string& path);
+    const char*  mimeOf(eImageFormat);
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/src/resource/AsyncResourceGatherer.cpp 
new/hyprgraphics-0.5.0/src/resource/AsyncResourceGatherer.cpp
--- old/hyprgraphics-0.3.0/src/resource/AsyncResourceGatherer.cpp       
2025-11-06 21:47:32.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/resource/AsyncResourceGatherer.cpp       
2025-12-28 19:25:35.000000000 +0100
@@ -1,4 +1,5 @@
 #include <hyprgraphics/resource/AsyncResourceGatherer.hpp>
+#include "resources/AsyncResource.hpp"
 
 using namespace Hyprgraphics;
 
@@ -28,6 +29,13 @@
     wakeUpMainThread();
 }
 
+void 
CAsyncResourceGatherer::await(Hyprutils::Memory::CAtomicSharedPointer<IAsyncResource>
 resource) {
+    resource->m_impl->awaitingCv = 
Hyprutils::Memory::makeUnique<std::condition_variable>();
+    std::unique_lock<std::mutex> lk(resource->m_impl->awaitingMtx);
+    resource->m_impl->awaitingCv->wait(lk, [&resource] { return 
resource->m_impl->awaitingEvent; });
+    resource->m_impl->awaitingCv.reset();
+}
+
 void CAsyncResourceGatherer::asyncAssetSpinLock() {
     while (!m_asyncLoopState.exit) {
 
@@ -56,6 +64,10 @@
         for (auto& r : requests) {
             r->render();
 
+            if (r->m_impl->awaitingCv) {
+                r->m_impl->awaitingEvent = true;
+                r->m_impl->awaitingCv->notify_all();
+            }
             r->m_ready = true;
             r->m_events.finished.emit();
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/src/resource/resources/AsyncResource.cpp 
new/hyprgraphics-0.5.0/src/resource/resources/AsyncResource.cpp
--- old/hyprgraphics-0.3.0/src/resource/resources/AsyncResource.cpp     
1970-01-01 01:00:00.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/resource/resources/AsyncResource.cpp     
2025-12-28 19:25:35.000000000 +0100
@@ -0,0 +1,8 @@
+#include "AsyncResource.hpp"
+
+using namespace Hyprgraphics;
+using namespace Hyprutils::Memory;
+
+IAsyncResource::IAsyncResource() : m_impl(makeUnique<SAsyncResourceImpl>()) {
+    ;
+}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/src/resource/resources/AsyncResource.hpp 
new/hyprgraphics-0.5.0/src/resource/resources/AsyncResource.hpp
--- old/hyprgraphics-0.3.0/src/resource/resources/AsyncResource.hpp     
1970-01-01 01:00:00.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/resource/resources/AsyncResource.hpp     
2025-12-28 19:25:35.000000000 +0100
@@ -0,0 +1,11 @@
+#include <hyprgraphics/resource/resources/AsyncResource.hpp>
+
+#include <condition_variable>
+
+namespace Hyprgraphics {
+    struct SAsyncResourceImpl {
+        Hyprutils::Memory::CUniquePointer<std::condition_variable> awaitingCv;
+        std::mutex                                                 awaitingMtx;
+        bool                                                       
awaitingEvent = false;
+    };
+}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hyprgraphics-0.3.0/src/resource/resources/ImageResource.cpp 
new/hyprgraphics-0.5.0/src/resource/resources/ImageResource.cpp
--- old/hyprgraphics-0.3.0/src/resource/resources/ImageResource.cpp     
2025-11-06 21:47:32.000000000 +0100
+++ new/hyprgraphics-0.5.0/src/resource/resources/ImageResource.cpp     
2025-12-28 19:25:35.000000000 +0100
@@ -17,8 +17,12 @@
     ;
 }
 
+CImageResource::CImageResource(const std::span<const uint8_t>& data, const 
Hyprutils::Math::Vector2D& size) : m_svgSize(size), m_data(data) {
+    ;
+}
+
 void CImageResource::render() {
-    auto image = CImage(m_path, m_svgSize);
+    auto image = !m_data.empty() ? CImage(m_data, IMAGE_FORMAT_AUTO, 
m_svgSize) : CImage(m_path, m_svgSize);
 
     m_asset.cairoSurface = image.cairoSurface();
     m_asset.pixelSize    = m_asset.cairoSurface && 
m_asset.cairoSurface->cairo() ? m_asset.cairoSurface->size() : 
Hyprutils::Math::Vector2D{};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hyprgraphics-0.3.0/tests/image.cpp 
new/hyprgraphics-0.5.0/tests/image.cpp
--- old/hyprgraphics-0.3.0/tests/image.cpp      2025-11-06 21:47:32.000000000 
+0100
+++ new/hyprgraphics-0.5.0/tests/image.cpp      2025-12-28 19:25:35.000000000 
+0100
@@ -88,12 +88,15 @@
     }
 
     auto pngBuffer = getImageBuffer("./resource/images/hyprland.png");
-    EXPECT(tryLoadImageFromBuffer(pngBuffer, Hyprgraphics::IMAGE_FORMAT_PNG), 
true);
+    EXPECT(tryLoadImageFromBuffer(pngBuffer, Hyprgraphics::IMAGE_FORMAT_AUTO), 
true);
 
 #ifdef HEIF_FOUND
     auto avifBuffer = getImageBuffer("./resource/images/hyprland.avif");
     EXPECT(tryLoadImageFromBuffer(avifBuffer, 
Hyprgraphics::IMAGE_FORMAT_AVIF), true);
 #endif
 
+    auto svgBuffer = getImageBuffer("./resource/images/hyprland.svg");
+    EXPECT(tryLoadImageFromBuffer(pngBuffer, Hyprgraphics::IMAGE_FORMAT_AUTO), 
true);
+
     return ret;
 }

Reply via email to