libsixel support #639

dankamongmen/libsixel
nick black 3 years ago
parent b13544122e
commit ae22e545bd
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -24,6 +24,7 @@ cmake_dependent_option(
"${BUILD_TESTING}" OFF
)
option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
option(USE_LIBSIXEL "Enable libsixel for improved Sixel graphics" OFF)
option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
option(USE_POC "Build small, uninstalled proof-of-concept binaries" ON)
option(USE_QRCODEGEN "Disable libqrcodegen QR code support" ON)
@ -96,6 +97,10 @@ elseif(${USE_OIIO})
pkg_check_modules(OIIO REQUIRED OpenImageIO>=2.1)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND OpenImageIO)
endif()
if(${USE_LIBSIXEL})
pkg_check_modules(LIBSIXEL REQUIRED libsixel>=1.8.6)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND libsixel)
endif()
find_library(MATH_LIBRARIES m)
if(${USE_DOCTEST})
find_package(doctest 2.3.5)
@ -147,8 +152,9 @@ target_include_directories(notcurses-core
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
"${TERMINFO_INCLUDE_DIRS}"
"${LIBSIXEL_INCLUDE_DIRS}"
"${READLINE_INCLUDE_DIRS}"
"${TERMINFO_INCLUDE_DIRS}"
)
target_include_directories(notcurses-core-static
PRIVATE
@ -156,13 +162,15 @@ target_include_directories(notcurses-core-static
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
"${TERMINFO_STATIC_INCLUDE_DIRS}"
"${LIBSIXEL_STATIC_INCLUDE_DIRS}"
"${READLINE_STATIC_INCLUDE_DIRS}"
"${TERMINFO_STATIC_INCLUDE_DIRS}"
)
target_link_libraries(notcurses-core
PRIVATE
"${TERMINFO_LIBRARIES}"
"${LIBSIXEL_LIBRARIES}"
"${READLINE_LIBRARIES}"
"${TERMINFO_LIBRARIES}"
"${LIBRT}"
unistring
PUBLIC
@ -170,8 +178,9 @@ target_link_libraries(notcurses-core
)
target_link_libraries(notcurses-core-static
PRIVATE
"${TERMINFO_STATIC_LIBRARIES}"
"${LIBSIXEL_STATIC_LIBRARIES}"
"${READLINE_STATIC_LIBRARIES}"
"${TERMINFO_STATIC_LIBRARIES}"
"${LIBRT}"
unistring
PUBLIC
@ -179,13 +188,15 @@ target_link_libraries(notcurses-core-static
)
target_link_directories(notcurses-core
PRIVATE
"${TERMINFO_LIBRARY_DIRS}"
"${LIBSIXEL_LIBRARY_DIRS}"
"${READLINE_LIBRARY_DIRS}"
"${TERMINFO_LIBRARY_DIRS}"
)
target_link_directories(notcurses-core-static
PRIVATE
"${TERMINFO_STATIC_LIBRARY_DIRS}"
"${LIBSIXEL_STATIC_LIBRARY_DIRS}"
"${READLINE_STATIC_LIBRARY_DIRS}"
"${TERMINFO_STATIC_LIBRARY_DIRS}"
)
# don't want these on freebsd/dragonfly/osx
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")

@ -111,6 +111,7 @@ may well be possible to use still older versions. Let me know of any successes!
* (OPTIONAL) (build+runtime) From QR-Code-generator: [libqrcodegen](https://github.com/nayuki/QR-Code-generator) 1.5.0+
* (OPTIONAL) (build+runtime) From [FFmpeg](https://www.ffmpeg.org/): libswscale 5.0+, libavformat 57.0+, libavutil 56.0+
* (OPTIONAL) (build+runtime) [OpenImageIO](https://github.com/OpenImageIO/oiio) 2.15.0+
* (OPTIONAL) (build+runtime) [libsixel](https://github.com/saitoha/libsixel) 1.8.6+
* (OPTIONAL) (testing) [Doctest](https://github.com/onqtam/doctest) 2.3.5+
* (OPTIONAL) (documentation) [pandoc](https://pandoc.org/index.html) 1.19.2+
* (OPTIONAL) (python bindings): Python 3.7+, [CFFI](https://pypi.org/project/cffi/) 1.13.2+, [pypandoc](https://pypi.org/project/pypandoc/) 1.5+

@ -1328,9 +1328,10 @@ int sprite_kitty_cell_wipe(const notcurses* nc, sprixel* s, int y, int x);
int sixel_blit(ncplane* nc, int linesize, const void* data,
int leny, int lenx, const blitterargs* bargs);
int kitty_blit(ncplane* nc, int linesize, const void* data,
int leny, int lenx, const blitterargs* bargs);
int libsixel_blit(ncplane* nc, int linesize, const void* data, int begy, int begx,
int leny, int lenx, const blitterargs* bargs);
int term_fg_rgb8(bool RGBflag, const char* setaf, int colors, FILE* out,
unsigned r, unsigned g, unsigned b);

@ -187,7 +187,7 @@ find_color(sixeltable* stab, unsigned char comps[static RGBSIZE]){
}else{
i = l;
}
if(stab->colors == stab->colorregs){
if(stab->colors == stab->colorregs){ // used all our color registers
return -1;
}
if(i < stab->colors){

@ -9,4 +9,5 @@
#if defined(USE_FFMPEG) || defined(USE_OIIO)
#define NOTCURSES_USE_MULTIMEDIA
#endif
#cmakedefine USE_LIBSIXEL
#define NOTCURSES_SHARE "@CMAKE_INSTALL_FULL_DATADIR@/notcurses"

Loading…
Cancel
Save