summaryrefslogtreecommitdiff
path: root/app-misc/graphlcd-base
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-07-24 20:54:05 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-07-24 20:54:05 +0100
commitfc879856a16ea66528a11a00cf6ee19891f3d186 (patch)
tree01ac0b4134970567587e7176ffc531a404898186 /app-misc/graphlcd-base
parentf73bef95b39f4fbc8f0278c26ad1534e5eec322f (diff)
gentoo auto-resync : 24:07:2022 - 20:54:05
Diffstat (limited to 'app-misc/graphlcd-base')
-rw-r--r--app-misc/graphlcd-base/Manifest5
-rw-r--r--app-misc/graphlcd-base/files/graphlcd-base-2.0.3-imagemagick7.patch338
-rw-r--r--app-misc/graphlcd-base/graphlcd-base-2.0.3-r2.ebuild (renamed from app-misc/graphlcd-base/graphlcd-base-2.0.3-r1.ebuild)17
-rw-r--r--app-misc/graphlcd-base/metadata.xml2
4 files changed, 355 insertions, 7 deletions
diff --git a/app-misc/graphlcd-base/Manifest b/app-misc/graphlcd-base/Manifest
index 0928086a282a..9af411a04c17 100644
--- a/app-misc/graphlcd-base/Manifest
+++ b/app-misc/graphlcd-base/Manifest
@@ -1,3 +1,4 @@
+AUX graphlcd-base-2.0.3-imagemagick7.patch 12164 BLAKE2B 040ecd2d6cf0ff97ab28e5b9e44917d74a5feccc2e92246087eb878eb5d87220cad6d169c8cfce7ebc6ce47fbb306e8a2838cfe34e60300f36b8ae74154c59f5 SHA512 79b69a9a8fb50099cbb0f054920b2eb8fa846dbb679ecfd3ffc27977a07b13ce38c32e7fc3cffae93eb3f345ed2b25da66c3eb564940375ffa949980904aae93
DIST graphlcd-base-2.0.3.tar.bz2 523229 BLAKE2B cfdca5a6a73e8a3858d694aa997037b56471feb20541a328210a106d22c97f57e20f0798411e5a92ca616e5991ec167a8986730b985d0aefcbbb6c6454ab78c2 SHA512 dd0d6a1f1d43405d6ff2e531010f97d47081e3e8e9ccd238adc1084912c99838e80e85b8bd6b37d6462859c3c96229fd83e5ac93fb4068ffe5c30cff3787d138
-EBUILD graphlcd-base-2.0.3-r1.ebuild 2003 BLAKE2B 7762508c4f7c998322c67383a416a3b5353ed787ac4f4c114ea23db4fa7927ddc7284b566831b76650d16713ac4f2406e77da6d8dbb323a91d7dc8542b3d8e88 SHA512 e4d2c29a08844807d94ede63901cbc82f9387044aebe9670a9e1401ec76bb390e920678d5817cf0c6e4898aa8c3adabb6c875ca4c72ec8159b5eeea39908489a
-MISC metadata.xml 836 BLAKE2B a889f89e9846c47befda2d720210f2aa81406dfaa406bb4867b0242e832d796c273eca429be4edad0962e9679cd530ec5edc5e3c85239bf8d9efe4a8e48d0001 SHA512 3bc7f774f35b5ea76e0c9eec3e82b971265ff89824439293018511688aa111149547475cf05c43b237f4809c7016e34945e285ba71fb2dfb806f93e6f495cb33
+EBUILD graphlcd-base-2.0.3-r2.ebuild 2274 BLAKE2B 3cae8d79ed33b1e23fad25dbee225972c6c0b12366937b28e2de0fa5398a12f006e630aaad3aef19bbb46fb6b3b0f57946dece5de58c289950625ac733aa3b07 SHA512 4729f0da0166e39c9a50524bb25e60421cdbbd34200d57bc8546d49f3866872a9edc29d73df91735482ceb4fa2f934740ff76a171372cbd6b605855cb6ecf3fd
+MISC metadata.xml 1010 BLAKE2B edb76fc1024e7dc42a14155d892a126d611cf3157604b1a12590c97e4c3270dfb66f49962b08780c6bc53874f94acb1188cc275221e27b2e83ed3b02c343dbad SHA512 d623de28fc64e351373fbb6005393e6bded18f163ec771d1f6854b87fe022250fb88447c919c6a88379fb23d4fc057a2a752365a7759ce621c5ab8059d471aab
diff --git a/app-misc/graphlcd-base/files/graphlcd-base-2.0.3-imagemagick7.patch b/app-misc/graphlcd-base/files/graphlcd-base-2.0.3-imagemagick7.patch
new file mode 100644
index 000000000000..1c938fadd870
--- /dev/null
+++ b/app-misc/graphlcd-base/files/graphlcd-base-2.0.3-imagemagick7.patch
@@ -0,0 +1,338 @@
+From 5863f4aae667bce9242fe63f1afbd5b16ee23f1e Mon Sep 17 00:00:00 2001
+From: Manuel Reimer <manuel.reimer@gmx.de>
+Date: Sun, 17 Jul 2022 19:19:31 +0200
+Subject: [PATCH] Update ImageMagick library name
+
+ImageMagick++.pc was deleted back in 2012
+https://github.com/ImageMagick/ImageMagick/commit/ae2846b1c8c016382febb54ddea432f1aba57296
+---
+ glcdgraphics/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/glcdgraphics/Makefile b/glcdgraphics/Makefile
+index 9d74477..cfb50de 100644
+--- a/glcdgraphics/Makefile
++++ b/glcdgraphics/Makefile
+@@ -49,8 +49,8 @@ endif
+ # two ifdef/endif are used because older installations may not support 'else ifdef'
+ ifeq ($(IMAGELIB), imagemagick)
+ DEFINES += -DHAVE_IMAGEMAGICK
+- INCLUDES += $(shell pkg-config --cflags ImageMagick++)
+- LIBS += $(shell pkg-config --libs ImageMagick++)
++ INCLUDES += $(shell pkg-config --cflags Magick++)
++ LIBS += $(shell pkg-config --libs Magick++)
+ endif
+ ifeq ($(IMAGELIB), graphicsmagick)
+ DEFINES += -DHAVE_IMAGEMAGICK # yep, really HAVE_IMAGEMAGICK here
+From 93108089cc05ffabc18d81ebc97d39feb7f2c56e Mon Sep 17 00:00:00 2001
+From: Manuel Reimer <manuel.reimer@gmx.de>
+Date: Sun, 24 Jul 2022 19:20:30 +0200
+Subject: [PATCH] Add ImageMagick 7 support. Fixes #3
+
+---
+ glcdgraphics/Makefile | 13 ++-
+ glcdgraphics/extformats.c | 186 ++++++++++++++++++--------------------
+ 2 files changed, 95 insertions(+), 104 deletions(-)
+
+diff --git a/glcdgraphics/Makefile b/glcdgraphics/Makefile
+index cfb50de..92e2847 100644
+--- a/glcdgraphics/Makefile
++++ b/glcdgraphics/Makefile
+@@ -12,6 +12,7 @@ ifdef HAVE_GRAPHICSMAGICK
+ endif
+ ifdef HAVE_IMAGEMAGICK
+ IMAGELIB = imagemagick
++ HAVE_IMAGEMAGICK_7 = $(shell pkg-config --atleast-version=7.0.0 MagickWand && echo true)
+ endif
+
+
+@@ -49,13 +50,17 @@ endif
+ # two ifdef/endif are used because older installations may not support 'else ifdef'
+ ifeq ($(IMAGELIB), imagemagick)
+ DEFINES += -DHAVE_IMAGEMAGICK
+- INCLUDES += $(shell pkg-config --cflags Magick++)
+- LIBS += $(shell pkg-config --libs Magick++)
++ INCLUDES += $(shell pkg-config --cflags MagickWand)
++ LIBS += $(shell pkg-config --libs MagickWand)
++ ifeq ($(HAVE_IMAGEMAGICK_7), true)
++ DEFINES += -DHAVE_IMAGEMAGICK_7
++ endif
+ endif
++
+ ifeq ($(IMAGELIB), graphicsmagick)
+ DEFINES += -DHAVE_IMAGEMAGICK # yep, really HAVE_IMAGEMAGICK here
+- INCLUDES += $(shell pkg-config --cflags GraphicsMagick++)
+- LIBS += $(shell pkg-config --libs GraphicsMagick++)
++ INCLUDES += $(shell pkg-config --cflags GraphicsMagickWand)
++ LIBS += $(shell pkg-config --libs GraphicsMagickWand)
+ endif
+
+
+diff --git a/glcdgraphics/extformats.c b/glcdgraphics/extformats.c
+index 5734fce..90441e6 100644
+--- a/glcdgraphics/extformats.c
++++ b/glcdgraphics/extformats.c
+@@ -21,11 +21,10 @@
+ #include "extformats.h"
+ #include "image.h"
+
+-#ifdef HAVE_IMAGEMAGICK
+-#include <Magick++.h>
+-//#elif defined(HAVE_IMLIB2)
+-//#include "quantize.h"
+-//#include <Imlib2.h>
++#ifdef HAVE_IMAGEMAGICK_7
++ #include <MagickWand/MagickWand.h>
++#elifdef HAVE_IMAGEMAGICK
++ #include <wand/magick_wand.h>
+ #endif
+
+
+@@ -37,9 +36,11 @@ using namespace std;
+
+ cExtFormatFile::cExtFormatFile()
+ {
+-#ifdef HAVE_IMAGEMAGICK
+- Magick::InitializeMagick(NULL);
+-#endif
++#ifdef HAVE_IMAGEMAGICK_7
++ MagickWandGenesis();
++#elifdef HAVE_IMAGEMAGICK
++ InitializeMagick(NULL);
++#endif
+ }
+
+ cExtFormatFile::~cExtFormatFile()
+@@ -56,118 +57,103 @@ bool cExtFormatFile::Load(cImage & image, const string & fileName)
+ bool cExtFormatFile::LoadScaled(cImage & image, const string & fileName, uint16_t & scalew, uint16_t & scaleh)
+ {
+ #ifdef HAVE_IMAGEMAGICK
+- std::vector<Magick::Image> extimages;
+- try {
+- uint16_t width = 0;
+- uint16_t height = 0;
+- //uint16_t count;
+- uint32_t delay;
+-
+- std::vector<Magick::Image>::iterator it;
+- readImages(&extimages, fileName);
+- if (extimages.size() == 0) {
+- syslog(LOG_ERR, "glcdgraphics: Couldn't load '%s' (cExtFormatFile::LoadScaled)", fileName.c_str());
+- return false;
+- }
++ MagickWand* mw = NewMagickWand();
+
+- delay = (uint32_t)(extimages[0].animationDelay() * 10);
++ uint16_t width = 0;
++ uint16_t height = 0;
++ uint32_t delay;
++
++ if (MagickReadImage(mw, fileName.c_str()) == MagickFalse) {
++ syslog(LOG_ERR, "glcdgraphics: Couldn't load '%s' (cExtFormatFile::LoadScaled)", fileName.c_str());
++ return false;
++ }
+
+- image.Clear();
+- image.SetDelay(delay);
++ delay = (uint32_t)(MagickGetImageDelay(mw) * 10);
+
+- bool firstImage = true;
++ image.Clear();
++ image.SetDelay(delay);
+
+- for (it = extimages.begin(); it != extimages.end(); ++it) {
+- bool ignoreImage = false;
++ for (unsigned long imageindex = 0; imageindex < MagickGetNumberImages(mw); imageindex++) {
+
+- //(*it).quantizeColorSpace( Magick::RGBColorspace );
+- //(*it).quantizeColors( 256*256*256 /*colors*/ );
+- //(*it).quantize();
++#ifdef HAVE_IMAGEMAGICK_7
++ MagickSetIteratorIndex(mw, imageindex);
++#else
++ MagickSetImageIndex(mw, imageindex);
++#endif
+
+- if (firstImage) {
+- width = (uint16_t)((*it).columns());
+- height = (uint16_t)((*it).rows());
+- firstImage = false;
++ bool ignoreImage = false;
+
+- // one out of scalew/h == 0 ? -> auto aspect ratio
+- if (scalew && ! scaleh) {
+- scaleh = (uint16_t)( ((uint32_t)scalew * (uint32_t)height) / (uint32_t)width );
+- } else if (!scalew && scaleh) {
+- scalew = (uint16_t)( ((uint32_t)scaleh * (uint32_t)width) / (uint32_t)height );
+- }
++ if (imageindex == 0) { // If first image
++ width = (uint16_t)MagickGetImageWidth(mw);
++ height = (uint16_t)MagickGetImageHeight(mw);
+
+- // scale image
+- if (scalew && ! (scalew == width && scaleh == height)) {
+- (*it).sample(Magick::Geometry(scalew, scaleh));
+- width = scalew;
+- height = scaleh;
+- } else {
+- // not scaled => reset to 0
+- scalew = 0;
+- scaleh = 0;
+- }
++ // one out of scalew/h == 0 ? -> auto aspect ratio
++ if (scalew && ! scaleh) {
++ scaleh = (uint16_t)( ((uint32_t)scalew * (uint32_t)height) / (uint32_t)width );
++ } else if (!scalew && scaleh) {
++ scalew = (uint16_t)( ((uint32_t)scaleh * (uint32_t)width) / (uint32_t)height );
++ }
+
+- image.SetWidth(width);
+- image.SetHeight(height);
++ // scale image
++ if (scalew && ! (scalew == width && scaleh == height)) {
++ MagickSampleImage(mw, scalew, scaleh);
++ width = scalew;
++ height = scaleh;
+ } else {
+- if (scalew && scaleh) {
+- (*it).sample(Magick::Geometry(scalew, scaleh));
+- } else
+- if ( (width != (uint16_t)((*it).columns())) || (height != (uint16_t)((*it).rows())) ) {
+- ignoreImage = true;
+- }
++ // not scaled => reset to 0
++ scalew = 0;
++ scaleh = 0;
+ }
+
+- if (! ignoreImage) {
+- /*
+- if ((*it).depth() > 8) {
+- esyslog("ERROR: text2skin: More than 8bpp images are not supported");
+- return false;
+- }
+- */
+- uint32_t * bmpdata = new uint32_t[height * width];
+- //Dprintf("this image has %d colors\n", (*it).totalColors());
++ image.SetWidth(width);
++ image.SetHeight(height);
++ } else {
++ if (scalew && scaleh) {
++ MagickSampleImage(mw, scalew, scaleh);
++ } else
++ if ( (width != (uint16_t)MagickGetImageWidth(mw)) || (height != (uint16_t)MagickGetImageHeight(mw)) ) {
++ ignoreImage = true;
++ }
++ }
+
+- bool isMatte = (*it).matte();
+- //bool isMonochrome = ((*it).totalColors() <= 2) ? true : false;
+- const Magick::PixelPacket *pix = (*it).getConstPixels(0, 0, (int)width, (int)height);
++ if (! ignoreImage) {
++ uint32_t * bmpdata = new uint32_t[height * width];
++
++#ifdef HAVE_IMAGEMAGICK_7
++ unsigned int status = MagickExportImagePixels(mw, 0, 0, width, height, "BGRA", CharPixel, (unsigned char*)bmpdata);
++#else
++ unsigned int status = MagickGetImagePixels(mw, 0, 0, width, height, "BGRA", CharPixel, (unsigned char*)bmpdata);
++#endif
++
++ if (status == MagickFalse) {
++ syslog(LOG_ERR, "glcdgraphics: Couldn't load '%s' (cExtFormatFile::LoadScaled): MagickGetImagePixels", fileName.c_str());
++ return false;
++ }
+
++#ifdef HAVE_IMAGEMAGICK_7
++ bool isMatte = (MagickGetImageAlphaChannel(mw) == MagickTrue);
++#else
++ bool isMatte = (MagickGetImageMatte(mw) == MagickTrue);
++#endif
++
++ // Give all transparent pixels our defined transparent color
++ if (isMatte) {
+ for (int iy = 0; iy < (int)height; ++iy) {
+ for (int ix = 0; ix < (int)width; ++ix) {
+- if ( isMatte && Magick::Color::scaleQuantumToDouble(pix->opacity) * 255 == 255 ) {
+- bmpdata[iy*width+ix] = cColor::Transparent;
+- } else {
+- bmpdata[iy*width+ix] = (uint32_t)(
+- (uint32_t(255 - (Magick::Color::scaleQuantumToDouble(pix->opacity) * 255)) << 24) |
+- (uint32_t( Magick::Color::scaleQuantumToDouble(pix->red) * 255) << 16) |
+- (uint32_t( Magick::Color::scaleQuantumToDouble(pix->green) * 255) << 8) |
+- uint32_t( Magick::Color::scaleQuantumToDouble(pix->blue) * 255)
+- );
+- //if ( isMonochrome ) { // if is monochrome: exchange black and white
+- // uint32_t c = bmpdata[iy*width+ix];
+- // switch(c) {
+- // case cColor::White: c = cColor::Black; break;
+- // case cColor::Black: c = cColor::White; break;
+- // }
+- // bmpdata[iy*width+ix] = c;
+- //}
+- }
+- ++pix;
++ uint32_t* pixel = &bmpdata[ix+iy*width];
++ uint8_t alpha = *pixel >> 24;
++ if (alpha == 0)
++ *pixel = cColor::Transparent;
+ }
+ }
+- cBitmap * b = new cBitmap(width, height, bmpdata);
+- //b->SetMonochrome(isMonochrome);
+- image.AddBitmap(b);
+- delete[] bmpdata;
+- bmpdata = NULL;
+ }
++
++ cBitmap * b = new cBitmap(width, height, bmpdata);
++ //b->SetMonochrome(isMonochrome);
++ image.AddBitmap(b);
++ delete[] bmpdata;
++ bmpdata = NULL;
+ }
+- } catch (Magick::Exception &e) {
+- syslog(LOG_ERR, "glcdgraphics: Couldn't load '%s': %s (cExtFormatFile::LoadScaled)", fileName.c_str(), e.what());
+- return false;
+- } catch (...) {
+- syslog(LOG_ERR, "glcdgraphics: Couldn't load '%s': Unknown exception caught (cExtFormatFile::LoadScaled)", fileName.c_str());
+- return false;
+ }
+ return true;
+ #else
+From ad6496557a817a57cb29f2247ffaeaaa71168c72 Mon Sep 17 00:00:00 2001
+From: Manuel Reimer <manuel.reimer@gmx.de>
+Date: Sun, 24 Jul 2022 19:39:59 +0200
+Subject: [PATCH] Add cleanup for MagickWand
+
+---
+ glcdgraphics/extformats.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/glcdgraphics/extformats.c b/glcdgraphics/extformats.c
+index 90441e6..79d14da 100644
+--- a/glcdgraphics/extformats.c
++++ b/glcdgraphics/extformats.c
+@@ -65,6 +65,7 @@ bool cExtFormatFile::LoadScaled(cImage & image, const string & fileName, uint16_
+
+ if (MagickReadImage(mw, fileName.c_str()) == MagickFalse) {
+ syslog(LOG_ERR, "glcdgraphics: Couldn't load '%s' (cExtFormatFile::LoadScaled)", fileName.c_str());
++ DestroyMagickWand(mw);
+ return false;
+ }
+
+@@ -127,6 +128,7 @@ bool cExtFormatFile::LoadScaled(cImage & image, const string & fileName, uint16_
+
+ if (status == MagickFalse) {
+ syslog(LOG_ERR, "glcdgraphics: Couldn't load '%s' (cExtFormatFile::LoadScaled): MagickGetImagePixels", fileName.c_str());
++ DestroyMagickWand(mw);
+ return false;
+ }
+
+@@ -155,6 +157,7 @@ bool cExtFormatFile::LoadScaled(cImage & image, const string & fileName, uint16_
+ bmpdata = NULL;
+ }
+ }
++ DestroyMagickWand(mw);
+ return true;
+ #else
+ return false;
diff --git a/app-misc/graphlcd-base/graphlcd-base-2.0.3-r1.ebuild b/app-misc/graphlcd-base/graphlcd-base-2.0.3-r2.ebuild
index be25edf67fd8..60c8a72d6d96 100644
--- a/app-misc/graphlcd-base/graphlcd-base-2.0.3-r1.ebuild
+++ b/app-misc/graphlcd-base/graphlcd-base-2.0.3-r2.ebuild
@@ -12,14 +12,16 @@ SRC_URI="https://projects.vdr-developer.org/git/${PN}.git/snapshot/${P}.tar.bz2"
KEYWORDS="amd64 x86"
SLOT="0"
LICENSE="GPL-2"
-IUSE="fontconfig freetype lcd_devices_ax206dpf lcd_devices_picolcd_256x64 lcd_devices_vnc"
+IUSE="fontconfig freetype graphicsmagick imagemagick lcd_devices_ax206dpf lcd_devices_picolcd_256x64 lcd_devices_vnc"
+REQUIRED_USE="?? ( graphicsmagick imagemagick )"
RDEPEND="
dev-libs/libhid
- media-gfx/graphicsmagick:0/1.3[cxx]
net-libs/libvncserver
freetype? ( media-libs/freetype:2= )
fontconfig? ( media-libs/fontconfig:1.0= )
+ graphicsmagick? ( media-gfx/graphicsmagick:0/1.3[cxx] )
+ imagemagick? ( media-gfx/imagemagick:= )
lcd_devices_ax206dpf? ( virtual/libusb:0 )
lcd_devices_picolcd_256x64? ( virtual/libusb:0 )
"
@@ -30,6 +32,8 @@ BDEPEND="virtual/pkgconfig"
DOCS=( "HISTORY" "README" "TODO" "docs/." )
+PATCHES=( "${FILESDIR}/${PN}-2.0.3-imagemagick7.patch" )
+
src_prepare() {
default
@@ -44,9 +48,6 @@ src_prepare() {
}
src_configure() {
- # Use always GraphicsMagick
- sed -e "69s:#::" -i Make.config || die
-
# Build optional drivers
if use lcd_devices_ax206dpf; then
sed -e "78s:#::" -i Make.config || die
@@ -65,6 +66,12 @@ src_configure() {
if ! use fontconfig; then
sed -e "62s:HAVE:#HAVE:" -i Make.config || die
fi
+ if use graphicsmagick; then
+ sed -e "69s:#::" -i Make.config || die
+ fi
+ if use imagemagick; then
+ sed -e "68s:#::" -i Make.config || die
+ fi
}
src_install() {
diff --git a/app-misc/graphlcd-base/metadata.xml b/app-misc/graphlcd-base/metadata.xml
index 6d4dd80259e1..9d640b6cfa37 100644
--- a/app-misc/graphlcd-base/metadata.xml
+++ b/app-misc/graphlcd-base/metadata.xml
@@ -20,5 +20,7 @@
<use>
<flag name="fontconfig">Add support for <pkg>media-libs/fontconfig</pkg> font names.</flag>
<flag name="freetype">Add support for <pkg>media-libs/freetype</pkg>.</flag>
+ <flag name="graphicsmagick">Add support for <pkg>media-gfx/graphicsmagick</pkg>.</flag>
+ <flag name="imagemagick">Add support for <pkg>media-gfx/imagemagick</pkg>.</flag>
</use>
</pkgmetadata>