diff --git a/.github/workflows/scripts/linux/appimage-qt.sh b/.github/workflows/scripts/linux/appimage-qt.sh index d1b3c0dfd9a69..22e02749f6a41 100755 --- a/.github/workflows/scripts/linux/appimage-qt.sh +++ b/.github/workflows/scripts/linux/appimage-qt.sh @@ -42,7 +42,7 @@ APPDIRNAME=PCSX2.AppDir STRIP=strip declare -a MANUAL_LIBS=( - "libfreetype.so" + "libfreetype.so.6" "libshaderc_shared.so" ) @@ -91,21 +91,16 @@ OUTDIR=$(realpath "./$APPDIRNAME") rm -fr "$OUTDIR" echo "Locating extra libraries..." -EXTRA_LIBS_ARGS="" +EXTRA_LIBS_ARGS=() for lib in "${MANUAL_LIBS[@]}"; do srcpath=$(find "$DEPSDIR" -name "$lib") if [ ! -f "$srcpath" ]; then - echo "Missinge extra library $lib. Exiting." + echo "Missing extra library $lib. Exiting." exit 1 fi echo "Found $lib at $srcpath." - - if [ "$EXTRA_LIBS_ARGS" == "" ]; then - EXTRA_LIBS_ARGS="--library=$srcpath" - else - EXTRA_LIBS_ARGS="$EXTRA_LIBS_ARGS,$srcpath" - fi + EXTRA_LIBS_ARGS+=("--library=$srcpath") done # Why the nastyness? linuxdeploy strips our main binary, and there's no option to turn it off. diff --git a/.github/workflows/scripts/linux/build-dependencies-qt.sh b/.github/workflows/scripts/linux/build-dependencies-qt.sh index 83acda754daf6..d7f59e7f2d855 100755 --- a/.github/workflows/scripts/linux/build-dependencies-qt.sh +++ b/.github/workflows/scripts/linux/build-dependencies-qt.sh @@ -73,7 +73,7 @@ curl -L \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtwayland-everywhere-src-$QT.tar.xz" \ -o "harfbuzz-$HARFBUZZ.tar.gz" "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/$HARFBUZZ.tar.gz"\ -o "freetype-$FREETYPE.tar.xz" "https://sourceforge.net/projects/freetype/files/freetype2/$FREETYPE/freetype-$FREETYPE.tar.xz/download"\ - -o "lunasvg-$LUNASVG.tar.gz" "https://github.com/JordanTheToast/lunasvg/archive/$LUNASVG.tar.gz" \ + -o "lunasvg-$LUNASVG.tar.gz" "https://github.com/JordanTheToaster/lunasvg/archive/$LUNASVG.tar.gz" \ -o "shaderc-$SHADERC.tar.gz" "https://github.com/google/shaderc/archive/refs/tags/v$SHADERC.tar.gz" \ -o "shaderc-glslang-$SHADERC_GLSLANG.tar.gz" "https://github.com/KhronosGroup/glslang/archive/$SHADERC_GLSLANG.tar.gz" \ -o "shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Headers/archive/$SHADERC_SPIRVHEADERS.tar.gz" \ diff --git a/.github/workflows/scripts/linux/flatpak/modules/27-lunasvg.yaml b/.github/workflows/scripts/linux/flatpak/modules/27-lunasvg.yaml index 8badef0c75ebb..7b65bbab1e37b 100644 --- a/.github/workflows/scripts/linux/flatpak/modules/27-lunasvg.yaml +++ b/.github/workflows/scripts/linux/flatpak/modules/27-lunasvg.yaml @@ -9,7 +9,7 @@ build-options: strip: true sources: - type: git - url: "https://github.com/JordanTheToast/lunasvg.git" + url: "https://github.com/JordanTheToaster/lunasvg.git" commit: "9af1ac7b90658a279b372add52d6f77a4ebb482c" cleanup: - /bin diff --git a/.github/workflows/scripts/macos/build-dependencies-universal.sh b/.github/workflows/scripts/macos/build-dependencies-universal.sh index 42fdff5bc85e8..00439b7768f6e 100755 --- a/.github/workflows/scripts/macos/build-dependencies-universal.sh +++ b/.github/workflows/scripts/macos/build-dependencies-universal.sh @@ -265,15 +265,6 @@ cmake --build build --parallel cmake --install build cd .. -echo "Building lunasvg..." -rm -fr "lunasvg-$LUNASVG" -tar xf "lunasvg-$LUNASVG.tar.gz" -cd "lunasvg-$LUNASVG" -cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DBUILD_SHARED_LIBS=ON -DLUNASVG_BUILD_EXAMPLES=OFF -B build -G Ninja -cmake --build build --parallel -ninja -C build install -cd .. - # MoltenVK already builds universal binaries, nothing special to do here. echo "Installing MoltenVK..." rm -fr "MoltenVK-${MOLTENVK}" diff --git a/.github/workflows/scripts/macos/build-dependencies.sh b/.github/workflows/scripts/macos/build-dependencies.sh index 608692cd71952..ea745e72af517 100755 --- a/.github/workflows/scripts/macos/build-dependencies.sh +++ b/.github/workflows/scripts/macos/build-dependencies.sh @@ -93,7 +93,7 @@ curl -L \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \ - -o "lunasvg-$LUNASVG.tar.gz" "https://github.com/JordanTheToast/lunasvg/archive/$LUNASVG.tar.gz" \ + -o "lunasvg-$LUNASVG.tar.gz" "https://github.com/JordanTheToaster/lunasvg/archive/$LUNASVG.tar.gz" \ -o "shaderc-$SHADERC.tar.gz" "https://github.com/google/shaderc/archive/refs/tags/v$SHADERC.tar.gz" \ -o "shaderc-glslang-$SHADERC_GLSLANG.tar.gz" "https://github.com/KhronosGroup/glslang/archive/$SHADERC_GLSLANG.tar.gz" \ -o "shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Headers/archive/$SHADERC_SPIRVHEADERS.tar.gz" \ @@ -209,9 +209,9 @@ echo "Building lunasvg..." rm -fr "lunasvg-$LUNASVG" tar xf "lunasvg-$LUNASVG.tar.gz" cd "lunasvg-$LUNASVG" -cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DBUILD_SHARED_LIBS=ON -DLUNASVG_BUILD_EXAMPLES=OFF -B build -G Ninja +cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DBUILD_SHARED_LIBS=ON -DLUNASVG_BUILD_EXAMPLES=OFF -B build cmake --build build --parallel -ninja -C build install +cmake --install build cd .. # MoltenVK already builds universal binaries, nothing special to do here. diff --git a/.github/workflows/scripts/windows/build-dependencies-arm64.bat b/.github/workflows/scripts/windows/build-dependencies-arm64.bat index f2a0d682fe0b0..81ec6f703a2bc 100644 --- a/.github/workflows/scripts/windows/build-dependencies-arm64.bat +++ b/.github/workflows/scripts/windows/build-dependencies-arm64.bat @@ -63,7 +63,7 @@ set SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7 call :downloadfile "freetype-%FREETYPE%.tar.gz" https://sourceforge.net/projects/freetype/files/freetype2/%FREETYPE%/freetype-%FREETYPE%.tar.gz/download 5c3a8e78f7b24c20b25b54ee575d6daa40007a5f4eea2845861c3409b3021747 || goto error call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip 8adf9f5a4b6022aa2744f45c89ce347df46fea8403e99f01d650b11c417d0aa8 || goto error -call :downloadfile "lunasvg-%LUNASVG%.zip" "https://github.com/JordanTheToast/lunasvg/archive/%LUNASVG%.zip" 1425ec2bda0228b73ffdc70b0dc666fc7d2b69c33eec75a35c4421157c0e220c || goto error +call :downloadfile "lunasvg-%LUNASVG%.zip" "https://github.com/JordanTheToaster/lunasvg/archive/%LUNASVG%.zip" 1425ec2bda0228b73ffdc70b0dc666fc7d2b69c33eec75a35c4421157c0e220c || goto error call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 || goto error diff --git a/.github/workflows/scripts/windows/build-dependencies.bat b/.github/workflows/scripts/windows/build-dependencies.bat index 3961214e13cc0..7eca125994a64 100644 --- a/.github/workflows/scripts/windows/build-dependencies.bat +++ b/.github/workflows/scripts/windows/build-dependencies.bat @@ -61,7 +61,7 @@ set SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7 call :downloadfile "freetype-%FREETYPE%.tar.gz" https://sourceforge.net/projects/freetype/files/freetype2/%FREETYPE%/freetype-%FREETYPE%.tar.gz/download 5c3a8e78f7b24c20b25b54ee575d6daa40007a5f4eea2845861c3409b3021747 || goto error call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip 8adf9f5a4b6022aa2744f45c89ce347df46fea8403e99f01d650b11c417d0aa8 || goto error -call :downloadfile "lunasvg-%LUNASVG%.zip" "https://github.com/JordanTheToast/lunasvg/archive/%LUNASVG%.zip" 1425ec2bda0228b73ffdc70b0dc666fc7d2b69c33eec75a35c4421157c0e220c || goto error +call :downloadfile "lunasvg-%LUNASVG%.zip" "https://github.com/JordanTheToaster/lunasvg/archive/%LUNASVG%.zip" 1425ec2bda0228b73ffdc70b0dc666fc7d2b69c33eec75a35c4421157c0e220c || goto error call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 || goto error diff --git a/3rdparty/imgui/CMakeLists.txt b/3rdparty/imgui/CMakeLists.txt index 74f9953cc447b..03ae23b9e6682 100644 --- a/3rdparty/imgui/CMakeLists.txt +++ b/3rdparty/imgui/CMakeLists.txt @@ -5,6 +5,8 @@ add_library(imgui include/imgui_internal.h include/imgui_stdlib.h include/imstb_textedit.h + include/lunasvg.h + include/lunasvg_c.h src/imgui.cpp src/imgui_demo.cpp src/imgui_draw.cpp diff --git a/3rdparty/imgui/imgui.vcxproj b/3rdparty/imgui/imgui.vcxproj index c683a97680854..d39181f8f84bc 100644 --- a/3rdparty/imgui/imgui.vcxproj +++ b/3rdparty/imgui/imgui.vcxproj @@ -33,7 +33,7 @@ %(PreprocessorDefinitions) TurnOffAllWarnings - $(ProjectDir)include;$(ProjectDir)src;$(DepsIncludeDir)freetype2;$(DepsIncludeDir);%(AdditionalIncludeDirectories) + $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)deps\include\freetype2;%(AdditionalIncludeDirectories) @@ -45,6 +45,8 @@ + + diff --git a/3rdparty/imgui/imgui.vcxproj.filters b/3rdparty/imgui/imgui.vcxproj.filters index 3c459f844589c..c2355ed023331 100644 --- a/3rdparty/imgui/imgui.vcxproj.filters +++ b/3rdparty/imgui/imgui.vcxproj.filters @@ -9,6 +9,8 @@ + + diff --git a/3rdparty/imgui/include/lunasvg.h b/3rdparty/imgui/include/lunasvg.h new file mode 100644 index 0000000000000..1e63f29a36e48 --- /dev/null +++ b/3rdparty/imgui/include/lunasvg.h @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2020 Nwutobo Samuel Ugochukwu + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. +*/ + +#ifndef LUNASVG_H +#define LUNASVG_H + +#include +#include +#include +#include + +#define LUNASVG_VERSION_MAJOR 2 +#define LUNASVG_VERSION_MINOR 4 +#define LUNASVG_VERSION_MICRO 1 + +#define LUNASVG_VERSION_ENCODE(major, minor, micro) (((major) * 10000) + ((minor) * 100) + ((micro) * 1)) +#define LUNASVG_VERSION LUNASVG_VERSION_ENCODE(LUNASVG_VERSION_MAJOR, LUNASVG_VERSION_MINOR, LUNASVG_VERSION_MICRO) + +#define LUNASVG_VERSION_XSTRINGIZE(major, minor, micro) #major"."#minor"."#micro +#define LUNASVG_VERSION_STRINGIZE(major, minor, micro) LUNASVG_VERSION_XSTRINGIZE(major, minor, micro) +#define LUNASVG_VERSION_STRING LUNASVG_VERSION_STRINGIZE(LUNASVG_VERSION_MAJOR, LUNASVG_VERSION_MINOR, LUNASVG_VERSION_MICRO) + +namespace lunasvg { + +class Rect; +class Matrix; + +class Box { +public: + Box() = default; + Box(double x, double y, double w, double h); + Box(const Rect& rect); + + Box& transform(const Matrix& matrix); + Box transformed(const Matrix& matrix) const; + +public: + double x{0}; + double y{0}; + double w{0}; + double h{0}; +}; + +class Transform; + +class Matrix { +public: + Matrix() = default; + Matrix(double a, double b, double c, double d, double e, double f); + Matrix(const Transform& transform); + + Matrix& rotate(double angle); + Matrix& rotate(double angle, double cx, double cy); + Matrix& scale(double sx, double sy); + Matrix& shear(double shx, double shy); + Matrix& translate(double tx, double ty); + Matrix& transform(double a, double b, double c, double d, double e, double f); + Matrix& identity(); + Matrix& invert(); + + Matrix& operator*=(const Matrix& matrix); + Matrix& premultiply(const Matrix& matrix); + Matrix& postmultiply(const Matrix& matrix); + + Matrix inverted() const; + Matrix operator*(const Matrix& matrix) const; + + static Matrix rotated(double angle); + static Matrix rotated(double angle, double cx, double cy); + static Matrix scaled(double sx, double sy); + static Matrix sheared(double shx, double shy); + static Matrix translated(double tx, double ty); + +public: + double a{1}; + double b{0}; + double c{0}; + double d{1}; + double e{0}; + double f{0}; +}; + +class Bitmap { +public: + /** + * @note Bitmap format is ARGB32 Premultiplied. + */ + Bitmap(); + Bitmap(std::uint8_t* data, std::uint32_t width, std::uint32_t height, std::uint32_t stride); + Bitmap(std::uint32_t width, std::uint32_t height); + + void reset(std::uint8_t* data, std::uint32_t width, std::uint32_t height, std::uint32_t stride); + void reset(std::uint32_t width, std::uint32_t height); + + std::uint8_t* data() const; + std::uint32_t width() const; + std::uint32_t height() const; + std::uint32_t stride() const; + + void clear(std::uint32_t color); + void convert(int ri, int gi, int bi, int ai, bool unpremultiply); + void convertToRGBA() { convert(0, 1, 2, 3, true); } + + bool valid() const { return !!m_impl; } + +private: + struct Impl; + std::shared_ptr m_impl; +}; + +class Element; + +class DomElement { +public: + /** + * @brief DomElement + */ + DomElement() = default; + + /** + * @brief DomElement + * @param element + */ + DomElement(Element* element); + + /** + * @brief setAttribute + * @param name + * @param value + */ + void setAttribute(const std::string& name, const std::string& value); + + /** + * @brief getAttribute + * @param name + * @return + */ + std::string getAttribute(const std::string& name) const; + + /** + * @brief removeAttribute + * @param name + */ + void removeAttribute(const std::string& name); + + /** + * @brief hasAttribute + * @param name + * @return + */ + bool hasAttribute(const std::string& name) const; + + /** + * @brief getBBox + * @return + */ + Box getBBox() const; + + /** + * @brief getLocalTransform + * @return + */ + Matrix getLocalTransform() const; + + /** + * @brief getAbsoluteTransform + * @return + */ + Matrix getAbsoluteTransform() const; + + /** + * @brief isNull + * @return + */ + bool isNull() const { return m_element == nullptr; } + + /** + * @brief get + * @return + */ + Element* get() { return m_element; } + + /** + * @brief Renders the document to a bitmap + * @param matrix - the current transformation matrix + * @param bitmap - target image on which the content will be drawn + */ + void render(Bitmap bitmap, const Matrix& matrix = Matrix{}) const; + + /** + * @brief renderToBitmap + * @param width + * @param height + * @param backgroundColor + * @return + */ + Bitmap renderToBitmap(std::uint32_t width, std::uint32_t height, std::uint32_t backgroundColor = 0x00000000) const; + +private: + Element* m_element = nullptr; +}; + +class LayoutSymbol; +class SVGElement; + +class Document { +public: + /** + * @brief Creates a document from a file + * @param filename - file to load + * @return pointer to document on success, otherwise nullptr + */ + static std::unique_ptr loadFromFile(const std::string& filename); + + /** + * @brief Creates a document from a string + * @param string - string to load + * @return pointer to document on success, otherwise nullptr + */ + static std::unique_ptr loadFromData(const std::string& string); + + /** + * @brief Creates a document from a string data and size + * @param data - string data to load + * @param size - size of the data to load, in bytes + * @return pointer to document on success, otherwise nullptr + */ + static std::unique_ptr loadFromData(const char* data, std::size_t size); + + /** + * @brief Creates a document from a null terminated string data + * @param data - null terminated string data to load + * @return pointer to document on success, otherwise nullptr + */ + static std::unique_ptr loadFromData(const char* data); + + /** + * @brief Sets the current transformation matrix of the document + * @param matrix - current transformation matrix + */ + void setMatrix(const Matrix& matrix); + + /** + * @brief Returns the current transformation matrix of the document + * @return the current transformation matrix + */ + Matrix matrix() const; + + /** + * @brief Returns the smallest rectangle in which the document fits + * @return the smallest rectangle in which the document fits + */ + Box box() const; + + /** + * @brief Returns width of the document + * @return the width of the document in pixels + */ + double width() const; + + /** + * @brief Returns the height of the document + * @return the height of the document in pixels + */ + double height() const; + + /** + * @brief Renders the document to a bitmap + * @param matrix - the current transformation matrix + * @param bitmap - target image on which the content will be drawn + */ + void render(Bitmap bitmap, const Matrix& matrix = Matrix{}) const; + + /** + * @brief Renders the document to a bitmap + * @param width - maximum width, in pixels + * @param height - maximum height, in pixels + * @param backgroundColor - background color in 0xRRGGBBAA format + * @return the raster representation of the document + */ + Bitmap renderToBitmap(std::uint32_t width = 0, std::uint32_t height = 0, std::uint32_t backgroundColor = 0x00000000) const; + + /** + * @brief updateLayout + */ + void updateLayout(); + + Document(Document&&); + ~Document(); + + DomElement getElementById(const std::string& id) const; + DomElement rootElement() const; + +private: + Document(); + bool parse(const char* data, size_t size); + std::unique_ptr m_rootElement; + std::map m_idCache; + std::unique_ptr m_rootBox; +}; + +} //namespace lunasvg + +#endif // LUNASVG_H diff --git a/3rdparty/imgui/include/lunasvg_c.h b/3rdparty/imgui/include/lunasvg_c.h new file mode 100644 index 0000000000000..515537c51f308 --- /dev/null +++ b/3rdparty/imgui/include/lunasvg_c.h @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2020 Nwutobo Samuel Ugochukwu + * Copyright (c) 2024 Connor McLaughlin + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef LUNASVG_C_H +#define LUNASVG_C_H + +#include +#include + +#if !defined(LUNASVG_BUILD_STATIC) && (defined(_WIN32) || defined(__CYGWIN__)) +#define LUNASVG_EXPORT __declspec(dllexport) +#define LUNASVG_IMPORT __declspec(dllimport) +#elif defined(__GNUC__) && (__GNUC__ >= 4) +#define LUNASVG_EXPORT __attribute__((__visibility__("default"))) +#define LUNASVG_IMPORT +#else +#define LUNASVG_EXPORT +#define LUNASVG_IMPORT +#endif + +#ifdef LUNASVG_BUILD +#include "lunasvg.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef LUNASVG_BUILD +typedef lunasvg::Box lunasvg_box; +typedef lunasvg::Matrix lunasvg_matrix; +typedef lunasvg::Bitmap lunasvg_bitmap; +typedef lunasvg::Document lunasvg_document; + +#define LUNASVG_API LUNASVG_EXPORT +#else +typedef void* lunasvg_box; +typedef void* lunasvg_matrix; +typedef void* lunasvg_bitmap; +typedef void* lunasvg_document; +#define LUNASVG_API LUNASVG_IMPORT +#endif + +LUNASVG_API lunasvg_box* lunasvg_box_create(); +LUNASVG_API lunasvg_box* lunasvg_box_create_with_values(double x, double y, double w, double h); +LUNASVG_API lunasvg_box* lunasvg_box_create_from_rect(const lunasvg_box* rect); +LUNASVG_API void lunasvg_box_destroy(lunasvg_box* box); +LUNASVG_API void lunasvg_box_transform(lunasvg_box* box, const lunasvg_matrix* matrix); +LUNASVG_API lunasvg_box* lunasvg_box_transformed(const lunasvg_box* box, const lunasvg_matrix* matrix); +LUNASVG_API void lunasvg_box_get_values(const lunasvg_box* box, double* x, double* y, double* w, double* h); +LUNASVG_API double lunasvg_box_get_x(const lunasvg_box* box); +LUNASVG_API double lunasvg_box_get_y(const lunasvg_box* box); +LUNASVG_API double lunasvg_box_get_width(const lunasvg_box* box); +LUNASVG_API double lunasvg_box_get_height(const lunasvg_box* box); +LUNASVG_API void lunasvg_box_set_x(lunasvg_box* box, double x); +LUNASVG_API void lunasvg_box_set_y(lunasvg_box* box, double y); +LUNASVG_API void lunasvg_box_set_width(lunasvg_box* box, double width); +LUNASVG_API void lunasvg_box_set_height(lunasvg_box* box, double height); + +LUNASVG_API lunasvg_matrix* lunasvg_matrix_create(); +LUNASVG_API lunasvg_matrix* lunasvg_matrix_create_with_values(double a, double b, double c, double d, double e, + double f); +LUNASVG_API void lunasvg_matrix_destroy(lunasvg_matrix* matrix); +LUNASVG_API void lunasvg_matrix_rotate(lunasvg_matrix* matrix, double angle); +LUNASVG_API void lunasvg_matrix_rotate_around_point(lunasvg_matrix* matrix, double angle, double cx, double cy); +LUNASVG_API void lunasvg_matrix_scale(lunasvg_matrix* matrix, double sx, double sy); +LUNASVG_API void lunasvg_matrix_shear(lunasvg_matrix* matrix, double shx, double shy); +LUNASVG_API void lunasvg_matrix_translate(lunasvg_matrix* matrix, double tx, double ty); +LUNASVG_API void lunasvg_matrix_transform(lunasvg_matrix* matrix, double a, double b, double c, double d, double e, + double f); +LUNASVG_API void lunasvg_matrix_identity(lunasvg_matrix* matrix); +LUNASVG_API void lunasvg_matrix_invert(lunasvg_matrix* matrix); +LUNASVG_API void lunasvg_matrix_multiply(lunasvg_matrix* matrix, const lunasvg_matrix* rhs); +LUNASVG_API void lunasvg_matrix_premultiply(lunasvg_matrix* matrix, const lunasvg_matrix* rhs); +LUNASVG_API void lunasvg_matrix_postmultiply(lunasvg_matrix* matrix, const lunasvg_matrix* rhs); +LUNASVG_API lunasvg_matrix* lunasvg_matrix_inverted(const lunasvg_matrix* matrix); +LUNASVG_API lunasvg_matrix* lunasvg_matrix_rotated(double angle); +LUNASVG_API lunasvg_matrix* lunasvg_matrix_rotated_around_point(double angle, double cx, double cy); +LUNASVG_API lunasvg_matrix* lunasvg_matrix_scaled(double sx, double sy); +LUNASVG_API lunasvg_matrix* lunasvg_matrix_sheared(double shx, double shy); +LUNASVG_API lunasvg_matrix* lunasvg_matrix_translated(double tx, double ty); +LUNASVG_API void lunasvg_matrix_get_values(const lunasvg_matrix* matrix, double* a, double* b, double* c, double* d, + double* e, double* f); + +LUNASVG_API lunasvg_bitmap* lunasvg_bitmap_create(); +LUNASVG_API lunasvg_bitmap* lunasvg_bitmap_create_with_data(uint8_t* data, uint32_t width, uint32_t height, + uint32_t stride); +LUNASVG_API lunasvg_bitmap* lunasvg_bitmap_create_with_size(uint32_t width, uint32_t height); +LUNASVG_API void lunasvg_bitmap_destroy(lunasvg_bitmap* bitmap); +LUNASVG_API void lunasvg_bitmap_reset_with_data(lunasvg_bitmap* bitmap, uint8_t* data, uint32_t width, uint32_t height, + uint32_t stride); +LUNASVG_API void lunasvg_bitmap_reset_with_size(lunasvg_bitmap* bitmap, uint32_t width, uint32_t height); +LUNASVG_API uint8_t* lunasvg_bitmap_data(const lunasvg_bitmap* bitmap); +LUNASVG_API uint32_t lunasvg_bitmap_width(const lunasvg_bitmap* bitmap); +LUNASVG_API uint32_t lunasvg_bitmap_height(const lunasvg_bitmap* bitmap); +LUNASVG_API uint32_t lunasvg_bitmap_stride(const lunasvg_bitmap* bitmap); +LUNASVG_API void lunasvg_bitmap_clear(lunasvg_bitmap* bitmap, uint32_t color); +LUNASVG_API void lunasvg_bitmap_convert(lunasvg_bitmap* bitmap, int ri, int gi, int bi, int ai, int unpremultiply); +LUNASVG_API void lunasvg_bitmap_convert_to_rgba(lunasvg_bitmap* bitmap); +LUNASVG_API bool lunasvg_bitmap_valid(const lunasvg_bitmap* bitmap); + +LUNASVG_API lunasvg_document* lunasvg_document_load_from_file(const char* filename); +LUNASVG_API lunasvg_document* lunasvg_document_load_from_data(const void* data, size_t size); +LUNASVG_API lunasvg_document* lunasvg_document_load_from_string(const char* data); +LUNASVG_API void lunasvg_document_destroy(lunasvg_document* document); +LUNASVG_API void lunasvg_document_set_matrix(lunasvg_document* document, const lunasvg_matrix* matrix); +LUNASVG_API void lunasvg_document_set_identity_matrix(lunasvg_document* document); +LUNASVG_API void lunasvg_document_get_matrix(const lunasvg_document* document, lunasvg_matrix* matrix); +LUNASVG_API void lunasvg_document_get_box(const lunasvg_document* document, lunasvg_box* box); +LUNASVG_API double lunasvg_document_get_width(const lunasvg_document* document); +LUNASVG_API double lunasvg_document_get_height(const lunasvg_document* document); +LUNASVG_API void lunasvg_document_render(const lunasvg_document* document, lunasvg_bitmap* bitmap, + const lunasvg_matrix* matrix); +LUNASVG_API lunasvg_bitmap* lunasvg_document_render_to_bitmap(const lunasvg_document* document, uint32_t width, + uint32_t height, uint32_t background_color); +LUNASVG_API void lunasvg_document_update_layout(lunasvg_document* document); + +#ifdef __cplusplus +} +#endif + +#endif // LUNASVG_H diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index d99c68fb27ef5..ab8c8fbd0907a 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -1282,7 +1282,7 @@ function(setup_main_executable target) # Copy dependency libraries. set(DEPS_BINDIR "${CMAKE_SOURCE_DIR}/deps/bin") - set(DEPS_TO_COPY freetype.dll harfbuzz.dll libjpeg.dll libpng16.dll libsharpyuv.dll libwebp.dll lz4.dll SDL2.dll shaderc_shared.dll zlib1.dll zstd.dll) + set(DEPS_TO_COPY freetype.dll harfbuzz.dll libjpeg.dll libpng16.dll libsharpyuv.dll libwebp.dll lunasvg.dll lz4.dll SDL2.dll shaderc_shared.dll zlib1.dll zstd.dll) foreach(DEP_TO_COPY ${DEPS_TO_COPY}) install(FILES "${DEPS_BINDIR}/${DEP_TO_COPY}" DESTINATION "${CMAKE_SOURCE_DIR}/bin") endforeach()