Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the simple lossless and lossy (non animated) WebP Format for #273 #795

Merged
merged 11 commits into from Sep 2, 2015
Merged
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -10,3 +10,6 @@
[submodule "third_party/duktape"]
path = third_party/duktape
url = https://github.com/aseprite/duktape.git
[submodule "third_party/libwebp"]
path = third_party/libwebp
url = https://chromium.googlesource.com/webm/libwebp
15 changes: 15 additions & 0 deletions CMakeLists.txt
Expand Up @@ -40,6 +40,7 @@ option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off)
option(USE_SHARED_ZLIB "Use your installed copy of zlib" off)
option(USE_SHARED_LIBPNG "Use your installed copy of libpng" off)
option(USE_SHARED_LIBLOADPNG "Use your installed copy of libloadpng" off)
option(USE_SHARED_LIBWEBP "Use your installed copy of libwebp" off)
option(USE_SHARED_TINYXML "Use your installed copy of tinyxml" off)
option(USE_SHARED_PIXMAN "Use your installed copy of pixman" off)
option(USE_SHARED_ALLEGRO4 "Use shared Allegro 4 library (without resize support)" off)
Expand Down Expand Up @@ -106,6 +107,7 @@ set(LIBFREETYPE_DIR ${CMAKE_SOURCE_DIR}/third_party/freetype)
set(LIBJPEG_DIR ${CMAKE_SOURCE_DIR}/third_party/jpeg)
set(LIBPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/libpng)
set(LOADPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/loadpng)
set(LIBWEBP_DIR ${CMAKE_SOURCE_DIR}/third_party/libwebp)
set(MONGOOSE_DIR ${CMAKE_SOURCE_DIR}/third_party/mongoose)
set(PIXMAN_DIR ${CMAKE_SOURCE_DIR}/third_party/pixman)
set(SIMPLEINI_DIR ${CMAKE_SOURCE_DIR}/third_party/simpleini)
Expand Down Expand Up @@ -170,6 +172,19 @@ endif()
include_directories(${PNG_INCLUDE_DIR})
add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code

# libwebp
if(USE_SHARED_LIBWEBP)
find_package(PkgConfig)
pkg_check_modules(WEBP libwebp)
if(NOT WEBP_FOUND)
message(FATAL_ERROR "libwebp not found")
endif()
else()
set(WEBP_LIBRARIES webp)
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
endif()
include_directories(${WEBP_INCLUDE_DIR})

# tinyxml
if(USE_SHARED_TINYXML)
find_library(TINYXML_LIBRARY NAMES tinyxml)
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -77,6 +77,7 @@ of the following projects created by third-parties:
* [giflib](http://sourceforge.net/projects/giflib/) - [giflib license](https://github.com/aseprite/aseprite/tree/master/docs/licenses/giflib-LICENSE.txt)
* [libjpeg](http://www.ijg.org/) - [libjpeg license](https://github.com/aseprite/aseprite/tree/master/docs/licenses/libjpeg-LICENSE.txt)
* [libpng](http://www.libpng.org/pub/png/) - [libpng license](https://github.com/aseprite/aseprite/tree/master/docs/licenses/libpng-LICENSE.txt)
* [libwebp](https://developers.google.com/speed/webp/) - [libwebp license](https://chromium.googlesource.com/webm/libwebp/+/master/COPYING)
* [loadpng](http://tjaden.strangesoft.net/loadpng/) - [zlib license](https://github.com/aseprite/aseprite/tree/master/docs/licenses/ZLIB.txt)
* [mongoose](https://github.com/valenok/mongoose) - [MIT license](https://github.com/valenok/mongoose/blob/master/LICENSE)
* [pixman](http://www.pixman.org/) - [MIT license](http://cgit.freedesktop.org/pixman/plain/COPYING)
Expand Down
48 changes: 48 additions & 0 deletions data/widgets/webp_options.xml
@@ -0,0 +1,48 @@
<!-- ASEPRITE -->
<!-- Copyright (C) 2014, 2015 by David Capello -->

This comment was marked as spam.

<gui>
<window text="WebP Options" id="webp_options">
<vbox>
<label text="Save as:" />
<radio group="1" text="Lossless WebP" id="lossless" tooltip="Save in simple WebP lossless format." />
<hbox>
<label width="55" text="Compression:" />
<slider min="0" max="9" id="compression" cell_align="horizontal" width="128" />
</hbox>
<hbox>
<label width="55" text="Image Hint:" />
<combobox width="128" id="image_hint">
<listitem text="Default" value="0" />
<listitem text="Picture" value="1" />
<listitem text="Photo" value="2" />
<listitem text="Graph" value="3" />
<listitem text="Last" value="4" />
</combobox>
</hbox>
<separator horizontal="true" />
<radio group="1" text="Lossy WebP" id="lossy" tooltip="Save in simple WebP lossy format." />
<hbox>
<label width="55" text="Quality:" />
<slider min="0" max="100" id="quality" cell_align="horizontal" width="128" />
</hbox>
<hbox>
<label width="55" text="Image Preset:" />
<combobox width="128" id="image_preset">
<listitem text="Default" value="0" />
<listitem text="Picture" value="1" />
<listitem text="Photo" value="2" />
<listitem text="Drawing" value="3" />
<listitem text="Icon" value="4" />
<listitem text="Text" value="5" />
</combobox>
</hbox>
<hbox>
<boxfiller />
<hbox homogeneous="true">
<button text="&amp;OK" closewindow="true" id="ok" magnet="true" minwidth="60" />
<button text="&amp;Cancel" closewindow="true" />
</hbox>
</hbox>
</vbox>
</window>
</gui>
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -274,6 +274,7 @@ add_library(app-lib
file/png_format.cpp
file/split_filename.cpp
file/tga_format.cpp
file/webp_format.cpp
file_selector.cpp
file_system.cpp
filename_formatter.cpp
Expand Down Expand Up @@ -412,6 +413,7 @@ target_link_libraries(app-lib
${JPEG_LIBRARIES}
${GIF_LIBRARIES}
${PNG_LIBRARIES}
${WEBP_LIBRARIES}
${ZLIB_LIBRARIES})

if(ENABLE_UPDATER)
Expand Down
2 changes: 2 additions & 0 deletions src/app/file/file_formats_manager.cpp
Expand Up @@ -29,6 +29,7 @@ extern FileFormat* CreateJpegFormat();
extern FileFormat* CreatePcxFormat();
extern FileFormat* CreatePngFormat();
extern FileFormat* CreateTgaFormat();
extern FileFormat* CreateWebPFormat();

static FileFormatsManager* singleton = NULL;

Expand Down Expand Up @@ -67,6 +68,7 @@ void FileFormatsManager::registerAllFormats()
registerFormat(CreatePcxFormat());
registerFormat(CreatePngFormat());
registerFormat(CreateTgaFormat());
registerFormat(CreateWebPFormat());
}

void FileFormatsManager::registerFormat(FileFormat* fileFormat)
Expand Down