Upgraded alpine images
This commit is contained in:
@@ -17,23 +17,33 @@ target_link_libraries(lmsimage PUBLIC
|
||||
std::filesystem
|
||||
)
|
||||
|
||||
if (IMAGE_LIBRARY STREQUAL STB)
|
||||
set(LMS_IMAGE_BACKEND "stb" CACHE STRING "Image library")
|
||||
set_property(CACHE LMS_IMAGE_BACKEND PROPERTY STRINGS "stb" "graphicsmagick")
|
||||
|
||||
if (${LMS_IMAGE_BACKEND} STREQUAL "stb")
|
||||
find_package(StbImage REQUIRED)
|
||||
message(STATUS "Using stb (resize version ${STB_IMAGE_RESIZE_VERSION})")
|
||||
|
||||
target_sources(lmsimage PRIVATE
|
||||
impl/stb/JPEGImage.cpp
|
||||
impl/stb/RawImage.cpp
|
||||
)
|
||||
target_compile_options(lmsimage PRIVATE "-DLMS_SUPPORT_IMAGE_STB")
|
||||
target_include_directories(lmsimage PRIVATE ${STB_INCLUDE_DIR})
|
||||
elseif (IMAGE_LIBRARY STREQUAL GraphicsMagick++)
|
||||
)
|
||||
target_compile_options(lmsimage PRIVATE "-DSTB_IMAGE_RESIZE_VERSION=${STB_IMAGE_RESIZE_VERSION}")
|
||||
target_include_directories(lmsimage PRIVATE ${STB_IMAGE_INCLUDE_DIR})
|
||||
|
||||
elseif (${LMS_IMAGE_BACKEND} STREQUAL "graphicsmagick")
|
||||
pkg_check_modules(GraphicsMagick++ REQUIRED IMPORTED_TARGET GraphicsMagick++)
|
||||
message(STATUS "Using graphicsmagick")
|
||||
|
||||
target_sources(lmsimage PRIVATE
|
||||
impl/graphicsmagick/JPEGImage.cpp
|
||||
impl/graphicsmagick/RawImage.cpp
|
||||
)
|
||||
target_compile_options(lmsimage PRIVATE "-DLMS_SUPPORT_IMAGE_GM")
|
||||
)
|
||||
target_link_libraries(lmsimage PRIVATE PkgConfig::GraphicsMagick++)
|
||||
|
||||
else ()
|
||||
message(FATAL_ERROR "Invalid IMAGE_LIBRARY provided")
|
||||
endif()
|
||||
message(FATAL_ERROR "Invalid image library")
|
||||
endif ()
|
||||
|
||||
install(TARGETS lmsimage DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef LMS_SUPPORT_IMAGE_GM
|
||||
#error "Bad configuration"
|
||||
#endif
|
||||
|
||||
#include <Magick++.h>
|
||||
|
||||
#include "image/IEncodedImage.hpp"
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef LMS_SUPPORT_IMAGE_GM
|
||||
#error "Bad configuration"
|
||||
#endif
|
||||
|
||||
#include <Magick++.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -28,7 +28,13 @@
|
||||
#define STBI_FAILURE_USERMSG
|
||||
|
||||
#include <stb_image.h>
|
||||
#if STB_IMAGE_RESIZE_VERSION == 1
|
||||
#include <stb_image_resize.h>
|
||||
#elif STB_IMAGE_RESIZE_VERSION == 2
|
||||
#include <stb_image_resize2.h>
|
||||
#else
|
||||
#error "Unhandled STB image resize version"!
|
||||
#endif
|
||||
|
||||
#include "core/ITraceLogger.hpp"
|
||||
#include "image/Exception.hpp"
|
||||
@@ -94,9 +100,17 @@ namespace lms::image::STB
|
||||
if (!resizedData)
|
||||
throw Exception{ "Cannot allocate memory for resized image!" };
|
||||
|
||||
#if STB_IMAGE_RESIZE_VERSION == 1
|
||||
if (::stbir_resize_uint8_srgb(reinterpret_cast<const unsigned char*>(_data.get()), _width, _height, 0,
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
3, STBIR_ALPHA_CHANNEL_NONE, 0) == 0)
|
||||
#elif STB_IMAGE_RESIZE_VERSION == 2
|
||||
if (::stbir_resize_uint8_srgb(reinterpret_cast<const unsigned char*>(_data.get()), _width, _height, 0,
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
STBIR_RGB) == 0)
|
||||
#else
|
||||
#error "Unhandled STB image resize version"!
|
||||
#endif
|
||||
{
|
||||
throw Exception{ "Failed to resize image:" + std::string{ ::stbi_failure_reason() } };
|
||||
}
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef LMS_SUPPORT_IMAGE_STB
|
||||
#error "Bad configuration"
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user