class new in Git master
WebPImporterWebP importer plugin.
Imports WebP (*.webp
) RGB and RGBA images using the libwebp library. You can use WebPImageConverter to encode images into this format.
Usage
This plugin depends on the Trade and libwebp libraries and is built if MAGNUM_WITH_WEBPIMPORTER
is enabled when building Magnum Plugins. To use as a dynamic plugin, load "WebPImporter"
via Corrade::
Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins and libwebp repositories and do the following. If you want to use system-installed libwebp, omit the first part and point CMAKE_PREFIX_PATH
to its installation dir if necessary.
# Build libwebp as static to have the plugin self-contained set(WEBP_LINK_STATIC ON CACHE BOOL "" FORCE) # Disable unneeded functionality set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_CWEBP OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_DWEBP OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_GIF2WEBP OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_IMG2WEBP OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_VWEBP OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_WEBPINFO OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_LIBWEBPMUX OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_WEBPMUX OFF CACHE BOOL "" FORCE) set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "" FORCE) add_subdirectory(libwebp EXCLUDE_FROM_ALL) set(MAGNUM_WITH_WEBPIMPORTER ON CACHE BOOL "" FORCE) add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL) # So the dynamically loaded plugin gets built implicitly add_dependencies(your-app MagnumPlugins::WebPImporter)
To use as a static plugin or as a dependency of another plugin with CMake, request the WebPImporter
component of the MagnumPlugins
package and link to the MagnumPlugins::WebPImporter
target:
find_package(MagnumPlugins REQUIRED WebPImporter) # ... target_link_libraries(your-app PRIVATE MagnumPlugins::WebPImporter)
See Downloading and building plugins, Plugin usage with CMake, Loading and using plugins and File format support for more information.
Behavior and limitations
WebP only supports 24-bit RGB color with an optional 8-bit alpha channel, which is imported as either PixelFormat::
The importer doesn't support decoding of animated WebP files.
Base classes
- class AbstractImporter
- Base for importer plugins.
Constructors, destructors, conversion operators
-
WebPImporter(PluginManager::
AbstractManager& manager, const Containers:: StringView& plugin) explicit - Plugin manager constructor.