summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorzatherz2016-03-19 22:11:45 +0100
committerzatherz2016-03-19 22:11:45 +0100
commit834a1add4478a6fd14cc2d7475c1cd9353de6d68 (patch)
tree061ba6031c9a134d975010a5f77a2a2da1dcaca2
downloadaur-834a1add4478a6fd14cc2d7475c1cd9353de6d68.tar.gz
Initial commit
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD53
-rwxr-xr-xhqx.sh52
-rwxr-xr-xxbr.sh52
4 files changed, 179 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..8ba1806ae8e5
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = pixelscale-git
+ pkgdesc = Standalone xBR/HQx pixel art scaling library and standalone executable
+ pkgver = 4.3835e97
+ pkgrel = 1
+ url = https://github.com/Treeki/libxbr-standalone
+ arch = x86_64
+ arch = i686
+ license = LGPL2.1
+ depends = libpng
+ depends = imagemagick
+ provides = hqx
+ provides = xbr
+ conflicts = hqx
+ source = hqx.sh
+ source = xbr.sh
+ source = git://github.com/Treeki/libxbr-standalone.git
+ md5sums = 6c9338b1399d1732f149d9e48e85554e
+ md5sums = 0feb03f6f73e34af84eed887a9619ecd
+ md5sums = SKIP
+
+pkgname = pixelscale-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..9e772e16e5b5
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,53 @@
+# Maintainer: gandalf3 <zzyxpaw at gmail dot com>
+
+pkgname=pixelscale-git
+_pkgname=libxbr-standalone
+pkgver=4.3835e97
+pkgrel=1
+pkgdesc="Standalone xBR/HQx pixel art scaling library and standalone executable"
+url="https://github.com/Treeki/libxbr-standalone"
+arch=('x86_64' 'i686')
+license=('LGPL2.1')
+depends=('libpng' 'imagemagick' )
+makedepends=()
+conflicts=('hqx')
+provides=('hqx' 'xbr')
+source=('hqx.sh' 'xbr.sh' 'git://github.com/Treeki/libxbr-standalone.git')
+md5sums=('6c9338b1399d1732f149d9e48e85554e'
+ '0feb03f6f73e34af84eed887a9619ecd'
+ 'SKIP')
+
+build() {
+ cd "${srcdir}/$_pkgname"
+ msg2 "Compiling HQ2x library"
+ cc -Wall -Wno-parentheses -fpic -c hq2x.c -o hq2x.o
+ cc -Wall -Wno-parentheses -shared hq2x.o -o libhq2x.so
+ msg2 "Compiling HQ3x library"
+ cc -Wall -Wno-parentheses -fpic -c hq3x.c -o hq3x.o
+ cc -Wall -Wno-parentheses -shared hq3x.o -o libhq3x.so
+ msg2 "Compiling HQ4x library"
+ cc -Wall -Wno-parentheses -fpic -c hq4x.c -o hq4x.o
+ cc -Wall -Wno-parentheses -shared hq4x.o -o libhq4x.so
+ msg2 "Compiling xBR library"
+ cc -Wall -Wno-parentheses -fpic -c xbr.c -o xbr.o
+ cc -Wall -Wno-parentheses -shared xbr.o -o libxbr.so
+ msg2 "Compiling binary"
+ cc -Wall -Wno-parentheses -L. -lhq2x -lhq3x -lhq4x -lxbr -lpng test_app.c -o pixelscale
+}
+
+pkgver () {
+ cd "${srcdir}/$_pkgname"
+ echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
+}
+
+package() {
+ cd "${srcdir}/$_pkgname"
+
+ install -D -m755 "../../hqx.sh" "${pkgdir}/usr/bin/hqx"
+ install -D -m755 "../../xbr.sh" "${pkgdir}/usr/bin/xbr"
+ install -D -m755 "libhq2x.so" "${pkgdir}/usr/lib/libhq2x.so"
+ install -D -m755 "libhq3x.so" "${pkgdir}/usr/lib/libhq3x.so"
+ install -D -m755 "libhq4x.so" "${pkgdir}/usr/lib/libhq4x.so"
+ install -D -m755 "libxbr.so" "${pkgdir}/usr/lib/libxbr.so"
+ install -D -m755 "pixelscale" "${pkgdir}/usr/bin/pixelscale"
+}
diff --git a/hqx.sh b/hqx.sh
new file mode 100755
index 000000000000..1427befb2e7d
--- /dev/null
+++ b/hqx.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+usage() {
+ echo "Usage: hqx [-s scaleBy] input output"
+ exit 1
+}
+
+scale=4
+
+while getopts ":s:" option; do
+ case $option in
+ s)
+ if [ "$scale" -ne 2 ] && [ "$scale" -ne 3 ] && [ "$scale" -ne 4 ]; then
+ echo "Only scale factors of 2, 3 and 4 are supported"
+ fi
+ scale="$OPTARG"
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ ;;
+ :)
+ echo "hqx: option requires an argument -- '$OPTARG'"
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+inputfile="$1"
+outputfile="$2"
+
+if [ -z "$inputfile" ] || [ -z "$outputfile" ]; then
+ usage
+fi
+
+filetype="$(identify -format "%m" "$inputfile" 2>&1)"
+input_exists="$?"
+
+if ! [ -s "$inputfile" ] || [ $input_exists -ne 0 ]; then
+ echo "ERROR: can't load '$inputfile'"
+ exit 1
+fi
+
+if ! [ "$filetype" = "PNG" ]; then
+ convert "$inputfile" "._temp_png.png"
+ inputfile="._temp_png.png"
+fi
+
+pixelscale "$inputfile" "$outputfile" "hq${scale}x"
+
+if [ -e "._temp_png.png" ]; then
+ rm "._temp_png.png"
+fi
diff --git a/xbr.sh b/xbr.sh
new file mode 100755
index 000000000000..6a4045874401
--- /dev/null
+++ b/xbr.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+usage() {
+ echo "Usage: xbr [-s scaleBy] input output"
+ exit 1
+}
+
+scale=4
+
+while getopts ":s:" option; do
+ case $option in
+ s)
+ if [ "$scale" -ne 2 ] && [ "$scale" -ne 3 ] && [ "$scale" -ne 4 ]; then
+ echo "Only scale factors of 2, 3 and 4 are supported"
+ fi
+ scale="$OPTARG"
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ ;;
+ :)
+ echo "xbr: option requires an argument -- '$OPTARG'"
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+inputfile="$1"
+outputfile="$2"
+
+if [ -z "$inputfile" ] || [ -z "$outputfile" ]; then
+ usage
+fi
+
+filetype="$(identify -format "%m" "$inputfile" 2>&1)"
+input_exists="$?"
+
+if ! [ -s "$inputfile" ] || [ $input_exists -ne 0 ]; then
+ echo "ERROR: can't load '$inputfile'"
+ exit 1
+fi
+
+if ! [ "$filetype" = "PNG" ]; then
+ convert "$inputfile" "._temp_png.png"
+ inputfile="._temp_png.png"
+fi
+
+pixelscale "$inputfile" "$outputfile" "xbr${scale}x"
+
+if [ -e "._temp_png.png" ]; then
+ rm "._temp_png.png"
+fi