11 changes: 11 additions & 0 deletions STANDALONE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ suggested to include one of the `%b` or `%f` placeholders in the specified filen
- `%b` is the input file basename, that is the filename with no extension and no path.
- `%f` is the input file filename (without path).

If, on the other hand, multiple layers are expected as output, the `%l` placeholder will be replaced by the layer number in each output file (0 is top layer).

#### Examples

Expand All @@ -25,6 +26,8 @@ suggested to include one of the `%b` or `%f` placeholders in the specified filen
$ ./gmic_qt --output output.png input.png
# Select a filter and its parameters twice (i.e. once for each input), save each output to a distinct file.
$ ./gmic_qt --output processed-%f input1.png input2.png
# Save the expected output layers in layer_0.png, layer_1.png, ...
$ ./gmic_qt -o /tmp/layer_%l.png -p "Layers/Tiles to Layers" gmicky.png
```

### Option `-q --quality N`
Expand Down Expand Up @@ -137,3 +140,11 @@ OutputMode: 0
### Option `--show-last-after`

Print last applied plugin parameters after filter execution. (Indeed, some filters may change the value of their parameters.)

### Option `--layers`

Consider multiple input files as layers of the same image (first image is the top layer).

```sh
$ ./gmic_qt -p "Blend [Average All]" --layers --apply -o output.png toplayer.png middlelayer.png bottomlayer.png
```
92 changes: 77 additions & 15 deletions check_versions.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,85 @@
#!/bin/bash
#
# Usage: check_version.sh GMIC_PATH [gmic|CImg|stdlib]
#
if [ $# != 2 ]; then
echo
set -o errexit
function usage()
{
echo " Usage:"
echo
echo " check_version.sh GMIC_PATH [gmic|CImg|stdlib]"
echo
exit 0
}

function die()
{
local message="$1"
>&2 echo "Error: $*"
exit 1
}

(( $# == 0 )) && usage
[[ -d "$1" ]] || die "$1 is not an existing directory"

# @param folder
function gmic_version()
{
local folder="$1"
[[ -e "${folder}/gmic.h" ]] || die "File not found: ${folder}/gmic.h"
local version=$(grep -F "#define gmic_version " ${folder}/gmic.h)
echo ${version//* }
}

# @param folder
function cimg_version()
{
local folder="$1"
[[ -e "${folder}/CImg.h" ]] || die "File not found: ${folder}/CImg.h"
local version=$(grep -F "#define cimg_version " ${folder}/CImg.h)
echo ${version//* }
}

# @param folder
function stdlib_version()
{
local folder="$1"
[[ -e "${folder}/gmic_stdlib_community.h" ]] || die "File not found: ${folder}/gmic_stdlib_community.h"
local version=$(grep -E "File.*gmic_stdlib_community.h.*\(v." ${folder}/gmic_stdlib_community.h)
version=${version#*v.}
version=${version%)}
version=${version//.}
echo ${version}
}

if [[ "$2" == gmic ]]; then
gmic_version "$1"
exit 0
fi

if [[ "$2" == CImg ]]; then
cimg_version "$1"
exit 0
fi
if [ "$2" = gmic ]; then
grep "define gmic_version " $1/gmic.h | cut -d' ' -f3

if [[ "$2" == stdlib ]]; then
stdlib_version "$1"
exit 0
fi
if [ "$2" = CImg ]; then
grep "define cimg_version " $1/CImg.h | cut -d' ' -f3

echo "Checking G'MIC and CImg versions..."

GMIC_VERSION=$(gmic_version "$1")
CIMG_VERSION=$(cimg_version "$1")
STDLIB_VERSION=$(stdlib_version "$1")

echo "G'MIC version is .................... $GMIC_VERSION"
echo "gmic_stdlib_community.h version is .. $STDLIB_VERSION"
echo "CImg version is ..................... $CIMG_VERSION"

if [[ $GMIC_VERSION != $CIMG_VERSION ]]; then
die "Version numbers of files 'gmic.h' (${GMIC_VERSION}) and 'CImg.h' (${CIMG_VERSION}) mismatch"
fi
if [ "$2" = stdlib ]; then
VERSION=$(grep "File.*gmic_stdlib_community.h.*(v." $1/gmic_stdlib_community.h)
VERSION=${VERSION#*v.}
VERSION=${VERSION%)}
VERSION=${VERSION//.}
echo "$VERSION"

if [[ $GMIC_VERSION != $STDLIB_VERSION ]]; then
die "Version numbers of files 'gmic.h' (${GMIC_VERSION}) and 'gmic_stdlib_community.h' (${STDLIB_VERSION}) mismatch"
fi

exit 0
49 changes: 26 additions & 23 deletions gmic/html/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,35 @@
<!-- </p> -->
<ul>
<li><span class="gmd_bold_a">.exe installer:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_gimp2.10_win64.exe">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_gimp2.10_win64.exe">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_gimp2.10_win64.exe">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">.zip archive:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_gimp2.10_win64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_gimp2.10_win64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_gimp2.10_win64.zip">latest dev</a></span>)
</li>
</ul>
</li>
<li><span class="arch">Linux:</span> .zip archives available for
<ul>
<li><span class="gmd_bold_a">Ubuntu 22.04 <i>Jammy</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_gimp2.10_ubuntu22-04_jammy_amd64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_gimp2.10_ubuntu22-04_jammy_amd64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_gimp2.10_ubuntu22-04_jammy_amd64.zip">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">Ubuntu 21.10 <i>Impish</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_gimp2.10_ubuntu21-10_impish_amd64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_gimp2.10_ubuntu21-10_impish_amd64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_gimp2.10_ubuntu21-10_impish_amd64.zip">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">Ubuntu 20.04 <i>Focal</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_gimp2.10_ubuntu20-04_focal_amd64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_gimp2.10_ubuntu20-04_focal_amd64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_gimp2.10_ubuntu20-04_focal_amd64.zip">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">Debian 11 <i>Bullseye</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_gimp2.10_debian11_bullseye_amd64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_gimp2.10_debian11_bullseye_amd64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_gimp2.10_debian11_bullseye_amd64.zip">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">Debian 10 <i>Buster</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_gimp2.10_debian10_buster_amd64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_gimp2.10_debian10_buster_amd64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_gimp2.10_debian10_buster_amd64.zip">latest dev</a></span>)
</li>
</ul>
Expand Down Expand Up @@ -186,6 +186,9 @@
<ul>
<li><span class="arch">Windows:</span>
<ul>
<li><span class="gmd_bold_a">G'MIC-Qt plug-in on Adobe Exchange:</span>
<a target="_blank" href="https://exchange.adobe.com/apps/cc/109191/gmic">stable</a>
</li>
<li><span class="gmd_bold_a">.zip archive:</span>
<a target="_blank" href="https://github.com/0xC0000054/gmic-8bf/releases">stable</a>
</li>
Expand Down Expand Up @@ -242,22 +245,22 @@
<li><span class="arch">G&apos;MIC-Qt stand-alone interface:</span>
<ul>
<li><span class="gmd_bold_a">.zip archive:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_qt_win64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_qt_win64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_qt_win64.zip">latest dev</a></span>)
</li>
</ul>
</li>
<li><span class="arch">Command-line interface (CLI):</span>
<ul>
<li><span class="gmd_bold_a">.zip archive:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_cli_win64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_cli_win64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_cli_win64.zip">latest dev</a></span>)
</li>
</ul>
<li><span class="arch">C/C++ library:</span>
<ul>
<li><span class="gmd_bold_a">.zip archive:</span>
<a target="_blank" href="https://gmic.eu/files/windows/gmic_3.1.5_lib_win64.zip">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://gmic.eu/files/windows/gmic_3.2.1_lib_win64.zip">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_lib_win64.zip">latest dev</a></span>)
</li>
</ul>
Expand All @@ -275,11 +278,11 @@
<tr><td colspan="2">
<ul>
<li><span class="gmd_bold_a">Debian 11 <i>Bullseye</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_debian11_bullseye_amd64.deb">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_debian11_bullseye_amd64.deb">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_debian11_bullseye_amd64.deb">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">Debian 10 <i>Buster</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_debian10_buster_amd64.deb">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_debian10_buster_amd64.deb">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_debian10_buster_amd64.deb">latest dev</a></span>)
</li>
</ul>
Expand All @@ -296,15 +299,15 @@
<tr><td colspan="2">
<ul>
<li><span class="gmd_bold_a">Ubuntu 22.04 <i>Jammy</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_ubuntu22-04_jammy_amd64.deb">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_ubuntu22-04_jammy_amd64.deb">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_ubuntu22-04_jammy_amd64.deb">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">Ubuntu 21.10 <i>Impish</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_ubuntu21-10_impish_amd64.deb">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_ubuntu21-10_impish_amd64.deb">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_ubuntu21-10_hirsute_amd64.deb">latest dev</a></span>)
</li>
<li><span class="gmd_bold_a">Ubuntu 20.04 <i>Focal</i>:</span>
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.1.5_ubuntu20-04_focal_amd64.deb">stable</a> &nbsp;&nbsp;(or
<a target="_blank" href="https://www.fosshub.com/GMIC.html?dwl=gmic_3.2.1_ubuntu20-04_focal_amd64.deb">stable</a> &nbsp;&nbsp;(or
<span class="latestdev"><a href="https://gmic.eu/files/prerelease/gmic_ubuntu20-04_focal_amd64.deb">latest dev</a></span>)
</li>
</ul>
Expand All @@ -320,11 +323,11 @@
</tr>
<tr><td colspan="2">
<ul>
<li><span class="gmd_bold_a">Latest stable:</span> <a href="https://gmic.eu/files/source/gmic_3.1.5.tar.gz">tar.gz archive</a></li>
<li><span class="gmd_bold_a">Latest stable:</span> <a href="https://gmic.eu/files/source/gmic_3.2.1.tar.gz">tar.gz archive</a></li>
<li><span class="gmd_bold_a">Latest development snapshot:</span> <a href="https://gmic.eu/files/prerelease/gmic_prerelease.tar.gz">.tar.gz archive</a></li>
<li><span class="gmd_bold_a">G&apos;MIC-core:</span> <a target="_blank" href="https://github.com/dtschump/gmic">git repository</a></li>
<li><span class="gmd_bold_a">G&apos;MIC-core:</span> <a target="_blank" href="https://github.com/GreycLab/gmic">git repository</a></li>
<li><span class="gmd_bold_a">G&apos;MIC-Qt:</span> <a target="_blank" href="https://github.com/c-koi/gmic-qt">git repository</a></li>
<li><span class="gmd_bold_a">G&apos;MIC-community:</span> <a target="_blank" href="https://github.com/dtschump/gmic-community">git repository</a></li>
<li><span class="gmd_bold_a">G&apos;MIC-community:</span> <a target="_blank" href="https://github.com/GreycLab/gmic-community">git repository</a></li>
</ul>
</td></tr>
</table>
Expand Down Expand Up @@ -396,8 +399,8 @@
Then, get the G&apos;MIC source from the different repositories:
</p>
<div class="gmd_code_block"><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/dtschump/CImg">https://github.com/dtschump/CImg.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/dtschump/gmic">https://github.com/dtschump/gmic.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/GreycLab/CImg">https://github.com/GreycLab/CImg.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/GreycLab/gmic">https://github.com/GreycLab/gmic.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/c-koi/gmic-qt">https://github.com/c-koi/gmic-qt.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/c-koi/zart">https://github.com/c-koi/zart.git</a></div>
<p>
Expand Down Expand Up @@ -431,7 +434,7 @@
<div class="gmd_code_block">make OPENMP_CFLAGS="" OPENMP_LIBS=""</div>
<p>
Also, please remember that the source code in the <i>git</i> repository
is constantly under development and may be a bit unstable, so do not hesitate to <a target="_blank" href="https://github.com/dtschump/gmic/issues">report bugs</a> if you encounter any.
is constantly under development and may be a bit unstable, so do not hesitate to <a target="_blank" href="https://github.com/GreycLab/gmic/issues">report bugs</a> if you encounter any.
</p>

</div><div class="section_end"></div>
Expand Down Expand Up @@ -465,8 +468,8 @@
<li>Close terminal, and relaunch it. Now all required tools to compile are avalaible from the terminal.</li>
<li>Retrieve source code of G&apos;MIC interfaces:
<div class="gmd_code_block">
$ git clone --depth=1 <a target="_blank" href="https://github.com/dtschump/CImg">https://github.com/dtschump/CImg.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/dtschump/gmic">https://github.com/dtschump/gmic.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/GreycLab/CImg">https://github.com/GreycLab/CImg.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/GreycLab/gmic">https://github.com/GreycLab/gmic.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/c-koi/gmic-qt">https://github.com/c-koi/gmic-qt.git</a><br/>
$ git clone --depth=1 <a target="_blank" href="https://github.com/c-koi/gmic-qt">https://github.com/c-koi/zart.git</a></div>
</li>
Expand Down
15 changes: 9 additions & 6 deletions gmic/html/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<area shape="rect" coords="0,0,98,30" alt="GREYC" href="https://www.greyc.fr/en/home/">
<area shape="rect" coords="104,0,147,43" alt="CNRS" href="https://www.cnrs.fr/index.php">
<area shape="rect" coords="13,32,59,76" alt="ENSICAEN" href="https://www.ensicaen.fr">
<area shape="rect" coords="76,47,139,71" alt="UNICAEN" href="https://www.unicaen.fr/home-578581.kjsp?RH=1291198060074&RF=UNIV-EN">
<area shape="rect" coords="76,47,139,71" alt="UNICAEN" href="http://welcome.unicaen.fr">
</map>
<h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<hr/>
Expand All @@ -38,8 +38,11 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<li><a href='index.html'><span>
<img alt="Home" src='img/menu_home.png' />&nbsp;&nbsp;
Home</span></a></li>
<li><a href='https://twitter.com/gmic_eu' target='_blank'><span>
<img alt="News" src='img/menu_news.png ' />&nbsp;&nbsp;
<!-- <li><a href='https://twitter.com/gmic_eu' target='_blank'><span> -->
<!-- <img alt="News" src='img/menu_news.png ' />&nbsp;&nbsp; -->
<!-- Twitter News</span></a></li> -->
<li><a rel="me" target='_blank' href="https://piaille.fr/@gmic"><span>
<img alt="News" src='img/menu_mastodon.png ' />&nbsp;&nbsp;
News</span></a></li>
<li><a href='download.html'><span>
<img alt="Download" src='img/menu_download.png' />&nbsp;&nbsp;
Expand All @@ -57,7 +60,7 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<li><a href='https://www.youtube.com/playlist?list=PLxhZWW4XG2XEJqfGmGWiG7EfttWtpQvyu' target='_blank'><span>
<img alt="Video Tutorial" src='img/menu_video.png' />&nbsp;&nbsp;
Video Tutorials</span></a></li>
<li><a href='https://github.com/dtschump/gmic-community/wiki' target='_blank'><span>
<li><a href='https://github.com/GreycLab/gmic-community/wiki' target='_blank'><span>
<img alt="Wiki" src='img/menu_wiki.png' />&nbsp;&nbsp;
Wiki Pages</span></a></li>
<li><a href='gallery/'><span>
Expand Down Expand Up @@ -95,7 +98,7 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
IRC</span></a></li>
</ul>
</li>
<li><a href='https://github.com/dtschump/gmic/issues' target='_blank'><span>
<li><a href='https://github.com/GreycLab/gmic/issues' target='_blank'><span>
<img alt="Report Issue" src='img/menu_report.png' />&nbsp;&nbsp;
Report Issue</span></a></li>
<li><a href='https://libreart.info/en/projects/gmic' target='_blank'><span>
Expand All @@ -112,7 +115,7 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<hr/>

<h2>
Latest stable version: <b><a href="https://gmic.eu/download.html">3.1.5</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="https://gmic.eu/files/prerelease">3.1.6</a></b>
Latest stable version: <b><a href="https://gmic.eu/download.html">3.2.1</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="https://gmic.eu/files/prerelease">3.2.2</a></b>
</h2>

</div>
Expand Down
15 changes: 9 additions & 6 deletions gmic/html/header1.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<area shape="rect" coords="0,0,98,30" alt="GREYC" href="https://www.greyc.fr/en/home/">
<area shape="rect" coords="104,0,147,43" alt="CNRS" href="https://www.cnrs.fr/index.php">
<area shape="rect" coords="13,32,59,76" alt="ENSICAEN" href="https://www.ensicaen.fr">
<area shape="rect" coords="76,47,139,71" alt="UNICAEN" href="https://www.unicaen.fr/home-578581.kjsp?RH=1291198060074&RF=UNIV-EN">
<area shape="rect" coords="76,47,139,71" alt="UNICAEN" href="http://welcome.unicaen.fr">
</map>
<h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<hr/>
Expand All @@ -39,8 +39,11 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<li><a href='../index.html'><span>
<img src='../img/menu_home.png' />&nbsp;&nbsp;
Home</span></a></li>
<li><a href='https://twitter.com/gmic_eu' target='_blank'><span>
<img src='../img/menu_news.png ' />&nbsp;&nbsp;
<!-- <li><a href='https://twitter.com/gmic_eu' target='_blank'><span> -->
<!-- <img src='../img/menu_news.png ' />&nbsp;&nbsp; -->
<!-- News</span></a></li> -->
<li><a rel="me" target='_blank' href="https://piaille.fr/@gmic"><span>
<img alt="News" src='../img/menu_mastodon.png ' />&nbsp;&nbsp;
News</span></a></li>
<li><a href='../download.html'><span>
<img src='../img/menu_download.png' />&nbsp;&nbsp;
Expand All @@ -58,7 +61,7 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<li><a href='https://www.youtube.com/playlist?list=PLxhZWW4XG2XEJqfGmGWiG7EfttWtpQvyu' target='_blank'><span>
<img src='../img/menu_video.png' />&nbsp;&nbsp;
Video Tutorials</span></a></li>
<li><a href='https://github.com/dtschump/gmic-community/wiki' target='_blank'><span>
<li><a href='https://github.com/GreycLab/gmic-community/wiki' target='_blank'><span>
<img src='../img/menu_wiki.png' />&nbsp;&nbsp;
Wiki Pages</span></a></li>
<li><a href='../gallery/'><span>
Expand Down Expand Up @@ -96,7 +99,7 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
IRC</span></a></li>
</ul>
</li>
<li><a href='https://github.com/dtschump/gmic/issues' target='_blank'><span>
<li><a href='https://github.com/GreycLab/gmic/issues' target='_blank'><span>
<img src='../img/menu_report.png' />&nbsp;&nbsp;
Report Issue</span></a></li>
<li><a href='https://libreart.info/en/projects/gmic' target='_blank'><span>
Expand All @@ -113,7 +116,7 @@ <h1>A Full-Featured Open-Source Framework for Image Processing</h1>
<hr/>

<h2>
Latest stable version: <b><a href="https://gmic.eu/download.html">3.1.5</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="https://gmic.eu/files/prerelease">3.1.6</a></b>
Latest stable version: <b><a href="https://gmic.eu/download.html">3.2.1</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="https://gmic.eu/files/prerelease">3.2.2</a></b>
</h2>

</div>
Expand Down
Binary file modified gmic/html/img/donations_latest_months.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
468 changes: 468 additions & 0 deletions gmic/html/img/logo_header.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gmic/html/img/menu_mastodon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions gmic/html/libgmic.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1>Step 1: Get the required library files</h1>
To be able to use <b>libgmic</b> in your own code, you need:
<ul>
<li>
The header file <samp><a href="https://github.com/dtschump/gmic/blob/master/src/gmic.h">gmic.h</a></samp>
The header file <samp><a href="https://github.com/GreycLab/gmic/blob/master/src/gmic.h">gmic.h</a></samp>
which contains the declarations of the classes and methods allowing to use the <b>libgmic</b> library.
This file needs to be included by your source code.
</li>
Expand Down Expand Up @@ -323,7 +323,7 @@ <h1>Step 4: Additional information about the <i>libgmic</i> <i>API</i></h1>

<p>
In the G&apos;MIC source, you will a sample file
<samp><a href="https://github.com/dtschump/gmic/blob/master/src/use_libgmic.cpp">use_libgmic.cpp</a></samp> which contains all
<samp><a href="https://github.com/GreycLab/gmic/blob/master/src/use_libgmic.cpp">use_libgmic.cpp</a></samp> which contains all
the stuffs we&apos;ve summarized in this page. Check it out and compile it to have another example on how the <b>libgmic</b> can do for you.
</p>

Expand Down
12 changes: 9 additions & 3 deletions gmic/resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ if(BUILD_LIB)
target_compile_options(libgmic PRIVATE ${GMIC_CXX_COMPILE_FLAGS} -Dgmic_core)
set_target_properties(libgmic PROPERTIES SOVERSION "1" OUTPUT_NAME "gmic")
target_link_libraries(libgmic
CImg::CImg
GMicStdlib::Stdlib
PRIVATE
CImg::CImg
GMicStdlib::Stdlib
)
target_include_directories(libgmic
PUBLIC
Expand Down Expand Up @@ -194,7 +195,12 @@ if(BUILD_CLI)
add_executable(gmic src/gmic_cli.cpp)
target_compile_options(gmic PRIVATE ${GMIC_CXX_COMPILE_FLAGS})
if(ENABLE_DYNAMIC_LINKING)
target_link_libraries(gmic libgmic)
target_link_libraries(gmic
PUBLIC
libgmic
PRIVATE
CImg::CImg
)
else()
target_link_libraries(gmic libgmicstatic)
endif()
Expand Down
2 changes: 1 addition & 1 deletion gmic/resources/cmake/FindCImg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if(USE_SYSTEM_CIMG)
REQUIRED
)
else()
set(HEADER_URL "https://github.com/dtschump/CImg/raw/master/CImg.h")
set(HEADER_URL "https://github.com/GreycLab/CImg/raw/master/CImg.h")
set(HEADER_DIR ${PROJECT_SOURCE_DIR}/src)
set(HEADER_PATH ${HEADER_DIR}/${HEADER_NAME})

Expand Down
29 changes: 12 additions & 17 deletions gmic/resources/gmic_buildpackage
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ fi

# Build package from a virtual Debian/Ubuntu machine.
#-----------------------------------------------------
#HOSTNAME=`hostname`
DIST=`lsb_release -d | tail -c+13 | xargs`
BITS=`uname -m`

Expand All @@ -178,7 +177,7 @@ if [ "$IS_210" == "1" ]; then GIMPVER=2.10
else GIMPVER=2.8
fi

if [ "$HOSTNAME" != "elara" ] ; then
if [ "$HOSTNAME" != "C302L-G17P17.png.unicaen.fr" ] && [ "$HOSTNAME" != "C302L-G14F15.png.unicaen.fr" ]; then
SF_HOME=/media/sf_dtschump/
cd ${SF_HOME}/work/src
RELEASE0=`grep "#define gmic_version" gmic/src/gmic.h | tail -c5`
Expand Down Expand Up @@ -238,9 +237,7 @@ fi
#-----------------------------------------
cd ${HOME}/work/src
rm -rf gmic-qt zart
#git clone https://github.com/dtschump/gmic-qt
git clone https://github.com/c-koi/gmic-qt.git
#git clone https://github.com/c-koi/zart.git
RELEASE0=`grep "#define gmic_version" gmic/src/gmic.h | tail -c5`
RELEASE1=`echo $RELEASE0 | head -c1`
RELEASE2=`echo $RELEASE0 | head -c2 | tail -c1`
Expand Down Expand Up @@ -313,11 +310,10 @@ if [ "$1" == "final" ]; then
git push --tags
COMMIT=$(git -C $HOME/work/src/gmic-qt log -1 | head -1 | cut -d' ' -f 2) # Get the SHA1 of the latest commit
wget -O /dev/null --timeout=10 "${GMIC_FOUREY_URL}?version=v.${SVERSION}&commit=${COMMIT}"
else
gmic _update_header_html ../html/header.html,${VERSION},1
gmic _update_header_html ../html/header1.html,${VERSION},1
gmic_commit "Auto-commit for release "${SVERSION}${SUFFIX}
fi
gmic _update_header_html ../html/header.html,${VERSION},1
gmic _update_header_html ../html/header1.html,${VERSION},1
gmic_commit "Auto-commit for release "${SVERSION}${SUFFIX}

# Create man page and bash autocompletion script.
#-------------------------------------------------
Expand All @@ -330,11 +326,12 @@ cd ..
#-----------------
echo " - Upload G'MIC web page."
cd html
lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "mirror -RL . /www/gmic/ ; quit"
rm -rf gallery color_presets reference tutorial
lftp sftp://$GMIC_LOGIN:@ovh -e "mirror -RL . /home/"$GMIC_LOGIN"/www/gmic/ ; quit"
rm -f gmic_stdlib.gmic gmic_stdlib.$VERSION
cd ..
cd resources/samples
lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "mirror -RL . /www/gmic/samples/ ; quit"
lftp sftp://$GMIC_LOGIN:@ovh -e "mirror -RL . /home/"$GMIC_LOGIN"/www/gmic/samples/ ; quit"
cd ../..

# Construct a clean version of the G'MIC folder.
Expand Down Expand Up @@ -437,12 +434,12 @@ gzip ${TARFILE}
cp -f ${TARFILE}.gz ${HOME}/work/src/

if [ "$1" == "final" ]; then
lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "put -O /www/gmic/files/source/ ${HOME}/work/src/${TARFILE}.gz; quit";
lftp sftp://$GMIC_LOGIN:@ovh -e "put -O /home/"$GMIC_LOGIN"/www/gmic/files/source/ ${HOME}/work/src/${TARFILE}.gz; quit";
fi

lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "mrm /www/gmic/files/prerelease/*.tar.gz; quit"
lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "put -O /www/gmic/files/prerelease ${HOME}/work/src/${TARFILE}.gz -o gmic_prerelease.tar.gz; quit"
lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "put -O /www/gmic/files/prerelease ${HOME}/work/src/${TARFILE}.gz -o gmic_${SVERSION}${LSUFFIX}.tar.gz; quit"
lftp sftp://$GMIC_LOGIN:@ovh -e "mrm /home/"$GMIC_LOGIN"/www/gmic/files/prerelease/*.tar.gz; quit"
lftp sftp://$GMIC_LOGIN:@ovh -e "put -O /home/"$GMIC_LOGIN"/www/gmic/files/prerelease ${HOME}/work/src/${TARFILE}.gz -o gmic_prerelease.tar.gz; quit"
lftp sftp://$GMIC_LOGIN:@ovh -e "put -O /home/"$GMIC_LOGIN"/www/gmic/files/prerelease ${HOME}/work/src/${TARFILE}.gz -o gmic_${SVERSION}${LSUFFIX}.tar.gz; quit"

# Create debian packages for debian/ubuntu 64 bits.
#--------------------------------------------------
Expand Down Expand Up @@ -477,9 +474,7 @@ echo ELARA_DONE
echo " - Waiting for all packages.".

cd ${HOME}/work/src/
if [ "$1" != "final" ]; then
gmic upload_binaries ${SVERSION}${SUFFIX}
fi
gmic upload_binaries ${SVERSION}${SUFFIX}

#
# End of file.
Expand Down
Binary file modified gmic/resources/gmic_cluts.gmz
Binary file not shown.
Binary file modified gmic/resources/gmic_denoise_cnn.gmz
Binary file not shown.
7 changes: 4 additions & 3 deletions gmic/resources/gmic_ftp
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ pwd={`"
# Upload file or directory.
if "s = ['$1']; "$is_pwd" && (s==0 || s=='.')" # Synchronize current directory
e[] "Synchronize current directory '"${pwd}"' with 'SERVER"${pwd}"'.\n"
com="lftp ftp://"$GMIC_LOGIN":"$GMIC_PASSWD"@"$GMIC_FTP" -e \"mirror -RL . /www/gmic"${pwd}" ; quit\""
com="lftp sftp://"$GMIC_LOGIN":@ovh -e \"mirror -RL . /home/"$GMIC_LOGIN"/www/gmic"${pwd}" ; quit\""
x $com

elif $is_pwd" && isdir(['"$1"'])" # Synchronize specified directory
e[] "Synchronize directory '$1' with 'SERVER"${pwd}"$1'.\n"
com="lftp ftp://"$GMIC_LOGIN":"$GMIC_PASSWD"@"$GMIC_FTP" -e \"mirror -RL \\\"$1\\\" \\\"/www/gmic"${pwd}"$1\\\" ; quit\""
com="lftp sftp://"$GMIC_LOGIN":@ovh -e \"mirror -RL \\\"$1\\\" \\\"/home/"$GMIC_LOGIN"/www/gmic"${pwd}"$1\\\" ; quit\""
x $com

elif isfile(['"$1"']) # Upload single file
if !$is_pwd pwd="/" fi
e[] "Upload file '$1' to 'SERVER"${pwd}"'.\n"
com="lftp ftp://"$GMIC_LOGIN":"$GMIC_PASSWD"@"$GMIC_FTP" -e \"put -O \\\"/www/gmic"${pwd}"\\\" \\\"$1\\\"; quit\""
com="lftp sftp://"$GMIC_LOGIN":@ovh -e \"put -O \\\"/home/"$GMIC_LOGIN"/www/gmic"${pwd}"\\\" \\\"$1\\\"; quit\""
x $com

fi
rm

# Local Variables:
# mode: sh
Expand Down
6 changes: 3 additions & 3 deletions gmic/resources/gmic_upload_filters
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ export GMIC_PASSWD=`gmic v - +e[] \$\{\"gmic_ftp 1\"\}`
export GMIC_FTP=ftp.cluster011.hosting.ovh.net

echo "START : "`date` >> /tmp/log_gmic_upload_filters
gmic $HOME/work/src/gmic/src/gmic_stdlib.gmic upload_filters
gmic $HOME/work/src/gmic/src/gmic_stdlib.gmic $HOME/work/src/private_tschumperle/gmic_resources.gmic upload_filters
if [ ! -f /tmp/gui_filters.old ]; then
cp -f /tmp/gui_filters.txt /tmp/gui_filters.old;
fi

lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "put -O /www/gmic/ /tmp/gui_filters.txt; quit"
lftp sftp://$GMIC_LOGIN:@$GMIC_FTP -e "put -O /home/"$GMIC_LOGIN"/www/gmic/ /tmp/gui_filters.txt; quit"

git diff /tmp/gui_filters.old /tmp/gui_filters.txt | grep ^+ > /tmp/gui_filters.diff
diff=`cat /tmp/gui_filters.diff | wc -l`
if [ $diff -gt 2 ]; then
lftp ftp://$GMIC_LOGIN:$GMIC_PASSWD@$GMIC_FTP -e "put -O /www/gmic/ /tmp/gui_filters.diff; quit"
lftp sftp://$GMIC_LOGIN:@$GMIC_FTP -e "put -O /home/"$GMIC_LOGIN"/www/gmic/ /tmp/gui_filters.diff; quit"
wget -O /tmp/sendmail.php http://gmic.eu/sendmail.php >/dev/null
fi
cp -f /tmp/gui_filters.txt /tmp/gui_filters.old
Expand Down
40 changes: 20 additions & 20 deletions gmic/resources/samples/bbq_intro2016.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ bbq_intro2 :
rx={u(-1,1)} ry={u(-1,1)} rz={u(-1,1)} rt={u(-1,1)} rcx={u(-0.6*0.6)} t=0
N={120+round(u(80))} R={(2+round(u(10)))*min({*,w},{*,h})/300}
if $obj3d rm[colormap,img,obj3d] fi
{10+round(u(12))},1,1,3 noise[0] 255,2 r[0] 256,1,1,3,3 -*[0] 255 shift[0] 1 nm. colormap
{10+round(u(12))},1,1,3 noise[0] 255,2 r[0] 256,1,1,3,3 -*[0] 255 shift[0] 1 => colormap
(67.5;73.5;109.5;103.5;51.5;100.5;{2*$N};$N) 3,{2*$N},1,1,0
1,$N,1,1,5 2,$N,1,1,'y+x*$N' a[-2--1] x -z. 0,5
4,$N,1,1,1 y[-3--1] a[-4--1] y nm. obj3d
{{*,w}/2},{{*,h}/2} nm. img
4,$N,1,1,1 y[-3--1] a[-4--1] y => obj3d
{{*,w}/2},{{*,h}/2} => img
fi

# Compute bobs coordinates.
Expand Down Expand Up @@ -271,25 +271,25 @@ bbq_intro3 :
W=150 H=350

# Generate global map + colors.
900,900 plasma. 1,1,6 b. 0.07% n. 0,255 nm. map
900,900 plasma. 1,1,6 b. 0.07% n. 0,255 => map
+g. -*. 0.5 -+[-2,-1] n. 0,1 -^. 2 n. -150,330
equalize[map] 256 n[map] -400,160 c[map] 0,100% # Add water.
(0,102,51;149,175,124;102,42,0;255,255,255) permute. yzcx srgb2rgb. r. 256,1,1,3,3 rgb2srgb. +n[map] 0,255 map. .. rm..
-+. .. rm.. c. 0,255 nm. colors # Colors.
-+. .. rm.. c. 0,255 => colors # Colors.

# Pre-compute some images used on each frame.
$W,$H,1,1,'x' y. x nm. x # Increasing x.
$W,$H,1,1,'1+x+y*w' y. x nm. offsets # Offsets (+1).
$W,$H,1,1,'0.5*y' nm. gmap Mgmap={iM} # Z-increment for altitude map.
$W,$H,1,3 fc. 60,80,135 nm. ccolors # Color for the horizon.
$W,$H,1,1,'(y/$H)^2' nm. mcolors # Mask for the horizon.
$W,$H,1,1,'x' y. x => x # Increasing x.
$W,$H,1,1,'1+x+y*w' y. x => offsets # Offsets (+1).
$W,$H,1,1,'0.5*y' => gmap Mgmap={iM} # Z-increment for altitude map.
$W,$H,1,3 fc. 60,80,135 => ccolors # Color for the horizon.
$W,$H,1,1,'(y/$H)^2' => mcolors # Mask for the horizon.
$W,400,1,1,'b=h-1-$Mgmap;if(y>=b,256+(y-b)*255/(h-1-b),y*255/b)' round. # Background.
(96^16^128) (0^200^255) a[-2,-1] x r. 256,1,1,3,3
(0^32^0) (0^64^128) a[-2,-1] x r. 256,1,1,3,3
a[-2,-1] x map.. . rm.
nm. background
quadrangle3d[] -0.45,0,0,0.45,0,0,0.55,1,0,-0.55,1,0 -*3d. {$W/2},{$H/2} nm. viewrange3d # View range.
(64^16^0) r. $W nm. groundcolor # Ground color.
=> background
quadrangle3d[] -0.45,0,0,0.45,0,0,0.55,1,0,-0.55,1,0 -*3d. {$W/2},{$H/2} => viewrange3d # View range.
(64^16^0) r. $W => groundcolor # Ground color.

_t=0
do
Expand All @@ -305,22 +305,22 @@ bbq_intro3 :
+r3d[viewrange3d] 0,0,1,{-$a} y. x
({$xm+i[8]},{$xm+i[11]};{$xm+i[17]},{$xm+i[14]}^{$ym+i[9]},{$ym+i[12]};{$ym+i[18]},{$ym+i[15]}) rm..
r. $W,$H,1,2,3 +warp[map,colors] .,0,1,0 rm...
nm.. lmap nm. lcolors
=> lmap,lcolors

# Add color shading and altitude to local maps.
+!=[lmap] 0 nm. ground
+!=[lmap] 0 => ground
-+[lmap] [gmap]
j[lcolors] [ccolors],0,0,0,0,1,[mcolors]
j[lcolors] [groundcolor]
+round[lmap] f. '>m=abs(j(0,-1));if(i>m,i,-m)' nm. y0 # Compute visible top points.
+shift. 0,1 abs. -+. 1 nm. y1 # Compute visible bottom points.
+round[lmap] f. '>m=abs(j(0,-1));if(i>m,i,-m)' => y0 # Compute visible top points.
+shift. 0,1 abs. -+. 1 => y1 # Compute visible bottom points.
-*[y0,y1] [ground] rm[ground]
r[lcolors,y0,y1] {$W*$H},1,1,100%,-1

# Keep only visible primitives.
+>[y0] 0 -*. [offsets] discard. 0 y.
if h # There is something to display (ground).
-. 1 +warp[x] .,0,0,0 nm. lx
-. 1 +warp[x] .,0,0,0 => lx
warp[lcolors,y0,y1] ..,0,0,0 rm..

# Generate 3d object.
Expand Down Expand Up @@ -632,8 +632,8 @@ bbq_intro_final :

# Create 3d objects.
torus3d 30,10 col3d. 255,200,0
spherical3d 47,34,"80+20*abs(cos(2*theta))" s3d. rm.. i.. 3,{h},1,1,150,220,255,200,255,255 y.. a[-6--1] y
spherical3d 47,34,"100*abs(1+0.6*cos(3*phi)*sin(4*theta))"
spherical3d "80+20*abs(cos(2*theta))",47,34 s3d. rm.. i.. 3,{h},1,1,150,220,255,200,255,255 y.. a[-6--1] y
spherical3d "100*abs(1+0.6*cos(3*phi)*sin(4*theta))",47,34
r3d[-2,-1] 0,1,0,-90 db3d 0

# Generate scrolling data.
Expand Down
6 changes: 3 additions & 3 deletions gmic/resources/samples/distortion.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# Author : David Tschumperle

# Entry point when run from CLI:
go nm Distortion e[] "" animate 50
go =>[^] Distortion e[] "" animate 50

# Main function
go :
v 0
nbf=50
sample cat
repeat $nbf
repeat $nbf {
e[] "\r > Frame "{$>+1}/$nbf
+f[0] "const boundary = 3;
const interpolation = 1;
j( w/16*cos(2*pi*"$>/$nbf" + 0.5*sin(y/50)),
h/16*sin(2*pi*"$>/$nbf" + 0.5*cos(x/30)))"
done
}
remove[0]

# End of file.
6 changes: 3 additions & 3 deletions gmic/resources/samples/french_flag.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go nm "French Flag" e[] "" animate 30
go =>[^] "French Flag" e[] "" animate 30

# Main function
go :
v 0

# Render animation frames.
nbf=200
repeat $nbf f=$>
repeat $nbf { f=$>
e[] "\r > Frame "{$f+1}/$nbf
300,300,1,3,"*
const f = $f;
Expand All @@ -22,4 +22,4 @@ go :
(0.4+exp(-Z/60))*(P[0]<-96?[0,0,255]:P[0]<96?[255,255,255]:[255,0,0])*
lerp(0.5,1,xor(P[0]%64,P[1]%64)/64)"
c. 0,255
done
}
9 changes: 5 additions & 4 deletions gmic/resources/samples/heart.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go nm Heart e[] "" animate 60
go =>[^] Heart e[] "" animate 60

# Main function
go :
chromeball64x64 255,20,0 resize2dx[-1] 48
chromeball64x64 255,20,0 resize2dx. 48
split c,-3
600,500,1,3,"(y*[0,20,100]+(h-y)*[200,100,200])/h" .x9
eval "
S = crop(#0);
A = crop(#1);
for (t = -pi; f = 0, t<3*pi, t+=0.02,
draw(#2+f,S,[268-15*[16*(sin(t)^3),13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)+5],0,0],48,48,1,3,1,A,255);
P = 268-15*[16*(sin(t)^3),13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)+5];
draw(#2+f,S,P[0],P[1],48,48,1,A,255);
f = (f+1)%10;
)"
remove[0,1]

# End of file.
# End of file.
29 changes: 14 additions & 15 deletions gmic/resources/samples/hello_world.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,34 @@ go :
(a = y/h/0.75; [32*a,96*a,165*a] ):
(a = (y - 0.75*h)/0.25/h; [255*a,128*a,0] )" # Specify formula to create color gradient
text. "Try mouse buttons... Keys ESC or Q to quit",5,{h-18},13,1,255 # Add small notice at the bottom
nm. background
=> background

# Create text sprites (normal and mirrored versions).
0 text. " Hello\nWorld !",0,0,54,1,128,255,64,1 nm. text_color # RGBA text sprite
0 text. " Hello\nWorld !",0,0,54,1,128,255,64,1 => text_color # RGBA text sprite
split. c,-3 dilate. 5 name. text_mask # Divide into two images : RGB (text_color) and dilated A (text_mask)
+mirror. y name. text_mask_shadow # Get mirrored version of the text mask for the shadow
100%,100%,1,3 nm. text_color_shadow # RGB sprite for shadow sprite (with default color: black)
100%,100%,1,3 => text_color_shadow # RGB sprite for shadow sprite (with default color: black)

# Initialize motion variables.
x={(w#$background-w)/2} # Position 'x' is initially at the middle of the background
y={(h#$background-h)/2} # Position 'y' is initially at the middle of the background
vy=0 vx=0 # Define x and y velocities
ax=0 ay=0 # Define x and y accelerations
x:=(w#$background-w)/2 # Position 'x' is initially at the middle of the background
y:=(h#$background-h)/2 # Position 'y' is initially at the middle of the background
vx,vy,ax,ay=0 # Define x and y velocities and accelerations

# Start animation loop.
do
+image[background] [text_color],$x,$y,0,0,1,[text_mask] # Draw text in background and returns it as a new image
y_shadow={1.5*h-$y-h#$text_color_shadow} # Compute the location for drawing the shadow
y_shadow:=1.5*h-$y-h#$text_color_shadow # Compute the location for drawing the shadow
image. [text_color_shadow],$x,$y_shadow,0,0,0.3,[text_mask_shadow] # Draw shadow of the text sprite as well
window. -1,-1,0,"Hello World Demo" # Update window content with created frame
remove. # Remove the animation frame

# Manage sprite motion and collisions.
x+=$vx vx+=$ax # Compute new x-position and x-velocity
y+=$vy vy+={0.5+$ay} # Compute new y-position and y-velocity (add 0.5 for the gravity!)
y+=$vy vy+=0.5+$ay # Compute new y-position and y-velocity (add 0.5 for the gravity!)

if $x<=0" || "$x+w#$text_color>=w#$background # Detect collision with left and right borders
x={max(0,min($x,w#$background-w#$text_color))} # Constrain the x-coordinates to stay inside image
vx={-$vx} # Revert the x-velocity
x:=max(0,min($x,w#$background-w#$text_color)) # Constrain the x-coordinates to stay inside image
vx:=-$vx # Revert the x-velocity
fi
if $y+h#$text_color>0.75*h#$background # Detect collision with the ground
vy=-12 # Set new y-velocity (for bouncing)
Expand All @@ -91,15 +90,15 @@ go :

# Manage mouse events
if {*,b}&1 # Left mouse button -> Set new random accelerations
vx=0 vy=0
ax={u(-5,5)} ay={u(-5,5)}
vx,vy=0
ax:=u(-5,5) ay:=u(-5,5)
fi
if {*,-b}&2 # Right mouse button -> Change sprite color
repeat {text_color,s}
repeat {text_color,s} {
shared[text_color] $> # Color is changed by random normalizations of all color channels independently
normalize. 0,{u(64,255)}
remove.
done
}
fi

wait[0] 20 # Wait a little bit to slow down animation (20ms)
Expand Down
30 changes: 15 additions & 15 deletions gmic/resources/samples/landscape.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go nm Landscape e[] "" animate 60
go =>[^] Landscape e[] "" animate 60

# Main function
go :
v 0
srand 512

# Generate elevation map [0] and texture [1]
input 512,480 plasma[-1] 1,1,5 resize[-1] 100%,400%,1,1,0,2 blur[-1] 3 cut[-1] 40%,inf normalize[-1] 0,255
input (0,102,51;149,175,124;102,42,0;255,255,255) permute[-1] yzcx srgb2rgb[-1] resize[-1] 256,1,1,3,3 rgb2srgb[-1]
point[-1] 0,0,0,1,64,100,200 +map[-2] [-1] rm[-2] normalize[0] 0,40
input 512,480 plasma. 1,1,5 resize. 100%,400%,1,1,0,2 blur. 3 cut. 40%,inf normalize. 0,255
input (0,102,51;149,175,124;102,42,0;255,255,255) permute. yzcx srgb2rgb. resize. 256,1,1,3,3 rgb2srgb.
point. 0,0,0,1,64,100,200 +map.. . rm.. normalize[0] 0,40

# Generate background image [2].
input 1,4,1,3,"y==0?[50,0,100]:y==1?[219,140,15]:y==2?[140,18,15]:[100,0,0]" resize[-1] 400,300,1,3,3
input 1,4,1,3,"y==0?[50,0,100]:y==1?[219,140,15]:y==2?[140,18,15]:[100,0,0]" resize. 400,300,1,3,3

# Generate frames
nbf=50
repeat $nbf f=$>
repeat $nbf { f=$>
e[] "\r > Frame "{$f+1}/$nbf
y={h#0/4*(1+$f/$nbf)}
ang={6*sin(2*pi*$f/$nbf)}
y:=h#0/4*(1+$f/$nbf)
ang:=6*sin(2*pi*$f/$nbf)
+rows[0,1] $y,{$y+h#0/3-1} w,h={[w,h]}
rotate[-2,-1] $ang,1,0,50%,50%

+fill[-2] 'y/h' cut[-1] 5%,50% normalize[-1] 0,1
input 100%,100%,1,3,'[219,140,15]/3' image[-3] [-1],0,0,0,0,1,[-2] remove[-2,-1]
+fill.. 'y/h' cut. 5%,50% normalize. 0,1
input 100%,100%,1,3,'[219,140,15]/3' image... .,0,0,0,0,1,.. remove[-2,-1]

elevation3d[-1] [-2] remove[-2] reverse3d[-1]
-3d[-1] {$w/2},0,0 r3d[-1] 1,0,0,90 +3d[-1] 0,50,0 *3d[-1] {-2,4*w/$w}
+object3d[2] [-1],50%,35%,-250,1,5,0,1,300,0,-1000,-2200,0.3,0.5 remove[-2]
done
elevation3d. .. remove.. reverse3d.
-3d. {$w/2},0,0 r3d. 1,0,0,90 +3d. 0,50,0 *3d. {-2,4*w/$w}
+object3d[2] .,50%,35%,-250,1,5,0,1,300,0,-1000,-2200,0.3,0.5 remove..
}
remove[0-2]

# Quantize all frames in 256 colors with the same colormap, to avoid .gif flickering.
+colormap[50%] 256 index[^-1] [-1],0,1 remove[-1]
+colormap[50%] 256 index[^-1] .,0,1 remove.

# End of file.
6 changes: 3 additions & 3 deletions gmic/resources/samples/lissajous.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go nm Lissajous e[] "" animate 60
go =>[^] Lissajous e[] "" animate 60

# Main function
go :
v 0
300,1,1,3,u(255) tsp , # Generate random smooth colormap
repeat 60
repeat 60 {
e[] "\r > Frame "{$>+1}/60
(0^0^0;64) resize. 300,300,1,3,3 # Generate background image
eval "
Expand All @@ -22,6 +22,6 @@ go :
);
"
wait 20
done rm[0]
} rm[0]

# End of file.
6 changes: 3 additions & 3 deletions gmic/resources/samples/mandelbrot.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go nm "Mandelbrot" e[] "" animate 60
go =>[^] "Mandelbrot" e[] "" animate 60

# Main function
go :
Expand All @@ -19,15 +19,15 @@ go :
target=-0.77175402641296387,0.10690001025795937
zoom=1e-2
nbf=100
repeat $nbf f=$>
repeat $nbf { f=$>
e[] "\r > Frame "$f"/"$nbf
input 512,512
mandelbrot. {"C = ["$target"]; z = "$zoom"; [C - z, C + z ]"},16384
map. [0] rotate. {180*cos(pi*$f/$nbf)},2,0,50%,50%
cut. 0,255
resize. 256,192,1,3,0,0,0.5,0.5
zoom*=0.93
done
}
remove[0]

# Make frames loop, using temporal fading.
Expand Down
20 changes: 10 additions & 10 deletions gmic/resources/samples/pacman.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go nm Pacman e[] "" animate 60
go =>[^] Pacman e[] "" animate 60

# Main function
go :
Expand All @@ -17,21 +17,21 @@ go :

# Create image of pellets = [1].
shape_circle 30
resize[-1] 300%,100%,1,1,0,0,0.5 W={w}
resize[-1] [-2],100%,1,1,0,2
resize. 300%,100%,1,1,0,0,0.5 W:=w
resize. ..,100%,1,1,0,2

# Create colormap = [2].
(0,0,0;255,255,255;255,255,0) permute. yzcx

nbf=20
repeat $nbf f=$>
repeat $nbf { f=$>
e[] "\r > Frame "{$f+1}/$nbf
[0],[0] circle[-1] 30%,50%,15%,1,2
y={h/2-2*h*($f<$nbf/2?$f:$nbf-$f)/$nbf}
polygon[-1] 3,30%,50%,100%,$y,100%,{h-$y}
+fill[-1] 0 image[-1] [1],{w/10+2*$W*(1-$f/$nbf)},{(h-h#1)/2}
max[-2,-1] map[-1] [2] max[-1] [0]
done
[0],[0] circle. 30%,50%,15%,1,2
y:=h/2-2*h*($f<$nbf/2?$f:$nbf-$f)/$nbf
polygon. 3,30%,50%,100%,$y,100%,{h-$y}
+fill. 0 image. [1],{w/10+2*$W*(1-$f/$nbf)},{(h-h#1)/2}
max[-2,-1] map. [2] max. [0]
}
remove[0-2]

# End of file.
6 changes: 3 additions & 3 deletions gmic/resources/samples/rotozoom.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go r2dx 200%,1 nm Rotozoom e[] "" animate 70
go r2dx 200%,1 =>[^] Rotozoom e[] "" animate 70

# Main function
go :
v 0
nbf=70
sp colorful

repeat $nbf
repeat $nbf {
e[] "\r > Frame "{1+$>}"/"$nbf
240,240,1,3,"
const boundary = 2;
Expand All @@ -27,7 +27,7 @@ go :

P = [ w#0,h#0 ]/2 + [ dx,dy ] + rot*[ x - w/2,y -h/2 ];
i(#0,P)"
done
}
rm[0]

# End of file.
34 changes: 17 additions & 17 deletions gmic/resources/samples/scrolling.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Author : David Tschumperle

# Entrypoint when run from CLI:
go nm Scrolling e[] "" animate 50
go =>[^] Scrolling e[] "" animate 50

# Main function
go :
Expand All @@ -12,33 +12,33 @@ go :

# Define rendering sizes.
wf,hf=512,384
wr,hr={round(1.5*[$wf,$hf])}
wr,hr:=round(1.5*[$wf,$hf])

# Generate image [0] = line of text.
input 0 text "G'MIC rocks ! ",0,0,48,1,1 wt,ht={[w,h]} resize {2.5*$wr},100%,1,1,0,2
input 0 text "G'MIC rocks ! ",0,0,48,1,1 wt,ht:=[w,h] resize {2.5*$wr},100%,1,1,0,2

# Generate image [1] = color gradient.
input {10*ceil($hr/$ht)},1,1,3,u(64,255) tsp[-1] , transpose[-1] resize[-1] $wr,$hr,1,3,3
input {10*ceil($hr/$ht)},1,1,3,u(64,255) tsp. , transpose. resize. $wr,$hr,1,3,3

# Generate image [2] = 3d cube (3d object).
box3d {$wr/3} color3d[-1] 255,32,200 center3d[-1]
box3d {$wr/3} color3d. 255,32,200 center3d.

# Generate animation frames.
nbf=50
repeat $nbf f=$>
repeat $nbf { f=$>
e[] "\r > Frame "{$f+1}/$nbf
input $wr,$hr,1,1
repeat ceil($hr/$ht)
image[-1] [0],{w/5*cos($>/3+2*pi*$f/$nbf)-$wt*(1+$f/$nbf)},{$>*$ht}
done
+mul[1,-1] remove[-2]
rotate[-1] 25,1,0
resize[-1] $wf,$hf,1,100%,0,0,0.5,0.5
+fill[-1] 0
+rotate3d[2] 1,-1,0,{180*$f/$nbf} rotate3d[-1] 0,1,0,{360*$f/$nbf} rotate3d[-1] 1,2,3,-60
object3d[-2] [-1],50%,50%,100,1,3,0,0
remove[-1] div[-1] 1.6 max[-2,-1]
done
repeat ceil($hr/$ht) {
image. [0],{w/5*cos($>/3+2*pi*$f/$nbf)-$wt*(1+$f/$nbf)},{$>*$ht}
}
+mul[1,-1] remove..
rotate. 25,1,0
resize. $wf,$hf,1,100%,0,0,0.5,0.5
+fill. 0
+rotate3d[2] 1,-1,0,{180*$f/$nbf} rotate3d. 0,1,0,{360*$f/$nbf} rotate3d. 1,2,3,-60
object3d.. .,50%,50%,100,1,3,0,0
remove. div. 1.6 max[-2,-1]
}
keep[3--1]

# End of file.
2 changes: 1 addition & 1 deletion gmic/resources/samples/template.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ jd_xtrartistic_preview :
# fine, you may want to submit your G'MIC filter source to the 'gmic-community' repository
# (with a pull-request):
#
# https://github.com/dtschump/gmic-community/
# https://github.com/GreycLab/gmic-community/
#
# Thanks for your participation.

Expand Down
22 changes: 11 additions & 11 deletions gmic/resources/samples/torus3d.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@
# Author : David Tschumperle

# Entry point when run from CLI:
go nm "Torus 3D" e[] "" animate 60
go =>[^] "Torus 3D" e[] "" animate 60

# Main function
go :
v 0

# Create 3d textured double-torus object.
srand 16
repeat 2
repeat 2 {
torus3d 70,20 100,100,1,3
plasma[-1] 1,1,3 normalize[-1] 0,255 equalize[-1] 256 # Generate plasma texture
+fill_color[-1] ${-RGB} image[-2] [-1],0,0,0,0,0.6 # Tint it a little bit with a random color
texturize3d[-3] [-2]
plasma. 1,1,3 normalize. 0,255 equalize. 256 # Generate plasma texture
+fill_color. ${-RGB} image.. .,0,0,0,0,0.6 # Tint it a little bit with a random color
texturize3d... ..
remove[-2,-1]
done
rotate3d[-1] 1,0,0,90 +3d[-1] 80,0,0 # Shift and merge torii
}
rotate3d. 1,0,0,90 +3d. 80,0,0 # Shift and merge torii
+3d center3d rotate3d 1,0,0,30 *3d 2

# Create background image.
600,600,1,3 plasma[-1] 1,1 normalize[-1] 0,255 *[-1] '[0.2,0.3,0.7]'
600,600,1,3 plasma. 1,1 normalize. 0,255 *. '[0.2,0.3,0.7]'

# Generate animation frames.
repeat 45
repeat 45 {
e[] "\r > Frame "{$>+1}/45
+water[1] 100
object3d[-1] [0],50%,50%,0,1,5,0
object3d. [0],50%,50%,0,1,5,0
rotate3d[0] 1,2,3,8
done
}

remove[0,1] # Remove 3d object + background
r2dx 50% # Anti-alias frames
Expand Down
3,507 changes: 2,202 additions & 1,305 deletions gmic/src/CImg.h

Large diffs are not rendered by default.

173 changes: 88 additions & 85 deletions gmic/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@

# Try to auto-detect target OS.
OS = $(shell uname)
USR = /usr
LIB = lib
BIN = bin
INCLUDE = include
PREFIX ?= /usr
LIB ?= lib
BIN ?= bin
INCLUDE ?= include
PIC = -fPIC
EXE =
WGET = wget --no-check-certificate --quiet -O
PLUGINDIR = $(shell gimptool-2.0 --gimpplugindir)/plug-ins
BASH_COMPLETIONSDIR = $(shell pkg-config --variable completionsdir bash-completion || echo $(PREFIX)/share/bash-completion/completions)
VERSION = $(shell grep 'gmic_version\ ' gmic.h | tail -c4 | head -c3)
VERSION1 = $(shell grep 'gmic_version\ ' gmic.h | tail -c4 | head -c1)
VERSION2 = $(shell grep 'gmic_version\ ' gmic.h | tail -c3 | head -c1)
Expand Down Expand Up @@ -120,12 +121,12 @@ endif

ifeq ($(OS),FreeBSD)
OS = Unix
USR = /usr/local
PREFIX = /usr/local
endif

ifeq ($(OS),DragonFly)
OS = Unix
USR = /usr/local
PREFIX = /usr/local
endif

ifeq ($(OS),NetBSD)
Expand All @@ -134,15 +135,15 @@ endif

ifneq (,$(findstring MINGW,$(OS)))
OS = Windows
USR = /mingw64
PREFIX = /mingw64
endif

ifeq ($(OS),Darwin)
ifeq (,$(wildcard /opt/local))
USR = /usr/local
PREFIX = /usr/local
PLUGINDIR = $(HOME)/Library/Application\ Support/Gimp/plug-ins
else
USR = /opt/local
PREFIX = /opt/local
endif
WGET = curl -k -L --silent -o
endif
Expand All @@ -152,13 +153,13 @@ EXE = .exe
PIC =
endif

ifeq ($(shell echo $(notdir $(CXX)) | head -c3),g++)
ifneq (,$(findstring g++,$(CXX)))
IS_GCC = 1
endif
ifeq ($(shell echo $(notdir $(CXX)) | head -c7),clang++)
ifneq (,$(findstring clang++,$(CXX)))
IS_CLANG = 1
endif
ifeq ($(shell echo $(notdir $(CXX)) | head -c4),icpc)
ifneq (,$(findstring icpc,$(CXX)))
IS_ICPC = 1
endif

Expand All @@ -181,13 +182,13 @@ PRERELEASE = $(shell date +%y%m%d)
PRERELEASE_CFLAGS = -Dgmic_prerelease="\\\"$(PRERELEASE)\\\""

# Minimal set of flags mandatory to compile G'MIC.
MANDATORY_CFLAGS = -Dcimg_date=\\\"\\\" -Dcimg_time=\\\"\\\" -Dcimg_use_zlib -I. $(shell pkg-config --cflags zlib || echo -I$(USR)/$(INCLUDE)) $(PRERELEASE_CFLAGS) $(EXTRA_CFLAGS)
MANDATORY_CFLAGS = -Dcimg_date=\\\"\\\" -Dcimg_time=\\\"\\\" -Dcimg_use_zlib -I. $(shell pkg-config --cflags zlib || echo -I$(PREFIX)/$(INCLUDE)) $(PRERELEASE_CFLAGS) $(EXTRA_CFLAGS)
MANDATORY_LIBS = $(shell pkg-config --libs zlib || echo -lz) $(EXTRA_LIBS)

ifndef NO_SRIPDLIB
MANDATORY_CFLAGS += -std=c++11 -pedantic
endif
MANDATORY_LIBS += -L. -L$(USR)/$(LIB) -Wl,-rpath,.
MANDATORY_LIBS += -L. -L$(PREFIX)/$(LIB) -Wl,-rpath,.
ifdef IS_GCC
MANDATORY_CFLAGS += -Wall -Wextra -Wfatal-errors -Werror=unknown-pragmas -Werror=unused-label
GCC_VER_GTEQ5 = $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 5)
Expand All @@ -211,9 +212,12 @@ endif
FLTO = -flto
OPT_CFLAGS =
ifdef IS_GCC
OPT_CFLAGS += -Ofast -mtune=generic # $(FLTO)
OPT_CFLAGS += -O3 -mtune=generic # $(FLTO)
OPT_LIBS = # $(FLTO)
endif
ifdef IS_CLANG
OPT_CFLAGS += -O3 -mtune=generic # $(FLTO)
endif
ifdef icpc
OPT_CFLAGS += -fast
endif
Expand All @@ -226,8 +230,13 @@ endif

# Enable parallelization in CImg, using OpenMP.
# (http://www.openmp.org/)
ifdef IS_CLANG
OPENMP_CFLAGS = -I/usr/lib/gcc/x86_64-linux-gnu/9/include -Dcimg_use_openmp -fopenmp=libomp
OPENMP_LIBS =
else
OPENMP_CFLAGS = -fopenmp -Dcimg_use_openmp
OPENMP_LIBS = -lgomp
endif

# Enable software debugging.
# (Use address sanitizer and thus slows down the code)
Expand Down Expand Up @@ -264,7 +273,7 @@ endif
# Enable faster X11 display, using XShm extension.
# (ftp://www.x.org/pub/X11R7.7/doc/man/man3/XShm.3.xhtml)
XSHM_CFLAGS = -Dcimg_use_xshm $(shell pkg-config --cflags xcb-shm)
XSHM_LIBS = $(shell pkg-config --libs xcb-shm || echo -L$(USR)/X11R6/lib) -lXext
XSHM_LIBS = $(shell pkg-config --libs xcb-shm || echo -L$(PREFIX)/X11R6/lib) -lXext

# Enable image display, using GDI32 (Windows).
GDI32_CFLAGS = -Dcimg_display=2
Expand Down Expand Up @@ -317,12 +326,12 @@ OPENCV_LIBS = $(shell pkg-config opencv --libs || echo -lopencv_core -lopencv_hi

# Enable support of most classical image file formats, using the GraphicsMagick++ library.
# (http://www.graphicsmagick.org/Magick++/)
MAGICK_CFLAGS = -Dcimg_use_magick $(shell pkg-config --cflags GraphicsMagick++ || echo -I$(USR)/$(INCLUDE)/GraphicsMagick)
MAGICK_CFLAGS = -Dcimg_use_magick $(shell pkg-config --cflags GraphicsMagick++ || echo -I$(PREFIX)/$(INCLUDE)/GraphicsMagick)
MAGICK_LIBS = $(shell pkg-config --libs GraphicsMagick++ || echo -lGraphicsMagick++)

# Enable native support of EXR image files, using the OpenEXR library.
# (http://www.openexr.com/)
OPENEXR_CFLAGS = -Dcimg_use_openexr $(shell pkg-config --cflags OpenEXR || echo -I$(USR)/$(INCLUDE)/OpenEXR)
OPENEXR_CFLAGS = -Dcimg_use_openexr $(shell pkg-config --cflags OpenEXR || echo -I$(PREFIX)/$(INCLUDE)/OpenEXR)
OPENEXR_LIBS = $(shell pkg-config --libs OpenEXR || echo -lIlmImf -lHalf)

# Enable Fast Fourier Transforms, using the FFTW3 library.
Expand Down Expand Up @@ -374,7 +383,7 @@ endif
$(MAKE) lib cli gimp gmic_qt libc zart

native:
$(MAKE) "CFLAGS+=$(GMIC_STD_CFLAGS) -Ofast -march=native" "LIBS+=$(GMIC_STD_LIBS)" cli
$(MAKE) "CFLAGS+=$(GMIC_STD_CFLAGS) -O3 -march=native" "LIBS+=$(GMIC_STD_LIBS)" cli

# libgmic.
#---------
Expand All @@ -398,7 +407,7 @@ endif
libgmic.o: gmic.cpp gmic.h gmic_stdlib.h CImg.h
$(CXX) -o libgmic.o -c gmic.cpp -Dgmic_core $(PIC) $(CFLAGS)

use_libgmic : use_libgmic.cpp
use_libgmic : use_libgmic.cpp libgmic.so
$(CXX) -o use_libgmic use_libgmic.cpp -std=c++11 -pedantic -lgmic $(LIBS)

# CLI.
Expand Down Expand Up @@ -439,7 +448,7 @@ cli_shared:

# CLI (static).
#--------------
GMIC_STATIC_CLI_PATH = $(USR)/$(LIB)/x86_64-linux-gnu
GMIC_STATIC_CLI_PATH = $(PREFIX)/$(LIB)/x86_64-linux-gnu
GMIC_STATIC_CLI_EXTRA =
GMIC_STATIC_CLI_CFLAGS = -Dcimg_display=0 $(MANDATORY_CFLAGS) $(OPENMP_CFLAGS) $(ABORT_CFLAGS) $(PARALLEL_CFLAGS) $(ZLIB_CFLAGS) $(PNG_CFLAGS) $(JPEG_CFLAGS) $(FFTW_CFLAGS)
GMIC_STATIC_CLI_LIBS = ./libgmic.o $(PARALLEL_LIBS) \
Expand Down Expand Up @@ -469,9 +478,9 @@ libcgmic_files:
ln -fs ../../gmic-community/libcgmic/gmic_libc.h .; \
ln -fs ../../gmic-community/libcgmic/use_libcgmic.c .; \
else \
$(WGET) gmic_libc.cpp https://raw.githubusercontent.com/dtschump/gmic-community/master/libcgmic/gmic_libc.cpp; \
$(WGET) gmic_libc.h https://raw.githubusercontent.com/dtschump/gmic-community/master/libcgmic/gmic_libc.h; \
$(WGET) use_libcgmic.c https://raw.githubusercontent.com/dtschump/gmic-community/master/libcgmic/use_libcgmic.c; \
$(WGET) gmic_libc.cpp https://raw.githubusercontent.com/GreycLab/gmic-community/master/libcgmic/gmic_libc.cpp; \
$(WGET) gmic_libc.h https://raw.githubusercontent.com/GreycLab/gmic-community/master/libcgmic/gmic_libc.h; \
$(WGET) use_libcgmic.c https://raw.githubusercontent.com/GreycLab/gmic-community/master/libcgmic/use_libcgmic.c; \
touch gmic_libc.cpp gmic_libc.h use_libcgmic.c; \
fi; \
fi
Expand All @@ -494,7 +503,7 @@ ifneq ($(OS),Windows)
endif

libcgmic.o: gmic_libc.cpp CImg.h gmic_libc.h gmic.h
$(CXX) -o libcgmic.o -c gmic_libc.cpp $(PIC) $(CFLAGS)
$(CXX) -o libcgmic.o -c gmic_libc.cpp -Dgmic_core $(PIC) $(CFLAGS)

use_libcgmic: use_libcgmic.c gmic_libc.h
$(CC) -std=c99 -o use_libcgmic use_libcgmic.c -lcgmic $(LIBS)
Expand Down Expand Up @@ -659,7 +668,7 @@ CImg.h:
@if [ -f ../../CImg/CImg.h ]; then \
if [ ! -f ./CImg.h ]; then ln -s ../../CImg/CImg.h .; fi; \
elif [ ! -e ./CImg.h ]; then \
$(WGET) CImg.h https://github.com/dtschump/CImg/raw/master/CImg.h; \
$(WGET) CImg.h https://github.com/GreycLab/CImg/raw/master/CImg.h; \
touch CImg.h; \
fi
@echo " done!"
Expand Down Expand Up @@ -818,84 +827,78 @@ man:
# Install / uninstall / clean.
#-----------------------------
install:
mkdir -p $(DESTDIR)$(USR)/$(INCLUDE)
mkdir -p $(DESTDIR)$(USR)/$(BIN)
mkdir -p $(DESTDIR)$(PREFIX)/$(INCLUDE)
mkdir -p $(DESTDIR)$(PREFIX)/$(BIN)
mkdir -p $(DESTDIR)$(PLUGINDIR)
mkdir -p $(DESTDIR)$(USR)/share
mkdir -p $(DESTDIR)$(USR)/$(LIB)
@if [ -f gmic ]; then cp -f gmic $(DESTDIR)$(USR)/$(BIN); fi
@if [ -f gmic_libc.h ]; then cp -f gmic_libc.h $(DESTDIR)$(USR)/$(INCLUDE)/; fi
mkdir -p $(DESTDIR)$(PREFIX)/share
mkdir -p $(DESTDIR)$(PREFIX)/$(LIB)
@if [ -f gmic ]; then cp -f gmic $(DESTDIR)$(PREFIX)/$(BIN); fi
@if [ -f gmic_libc.h ]; then cp -f gmic_libc.h $(DESTDIR)$(PREFIX)/$(INCLUDE)/; fi
@if [ -f ../resources/gmic_cluts.gmz ]; then cp -f ../resources/gmic_cluts.gmz $(DESTDIR)$(PLUGINDIR); fi
@if [ -f ../resources/gmic_denoise_cnn.gmz ]; then cp -f ../resources/gmic_denoise_cnn.gmz $(DESTDIR)$(PLUGINDIR); fi
@if [ -f ../zart/zart ]; then cp -f ../zart/zart $(DESTDIR)$(USR)/$(BIN); fi
@if [ -f ../gmic-qt/gmic_qt ]; then cp -f ../gmic-qt/gmic_qt $(DESTDIR)$(USR)/$(BIN); fi
@if [ -f ../zart/zart ]; then cp -f ../zart/zart $(DESTDIR)$(PREFIX)/$(BIN); fi
@if [ -f ../gmic-qt/gmic_qt ]; then cp -f ../gmic-qt/gmic_qt $(DESTDIR)$(PREFIX)/$(BIN); fi
@if [ -f ../gmic-qt/gmic_gimp_qt ]; then cp -f ../gmic-qt/gmic_gimp_qt $(DESTDIR)$(PLUGINDIR); fi
@if [ -f libgmic.so ]; then \
cp -f gmic.h $(DESTDIR)$(USR)/$(INCLUDE); \
cp -f libgmic.so $(DESTDIR)$(USR)/$(LIB)/libgmic.so.$(VERSION); \
ln -fs libgmic.so.$(VERSION) $(DESTDIR)$(USR)/$(LIB)/libgmic.so.$(VERSION1); \
ln -fs libgmic.so.$(VERSION1) $(DESTDIR)$(USR)/$(LIB)/libgmic.so; \
cp -f gmic.h $(DESTDIR)$(PREFIX)/$(INCLUDE); \
cp -f libgmic.so $(DESTDIR)$(PREFIX)/$(LIB)/libgmic.so.$(VERSION); \
ln -fs libgmic.so.$(VERSION) $(DESTDIR)$(PREFIX)/$(LIB)/libgmic.so.$(VERSION1); \
ln -fs libgmic.so.$(VERSION1) $(DESTDIR)$(PREFIX)/$(LIB)/libgmic.so; \
fi
@if [ -f libcgmic.so ]; then \
cp -f gmic_libc.h $(DESTDIR)$(USR)/$(INCLUDE); \
cp -f libcgmic.so $(DESTDIR)$(USR)/$(LIB)/libcgmic.so.$(VERSION); \
ln -fs libcgmic.so.$(VERSION) $(DESTDIR)$(USR)/$(LIB)/libcgmic.so.$(VERSION1); \
ln -fs libcgmic.so.$(VERSION1) $(DESTDIR)$(USR)/$(LIB)/libcgmic.so; \
cp -f gmic_libc.h $(DESTDIR)$(PREFIX)/$(INCLUDE); \
cp -f libcgmic.so $(DESTDIR)$(PREFIX)/$(LIB)/libcgmic.so.$(VERSION); \
ln -fs libcgmic.so.$(VERSION) $(DESTDIR)$(PREFIX)/$(LIB)/libcgmic.so.$(VERSION1); \
ln -fs libcgmic.so.$(VERSION1) $(DESTDIR)$(PREFIX)/$(LIB)/libcgmic.so; \
fi
@if [ -f ../man/gmic.1.gz ]; then \
mkdir -p $(DESTDIR)$(USR)/share/man/man1; \
mkdir -p $(DESTDIR)$(USR)/share/man/fr/man1; \
cp -f ../man/gmic.1.gz $(DESTDIR)$(USR)/share/man/man1/gmic.1.gz; \
cp -f ../man/gmic.1.gz $(DESTDIR)$(USR)/share/man/fr/man1/gmic.1.gz; \
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1; \
mkdir -p $(DESTDIR)$(PREFIX)/share/man/fr/man1; \
cp -f ../man/gmic.1.gz $(DESTDIR)$(PREFIX)/share/man/man1/gmic.1.gz; \
cp -f ../man/gmic.1.gz $(DESTDIR)$(PREFIX)/share/man/fr/man1/gmic.1.gz; \
fi
@if [ -f ../resources/gmic_bashcompletion.sh ]; then \
if [ -d /usr/share/bash-completion/completions ]; then \
mkdir -p $(DESTDIR)/usr/share/bash-completion/completions; \
cp -f ../resources/gmic_bashcompletion.sh $(DESTDIR)/usr/share/bash-completion/completions/gmic; \
fi; \
if [ -d /opt/local/etc/bash_completion.d/ ]; then \
mkdir -p $(DESTDIR)/opt/local/etc/bash_completion.d; \
cp -f ../resources/gmic_bashcompletion.sh $(DESTDIR)/opt/local/etc/bash_completion.d/gmic; \
fi; \
mkdir -p $(DESTDIR)$(BASH_COMPLETIONSDIR); \
cp -f ../resources/gmic_bashcompletion.sh $(DESTDIR)$(BASH_COMPLETIONSDIR)/gmic; \
fi
@if [ -f ../zart/zart ]; then \
mkdir -p $(DESTDIR)$(USR)/share/applications; \
mkdir -p $(DESTDIR)$(USR)/share/icons/hicolor/48x48/apps; \
mkdir -p $(DESTDIR)$(USR)/share/icons/hicolor/scalable/apps; \
cp -f ../zart/zart.desktop $(DESTDIR)$(USR)/share/applications; \
cp -f ../zart/icons/48-zart.png $(DESTDIR)$(USR)/share/icons/hicolor/48x48/apps/zart.png; \
cp -f ../zart/icons/zart.svg $(DESTDIR)$(USR)/share/icons/hicolor/scalable/apps; \
mkdir -p $(DESTDIR)$(PREFIX)/share/applications; \
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps; \
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps; \
cp -f ../zart/zart.desktop $(DESTDIR)$(PREFIX)/share/applications; \
cp -f ../zart/icons/48-zart.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/zart.png; \
cp -f ../zart/icons/zart.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps; \
fi
@if [ -f ../gmic-qt/gmic_qt ]; then \
mkdir -p $(DESTDIR)$(USR)/share/applications; \
mkdir -p $(DESTDIR)$(USR)/share/icons/hicolor/48x48/apps; \
mkdir -p $(DESTDIR)$(USR)/share/icons/hicolor/scalable/apps; \
cp -f ../gmic-qt/gmic_qt.desktop $(DESTDIR)$(USR)/share/applications; \
cp -f ../gmic-qt/icons/application/48-gmic_qt.png $(DESTDIR)$(USR)/share/icons/hicolor/48x48/apps/gmic_qt.png; \
cp -f ../gmic-qt/icons/application/gmic_qt.svg $(DESTDIR)$(USR)/share/icons/hicolor/scalable/apps; \
mkdir -p $(DESTDIR)$(PREFIX)/share/applications; \
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps; \
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps; \
cp -f ../gmic-qt/gmic_qt.desktop $(DESTDIR)$(PREFIX)/share/applications; \
cp -f ../gmic-qt/icons/application/48-gmic_qt.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/gmic_qt.png; \
cp -f ../gmic-qt/icons/application/gmic_qt.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps; \
fi

uninstall:
rm -f $(DESTDIR)$(PLUGINDIR)/gmic_gimp_qt
rm -f $(DESTDIR)$(USR)/$(BIN)/gmic
rm -f $(DESTDIR)$(USR)/$(BIN)/zart
rm -f $(DESTDIR)$(USR)/$(BIN)/gmic_qt
rm -f $(DESTDIR)$(USR)/$(INCLUDE)/gmic.h
rm -f $(DESTDIR)$(USR)/$(LIB)/libgmic.so.$(VERSION)
rm -f $(DESTDIR)$(USR)/$(LIB)/libgmic.so.$(VERSION1)
rm -f $(DESTDIR)$(USR)/$(LIB)/libgmic.so
rm -f $(DESTDIR)$(USR)/$(LIB)/libcgmic.so.$(VERSION)
rm -f $(DESTDIR)$(USR)/$(LIB)/libcgmic.so.$(VERSION1)
rm -f $(DESTDIR)$(USR)/$(LIB)/libcgmic.so
rm -rf $(DESTDIR)$(USR)/share/doc/gmic/
rm -f $(DESTDIR)$(USR)/share/man/man1/gmic.1.gz
rm -f $(DESTDIR)$(USR)/share/man/fr/man1/gmic.1.gz
rm -f $(DESTDIR)$(USR)/share/applications/zart.desktop
rm -f $(DESTDIR)$(USR)/share/icons/hicolor/48x48/apps/zart.png
rm -f $(DESTDIR)$(USR)/share/icons/hicolor/scalable/apps/zart.svg
rm -f $(DESTDIR)$(USR)/share/applications/gmic_qt.desktop
rm -f $(DESTDIR)$(USR)/share/icons/hicolor/48x48/apps/gmic_qt.png
rm -f $(DESTDIR)$(USR)/share/icons/hicolor/scalable/apps/gmic_qt.svg
rm -f $(DESTDIR)$(PREFIX)/$(BIN)/gmic
rm -f $(DESTDIR)$(PREFIX)/$(BIN)/zart
rm -f $(DESTDIR)$(PREFIX)/$(BIN)/gmic_qt
rm -f $(DESTDIR)$(PREFIX)/$(INCLUDE)/gmic.h
rm -f $(DESTDIR)$(PREFIX)/$(LIB)/libgmic.so.$(VERSION)
rm -f $(DESTDIR)$(PREFIX)/$(LIB)/libgmic.so.$(VERSION1)
rm -f $(DESTDIR)$(PREFIX)/$(LIB)/libgmic.so
rm -f $(DESTDIR)$(PREFIX)/$(LIB)/libcgmic.so.$(VERSION)
rm -f $(DESTDIR)$(PREFIX)/$(LIB)/libcgmic.so.$(VERSION1)
rm -f $(DESTDIR)$(PREFIX)/$(LIB)/libcgmic.so
rm -rf $(DESTDIR)$(PREFIX)/share/doc/gmic/
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gmic.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/fr/man1/gmic.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/applications/zart.desktop
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/zart.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/zart.svg
rm -f $(DESTDIR)$(PREFIX)/share/applications/gmic_qt.desktop
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/gmic_qt.png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/gmic_qt.svg

distclean: clean

Expand Down
3,743 changes: 1,930 additions & 1,813 deletions gmic/src/gmic.cpp

Large diffs are not rendered by default.

159 changes: 103 additions & 56 deletions gmic/src/gmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@
*/

#ifndef gmic_version
#define gmic_version 316
#define gmic_version 322

#ifndef gmic_pixel_type
#define gmic_pixel_type float
#endif

#include <cstdio>
#include <cstring>

// Define gmic_uint64 type.
#ifndef gmic_uint64
#if cimg_OS==2
Expand All @@ -78,18 +75,17 @@
const char gmic_dollar = 23, gmic_lbrace = 24, gmic_rbrace = 25, gmic_comma = 26, gmic_dquote = 28,
gmic_store = 29; // <- this one is only used in variable names.

//---------------------------------------------------------
// Public API for the 'gmic_image' and 'gmic_list' classes.
//---------------------------------------------------------
#ifndef gmic_core

// Define classes 'gmic_image<T>' and 'gmic_list<T>'.
//---------------------------------------------------
#ifndef cimg_version

#define gmic_image CImg
#define gmic_list CImgList
#ifndef cimg_library

namespace cimg_library {
namespace gmic_library {

// Class 'gmic_image<T>'.
//-----------------------
template<typename T> struct gmic_image {
unsigned int _width; // Number of image columns (dimension along the X-axis)
unsigned int _height; // Number of image lines (dimension along the Y-axis)
Expand Down Expand Up @@ -134,10 +130,10 @@ namespace cimg_library {
const T& operator()(const unsigned int x, const unsigned int y=0, const unsigned z=0, const unsigned c=0) const {
return _data[x + y*_width + z*_width*_height + c*_width*_height*_depth ];
}

};

// Class 'gmic_list<T>'.
//----------------------
template<typename T> struct gmic_list {
unsigned int _width; // Number of images in the list
unsigned int _allocated_width; // Allocated items in the list (must be 2^N and >size)
Expand Down Expand Up @@ -170,22 +166,17 @@ namespace cimg_library {
const gmic_image<T>& operator()(const unsigned int l) const {
return _data[l];
}

};
}
#undef gmic_image
#undef gmic_list
#endif // #ifndef cimg_version

#else // #ifndef gmic_core
}

// Define private functions, used to compile libgmic.
//---------------------------------------------------
#endif // #ifndef cimg_library

#ifndef cimg_verbosity
#define cimg_verbosity 1
#endif
#else // #ifndef gmic_core

//-------------------------------------------------------------
// Private API (used when compiling gmic core components only).
//-------------------------------------------------------------
#ifdef _MSC_VER
#pragma comment(linker,"/STACK:6291456")
#pragma inline_depth(2)
Expand All @@ -195,25 +186,49 @@ namespace cimg_library {
#ifdef cimg_version
#error "[gmic] *** Error *** File 'CImg.h' has been already included (should have been done first in file 'gmic.h')."
#endif

#ifndef cimg_plugin
#define cimg_plugin "gmic.cpp"
#endif

#ifndef cimglist_plugin
#define cimglist_plugin "gmic.cpp"
#endif

#ifdef cimg_use_abort
#ifndef cimg_verbosity
#define cimg_verbosity 1
#endif

#ifndef cimg_display
#define cimg_display 0
#endif

#ifndef cimg_appname
#define cimg_appname "gmic"
#endif

#ifdef gmic_is_parallel
#define cimg_use_pthread
#endif

#define cimg_library gmic_library
#define CImg gmic_image
#define CImgList gmic_list

#if defined(cimg_use_abort) && !defined(__MACOSX__) && !defined(__APPLE__)
inline bool *gmic_current_is_abort();
#define cimg_abort_init \
bool *const gmic_is_abort = ::gmic_current_is_abort()
#define cimg_abort_test \
if (*gmic_is_abort) throw CImgAbortException()
#define cimg_abort_init bool *const gmic_is_abort = ::gmic_current_is_abort()
#define cimg_abort_test if (*gmic_is_abort) throw CImgAbortException()
#endif

inline double gmic_mp_dollar(const char *const str, void *const p_list);
#define cimg_mp_operator_dollar(str) \
::gmic_mp_dollar(str,&imglist)

inline double gmic_mp_abort();
#define cimg_mp_func_abort() \
return ::gmic_mp_abort()

template<typename T>
inline double gmic_mp_get(double *const ptrd, const unsigned int siz, const bool to_string, const char *const str,
void *const p_list, const T& pixel_type);
Expand Down Expand Up @@ -243,12 +258,6 @@ inline double gmic_mp_store(const double *const ptrs, const unsigned int siz,
#define cimg_mp_func_store(ptrs,siz,w,h,d,s,is_compressed,str) \
return ::gmic_mp_store(ptrs,siz,w,h,d,s,is_compressed,str,&mp.imglist,(T)0)

#ifndef cimg_display
#define cimg_display 0
#endif
#ifndef cimg_appname
#define cimg_appname "gmic"
#endif
#include "CImg.h"

#if cimg_OS==2
Expand All @@ -262,14 +271,21 @@ inline double gmic_mp_store(const double *const ptrs, const unsigned int siz,
#include <signal.h>

#endif // #if cimg_OS==2

#endif // #ifndef gmic_core

// Define main libgmic class 'gmic'.
//----------------------------------
#define gmic_image cimg_library::CImg
#define gmic_list cimg_library::CImgList
//--------------------------------------------------------
// Public API for the 'gmic' and 'gmic_exception' classes.
//--------------------------------------------------------
#include <cstdio>
#include <cstring>
#define gmic_new_attr commands(0), commands_names(0), commands_has_arguments(0), \
_variables(0), _variables_names(0), variables(0), variables_names(0), _variables_lengths(0), variables_lengths(0)

using namespace gmic_library;

// Class 'gmic'.
//--------------
struct gmic {

// Destructor.
Expand Down Expand Up @@ -300,12 +316,37 @@ struct gmic {

// Run G'MIC pipeline on an already-constructed object.
template<typename T>
gmic& run(const char *const commands_line, float *const p_progress=0, bool *const p_is_abort=0,
const T& pixel_type=(T)0);
gmic& run(const char *const commands_line, const T& pixel_type=(T)0);

template<typename T>
gmic& run(const char *const commands_line, gmic_list<T> &images, gmic_list<char> &images_names,
float *const p_progress=0, bool *const p_is_abort=0);
gmic& run(const char *const commands_line, gmic_list<T> &images, gmic_list<char> &images_names);

// Bridge for calling gmic with classes compatible with 'gmic_list'.
template<typename ti, typename tn>
gmic(const char *const commands_line,
ti& images, tn& images_names,
const char *const custom_commands=0,
const bool include_stdlib=true, float *const p_progress=0, bool *const p_is_abort=0):gmic_new_attr {
assign(commands_line,
*(gmic_list<gmic_pixel_type>*)&images,*(gmic_list<char>*)&images_names,
custom_commands,include_stdlib,p_progress,p_is_abort);
}

template<typename ti, typename tn>
gmic& assign(const char *const commands_line,
ti& images, tn& images_names,
const char *const custom_commands=0,
const bool include_stdlib=true, float *const p_progress=0, bool *const p_is_abort=0) {
return assign(commands_line,
*(gmic_list<gmic_pixel_type>*)&images,*(gmic_list<char>*)&images_names,
custom_commands,include_stdlib,p_progress,p_is_abort);
}

template<typename ti, typename tn>
gmic& run(const char *const commands_line, ti& images, tn& images_names) {
return run(commands_line,
*(gmic_list<gmic_pixel_type>*)&images,*(gmic_list<char>*)&images_names);
}

// These functions return (or init) G'MIC-specific paths.
static const char* path_user(const char *const custom_path=0);
Expand All @@ -316,7 +357,9 @@ struct gmic {
template<typename T>
static bool search_sorted(const char *const str, const T& list, const unsigned int length, unsigned int &out_ind);
static const gmic_image<void*> current_run(const char *const func_name, void *const p_list);
static bool* current_is_abort();
static double mp_dollar(const char *const str, void *const p_list);
static double mp_abort();
template<typename T>
static double mp_get(double *const ptrd, const unsigned int siz, const bool to_string, const char *const str,
void *const p_list, const T& pixel_type);
Expand Down Expand Up @@ -346,9 +389,9 @@ struct gmic {
float *const p_progress, bool *const p_is_abort);

gmic_image<char> get_variable(const char *const name, const unsigned int *const variables_sizes=0,
const gmic_list<char> *const images_names=0) const;
const gmic_list<char> *const images_names=0, unsigned int *const varlength=0) const;
const char *set_variable(const char *const name, const char operation='=', const char *const value=0,
const double *const pvalue=0, const unsigned int *const variables_sizes=0);
const double dvalue=0, const unsigned int *const variables_sizes=0);
const char *set_variable(const char *const name, const gmic_image<unsigned char>& value,
const unsigned int *const variables_sizes=0);

Expand Down Expand Up @@ -437,34 +480,34 @@ struct gmic {

template<typename T>
gmic& _run(const gmic_list<char>& commands_line, gmic_list<T> &images, gmic_list<char> &images_names,
float *const p_progress, bool *const p_is_abort);
const bool push_new_run);

template<typename T>
gmic& _run(const gmic_list<char>& commands_line, unsigned int& position, gmic_list<T>& images,
gmic_list<char>&images_names, gmic_list<T>& parent_images, gmic_list<char>& parent_images_names,
const unsigned int *const variables_sizes, bool *const is_noargs, const char *const parent_arguments,
const gmic_image<unsigned int> *const command_selection);
const gmic_image<unsigned int> *const command_selection, const bool push_new_run);

// Class attributes.
static const char *builtin_commands_names[];
static gmic_image<int> builtin_commands_inds;
static gmic_image<char> stdlib;
static bool is_display_available;

gmic_list<char> *commands, *commands_names, *commands_has_arguments, *_variables, *_variables_names,
**variables, **variables_names, commands_files, callstack;
gmic_image<unsigned int> dowhiles, fordones, foreachdones, repeatdones;
gmic_list<char> *commands, *commands_names, *commands_has_arguments, commands_files, callstack,
*_variables, *_variables_names, **variables, **variables_names;
gmic_image<unsigned int> dowhiles, fordones, foreachdones, repeatdones, *_variables_lengths, **variables_lengths;
gmic_image<unsigned char> light3d;
gmic_image<void*> display_windows;
gmic_image<char> status;

float focale3d, light3d_x, light3d_y, light3d_z, specular_lightness3d, specular_shininess3d, _progress, *progress;
float light3d_x, light3d_y, light3d_z, _progress, *progress;
gmic_uint64 reference_time;
unsigned int nb_dowhiles, nb_fordones, nb_foreachdones, nb_repeatdones, nb_carriages_default, nb_carriages_stdout,
debug_filename, debug_line, cimg_exception_mode;
int verbosity, render3d, renderd3d, network_timeout;
bool allow_entrypoint, is_change, is_debug, is_running, is_start, is_return, is_quit, is_double3d, is_debug_info,
_is_abort, *is_abort, is_abort_thread;
int verbosity, network_timeout;
bool allow_entrypoint, is_change, is_debug, is_running, is_start, is_return, is_quit, is_debug_info,
_is_abort, *is_abort, is_abort_thread, is_lbrace_command;
const char *starting_commands_line;
};

Expand Down Expand Up @@ -497,16 +540,20 @@ struct gmic_exception {
}
};

// Explicit declarations of functions.
//-------------------------------------
inline bool *gmic_current_is_abort() {
static bool def = false;
gmic_image<void*> gr = gmic::current_run("gmic_abort_init()",0);
return gr?((gmic*)(gr[0]))->is_abort:&def;
return gmic::current_is_abort();
}

inline double gmic_mp_dollar(const char *const str, void *const p_list) {
return gmic::mp_dollar(str,p_list);
}

inline double gmic_mp_abort() {
return gmic::mp_abort();
}

template<typename T>
inline double gmic_mp_get(double *const ptrd, const unsigned int siz, const bool to_string, const char *const str,
void *const p_list, const T& pixel_type) {
Expand Down
49 changes: 32 additions & 17 deletions gmic/src/gmic_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@

#undef gmic_core
#include <signal.h>
#define cimg_appname "gmic"
#define cimg_library gmic_library
#define CImg gmic_image
#define CImgList gmic_list
#include "CImg.h"
#include "gmic.h"
using namespace cimg_library;
using namespace gmic_library;

// Fallback function for segfault signals.
#if cimg_OS==1
Expand All @@ -61,7 +65,7 @@ void gmic_segfault_sigaction(int signal, siginfo_t *si, void *arg) {
cimg::mutex(29);
std::fprintf(cimg::output(),
"\n\n%s[gmic] G'MIC encountered a %sfatal error%s%s. "
"Please submit a bug report, at: %shttps://github.com/dtschump/gmic/issues%s\n\n",
"Please submit a bug report, at: %shttps://github.com/GreycLab/gmic/issues%s\n\n",
cimg::t_red,cimg::t_bold,cimg::t_normal,cimg::t_red,
cimg::t_bold,cimg::t_normal);
std::fflush(cimg::output());
Expand Down Expand Up @@ -106,7 +110,8 @@ int main(int argc, char **argv) {
#endif

// Declare main G'MIC instance.
gmic gmic_instance;
static bool is_abort;
gmic gmic_instance((char*)0,(char*)0,true,(float*)0,&is_abort,(gmic_pixel_type)0);
gmic_instance.set_variable("_host",0,"cli");
gmic_instance.add_commands("cli_start : ");

Expand Down Expand Up @@ -162,17 +167,27 @@ int main(int argc, char **argv) {
if (!*ext || !std::strcmp(ext,"gmic")) {
std::FILE *gmic_file = std::fopen(argv[1],"rb");
if (gmic_file) {
bool allow_entrypoint = false;
gmic gi(0,0,false,0,0,(gmic_pixel_type)0);
gi.add_commands(gmic_file,argv[1],is_debug,0,0,&allow_entrypoint);
if (allow_entrypoint && argc==3) { // Check if command '_main_' has arguments
const unsigned int hash = (int)gmic::hashcode("_main_",false);
unsigned int ind = 0;
if (gmic::search_sorted("_main_",gi.commands_names[hash],
gi.commands_names[hash].size(),ind)) // Command found
allow_entrypoint = (bool)gi.commands_has_arguments[hash](ind,0);
bool is_command_file = (bool)*ext;
if (!*ext) { // In case file has no extension, check it starts with a shebang
char head[2];
if (std::fread(head,1,2,gmic_file)==2) {
std::fseek(gmic_file,0,SEEK_SET);
if (*head=='#' && head[1]=='!') is_command_file = true;
}
}
if (is_command_file) {
bool allow_entrypoint = false;
gmic gi(0,0,false,0,0,(gmic_pixel_type)0);
gi.add_commands(gmic_file,argv[1],is_debug,0,0,&allow_entrypoint);
if (allow_entrypoint && argc==3) { // Check if command '_main_' has arguments
const unsigned int hash = (int)gmic::hashcode("_main_",false);
unsigned int ind = 0;
if (gmic::search_sorted("_main_",gi.commands_names[hash],
gi.commands_names[hash].size(),ind)) // Command found
allow_entrypoint = (bool)gi.commands_has_arguments[hash](ind,0);
}
gmic_instance.allow_entrypoint = allow_entrypoint;
}
gmic_instance.allow_entrypoint = allow_entrypoint;
std::fclose(gmic_file);
}
}
Expand Down Expand Up @@ -235,16 +250,16 @@ int main(int argc, char **argv) {
std::fflush(cimg::output());
}
if (*e.command()) {
std::fprintf(cimg::output(),"\n[gmic] Command '%s' has the following description: \n",
e.command());
std::fprintf(cimg::output(),"\n[gmic] Command '%s%s%s' has the following description: \n",
cimg::t_red,e.command(),cimg::t_normal);
std::fflush(cimg::output());
CImgList<gmic_pixel_type> images;
CImgList<char> images_names;
images.insert(gmic::stdlib);
CImg<char> tmp_line(1024);
cimg_snprintf(tmp_line,tmp_line.width(),
"l[] i raw:\"%s\",char m \"%s\" onfail rm done "
"l[] i raw:\"%s\",char m \"%s\" onfail rm done "
"l[] i raw:\"%s\",uint8 m \"%s\" onfail rm done "
"l[] i raw:\"%s\",uint8 m \"%s\" onfail rm done "
"rv help \"%s\",0",
filename_update.data(),filename_update.data(),
filename_user,filename_user,
Expand Down
8,896 changes: 6,124 additions & 2,772 deletions gmic/src/gmic_stdlib.gmic

Large diffs are not rendered by default.

184,650 changes: 94,849 additions & 89,801 deletions gmic/src/gmic_stdlib_community.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions gmic/src/use_libgmic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
/*
Uncomment the two lines below if you want to use the CImg library along with the G'MIC library.
*/
//#include "CImg.h"
//using namespace cimg_library;
// #include "CImg.h"
// using namespace cimg_library;

#include "gmic.h"
#include <cstdio>
Expand Down
160 changes: 82 additions & 78 deletions gmic_qt.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Set HOST variable to define target host software.
# Possible values are "none", "gimp", "gimp3" (experimental) "krita" and "paintdotnet"
# Possible values are "none", "gimp", "gimp3" (experimental), and "paintdotnet"
#
#

Expand Down Expand Up @@ -29,6 +29,14 @@
# For debugging purpose
!defined(TIMING,var) { TIMING = off }

# DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

greaterThan(QT_MAJOR_VERSION, 5) {
message("Qt version >= 6.0.0")
QMAKE_CXXFLAGS += -fPIE
QMAKE_LFLAGS += -fPIE
}

#
# Check Qt version (>= 5.2)
#
Expand All @@ -47,7 +55,7 @@ DEFINES += QT_DEPRECATED_WARNINGS

TEMPLATE = app
QT += widgets network
CONFIG += qt c++11
CONFIG += qt c++17
CONFIG += warn_on
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
Expand All @@ -63,14 +71,18 @@ equals( HOST, "gimp3" ) {
PKGCONFIG += gimp-3.0
}

equals( HOST, "8bf") {
PKGCONFIG += lcms2
}

DEFINES += cimg_use_cpp11=1
DEFINES += cimg_use_fftw3 cimg_use_zlib
DEFINES += cimg_use_abort gmic_is_parallel cimg_use_curl cimg_use_png cimg_use_jpeg
DEFINES += cimg_appname="\\\"gmic\\\""

equals(TIMING, "on") {
DEFINES += _TIMING_ENABLED_
message(Timing is enabled)
equals(TIMING, "on")|equals(TIMING,"ON") {
DEFINES += _TIMING_ENABLED_
message(Timing is enabled)
}

defined(GMIC_PATH, var) {
Expand All @@ -87,55 +99,68 @@ defined(GMIC_PATH, var) {
defined(GMIC_PATH, var):!exists( $$GMIC_PATH/gmic.cpp ) {
error("G'MIC repository was not found ("$$GMIC_PATH")")
}
!defined(GMIC_PATH, var) {
error("GMIC_PATH variable not set, and no G'MIC source tree found")
}

message("G'MIC repository was found ("$$GMIC_PATH")")

equals( COMPILER, "clang" ) {
message("Compiler is clang++")
QMAKE_CXX = clang++
QMAKE_LINK = clang++
}
DEPENDPATH += $$GMIC_PATH

#
# Make sure CImg.h is in G'MIC source tree
#
!exists( $$GMIC_PATH/CImg.h ) {
message( "CImg.h is missing. Trying to get it..." )
!system(make -C $$GMIC_PATH CImg.h) {
error("Could not get CImg.h from G'MIC repository")
}
!exists($$GMIC_PATH/CImg.h) {
error("Could not get CImg.h from G'MIC repository")
}
message("CImg.h found")
}
CIMG.target = $$GMIC_PATH/CImg.h
CIMG.commands = \$(MAKE) -C $$GMIC_PATH CImg.h
QMAKE_EXTRA_TARGETS += CIMG

GMIC_STDLIB.target = $$GMIC_PATH/gmic_stdlib_community.h
GMIC_STDLIB.commands = \$(MAKE) -C $$GMIC_PATH gmic_stdlib_community.h
QMAKE_EXTRA_TARGETS += GMIC_STDLIB

# $$escape_expand(\n\t)

'translations/%.qm'.depends += 'translations/%.ts'
'translations/%.qm'.commands += './translations/lrelease.sh $<'

'translations/filters/%.qm'.depends += 'translations/filters/%.ts'
'translations/filters/%.qm'.commands += './translations/lrelease.sh $<'

'translations/filters/%.ts'.depends += 'translations/filters/gmic_qt_%.csv'
'translations/filters/%.ts'.commands += './translations/filters/csv2ts.sh -o $@ $<'

QMAKE_EXTRA_TARGETS += 'translations/%.qm' \
'translations/filters/%.qm' \
'translations/filters/%.ts'

#
# Make sure gmic_stdlib_community.h is in G'MIC source tree
#
!exists( $$GMIC_PATH/gmic_stdlib_community.h ) {
message( "gmic_stdlib_community.h is missing. Trying to get it..." )
!system(make -C $$GMIC_PATH gmic_stdlib_community.h) {
error("Could not get gmic_stdlib_community.h from G'MIC repository")
}
!exists($$GMIC_PATH/gmic_stdlib_community.h) {
error("Could not get gmic_stdlib_community.h from G'MIC repository")
}
message("gmic_stdlib_community.h found")
}

# Make sure CImg, gmic and gmic_stdlib_community.h are the same version
GMIC_VERSION = $$system(bash check_versions.sh $$GMIC_PATH gmic)
STDLIB_VERSION = $$system(bash check_versions.sh $$GMIC_PATH stdlib)
CIMG_VERSION = $$system(bash check_versions.sh $$GMIC_PATH CImg)
message("G'MIC version is ................." $$GMIC_VERSION)
message("gmic_stdlib_community.h version is" $$STDLIB_VERSION)
message("CImg version is .................." $$CIMG_VERSION)
!equals(GMIC_VERSION, $$CIMG_VERSION):{
exists($$GMIC_PATH/CImg.h) {
CIMG_VERSION = $$system(bash check_versions.sh $$GMIC_PATH CImg)
message("CImg version is .................." $$CIMG_VERSION)
}
exists($$GMIC_PATH/gmic_stdlib_community.h) {
STDLIB_VERSION = $$system(bash check_versions.sh $$GMIC_PATH stdlib)
message("gmic_stdlib_community.h version is" $$STDLIB_VERSION)
}
exists($$GMIC_PATH/CImg.h):exists($$GMIC_PATH/gmic_stdlib_community.h) {
GMIC_VERSION = $$system(bash check_versions.sh $$GMIC_PATH gmic)
STDLIB_VERSION = $$system(bash check_versions.sh $$GMIC_PATH stdlib)
CIMG_VERSION = $$system(bash check_versions.sh $$GMIC_PATH CImg)
!equals(GMIC_VERSION, $$CIMG_VERSION):{
error("Version numbers of files 'gmic.h' (" $$GMIC_VERSION ") and 'CImg.h' (" $$CIMG_VERSION ") mismatch")
}
!equals(GMIC_VERSION, $$STDLIB_VERSION):{
}
!equals(GMIC_VERSION, $$STDLIB_VERSION):{
error("Version numbers of files 'gmic.h' (" $$GMIC_VERSION ") and 'gmic_stdlib_community.h' (" $$STDLIB_VERSION ") mismatch")
}
}

QMAKE_DISTCLEAN = \
translations/*.qm \
translations/filters/*.ts \
translations/filters/*.qm

equals( COMPILER, "clang" ) {
message("Compiler is clang++")
QMAKE_CXX = clang++
QMAKE_LINK = clang++
}

!isEmpty(PRERELEASE) {
Expand Down Expand Up @@ -182,14 +207,6 @@ equals( HOST, "none") {
message(Building standalone version)
}

equals( HOST, "krita") {
TARGET = gmic_krita_qt
SOURCES += src/Host/Krita/host_krita.cpp
DEFINES += GMIC_HOST=krita
DEPENDPATH += $$PWD/src/Host/Krita
message(Target host software is Krita)
}

equals( HOST, "paintdotnet") {
TARGET = gmic_paintdotnet_qt
SOURCES += src/Host/PaintDotNet/host_paintdotnet.cpp
Expand All @@ -214,7 +231,6 @@ equals( HOST, "8bf") {
CONFIG += openmp
}


# use qmake CONFIG+=openmp ... to force using openmp
# For example, on OS X with GCC 4.8 installed:
# qmake -spec unsupported/macx-clang QMAKE_CXX=g++-4.8 QMAKE_LINK=g++-4.8 CONFIG+=openmp
Expand All @@ -239,7 +255,8 @@ openmp:equals(COMPILER,"clang") {
QMAKE_LFLAGS_RELEASE += -fopenmp=libomp
}

CONFIG(release, debug|release):gcc|clang:equals(LTO,"on") {
equals(LTO,"on") { LTO = ON }
CONFIG(release, debug|release):gcc|clang:equals(LTO,"ON") {
message("Link Time Optimizer enabled")
QMAKE_CXXFLAGS_RELEASE += -flto
QMAKE_LFLAGS_RELEASE += -flto
Expand Down Expand Up @@ -282,6 +299,8 @@ HEADERS += \
src/FilterParameters/TextParameter.h \
src/FilterSelector/FiltersModel.h \
src/FilterSelector/FiltersModelReader.h \
src/FilterSelector/FiltersModelBinaryReader.h \
src/FilterSelector/FiltersModelBinaryWriter.h \
src/FilterSelector/FiltersPresenter.h \
src/FilterSelector/FiltersView/FiltersView.h \
src/FilterSelector/FiltersView/TreeView.h \
Expand Down Expand Up @@ -309,6 +328,7 @@ HEADERS += \
src/ParametersCache.h \
src/PersistentMemory.h \
src/Settings.h \
src/SourcesWidget.h \
src/Tags.h \
src/TimeLogger.h \
src/Updater.h \
Expand All @@ -330,10 +350,7 @@ HEADERS += \
src/Widgets/LanguageSelectionWidget.h \
src/Widgets/ProgressInfoWindow.h


HEADERS += $$GMIC_PATH/gmic.h
HEADERS += $$GMIC_PATH/CImg.h
HEADERS += $$GMIC_PATH/gmic_stdlib_community.h

SOURCES += \
src/ClickableLabel.cpp \
Expand Down Expand Up @@ -362,6 +379,8 @@ SOURCES += \
src/FilterParameters/TextParameter.cpp \
src/FilterSelector/FiltersModel.cpp \
src/FilterSelector/FiltersModelReader.cpp \
src/FilterSelector/FiltersModelBinaryReader.cpp \
src/FilterSelector/FiltersModelBinaryWriter.cpp \
src/FilterSelector/FiltersPresenter.cpp \
src/FilterSelector/FiltersView/FiltersView.cpp \
src/FilterSelector/FiltersView/TreeView.cpp \
Expand All @@ -388,6 +407,7 @@ SOURCES += \
src/ParametersCache.cpp \
src/PersistentMemory.cpp \
src/Settings.cpp \
src/SourcesWidget.cpp \
src/Tags.cpp \
src/TimeLogger.cpp \
src/Updater.cpp \
Expand All @@ -409,18 +429,18 @@ SOURCES += \
src/Widgets/LanguageSelectionWidget.cpp \
src/Widgets/ProgressInfoWindow.cpp

equals(GMIC_DYNAMIC_LINKING, "on" ) {
equals(GMIC_DYNAMIC_LINKING, "on" )|equals(GMIC_DYNAMIC_LINKING, "ON" ) {
message(Dynamic linking with libgmic)
LIBS += -Wl,-rpath,. $$GMIC_PATH/libgmic.so
}

equals(GMIC_DYNAMIC_LINKING, "off" ) {
equals(GMIC_DYNAMIC_LINKING, "off" )|equals(GMIC_DYNAMIC_LINKING, "OFF" ) {
SOURCES += $$GMIC_PATH/gmic.cpp
DEFINES += gmic_core
}

# ALL_FORMS
FORMS += ui/inoutpanel.ui \
ui/sourceswidget.ui \
ui/multilinetextparameterwidget.ui \
ui/progressinfowindow.ui \
ui/dialogsettings.ui \
Expand Down Expand Up @@ -456,25 +476,9 @@ translations/zh_tw.ts

RESOURCES += wip_translations.qrc

# message(Build QM translation files)
# system(make -C translations)
# system(make -C translations/filters)

qm_files.commands += make -C translations
qm_filter_files.commands += make -C translations/filters
QMAKE_EXTRA_TARGETS += qm_files qm_filter_files
PRE_TARGETDEPS += qm_files qm_filter_files

QMAKE_DISTCLEAN = \
translations/*.qm \
translations/filters/*.ts \
translations/filters/*.qm

# Prevent overwriting of these files by lupdate
# TRANSLATIONS += translations/filters/fr.ts

# PRE_TARGETDEPS +=

QMAKE_CXXFLAGS_RELEASE += -Ofast # -O3 -s
QMAKE_LFLAGS_RELEASE += -s
QMAKE_CXXFLAGS_DEBUG += -Dcimg_verbosity=3
Expand All @@ -492,7 +496,7 @@ CONFIG(debug, debug|release) {
# QMAKE_CXXFLAGS_DEBUG += -Wfatal-errors
}

equals(ASAN, "on" ) {
equals(ASAN,"on")|equals(ASAN,"ON") {
message(Address sanitizer enabled)
QMAKE_CXXFLAGS_DEBUG += -fsanitize=address
QMAKE_LFLAGS_DEBUG += -fsanitize=address
Expand Down
2 changes: 2 additions & 0 deletions gmic_qt.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<file>icons/dark/selection_mode.png</file>
<file>icons/dark/system-run.png</file>
<file>icons/dark/undo.png</file>
<file>icons/dark/user-trash.png</file>
<file>icons/dark/view-fullscreen.png</file>
<file>icons/dark/view-refresh.png</file>
<file>icons/dark/zoom-in.png</file>
Expand All @@ -40,6 +41,7 @@
<file>icons/selection_mode.png</file>
<file>icons/system-run.png</file>
<file>icons/undo.png</file>
<file>icons/user-trash.png</file>
<file>icons/view-fullscreen.png</file>
<file>icons/view-refresh.png</file>
<file>icons/zoom-in.png</file>
Expand Down
Binary file added icons/dark/user-trash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/user-trash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions scripts/travis_build_qmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,3 @@ echo "Building Gimp plugin"
qmake CONFIG+=${config} HOST=gimp GMIC_PATH=gmic-clone/src
make
make

echo "Building Krita plugin"
qmake CONFIG+=${config} HOST=krita GMIC_PATH=gmic-clone/src
make
make
2 changes: 1 addition & 1 deletion src/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
template <typename T> inline void unused(const T &, ...) {}

#ifdef _TIMING_ENABLED_
#define TIMING TimeLogger::getInstance()->step(__PRETTY_FUNCTION__, __LINE__, __FILE__)
#define TIMING GmicQt::TimeLogger::getInstance()->step(__PRETTY_FUNCTION__, __LINE__, __FILE__)
#else
#define TIMING \
if (false) \
Expand Down
11 changes: 4 additions & 7 deletions src/CroppedActiveLayerProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include <QDebug>
#include "Common.h"
#include "Host/GmicQtHost.h"
#ifndef gmic_core
#include "CImg.h"
#endif
#include "gmic.h"

namespace GmicQt
Expand All @@ -39,9 +36,9 @@ double CroppedActiveLayerProxy::_x = -1.0;
double CroppedActiveLayerProxy::_y = -1.0;
double CroppedActiveLayerProxy::_width = -1.0;
double CroppedActiveLayerProxy::_height = -1.0;
std::unique_ptr<cimg_library::CImg<gmic_pixel_type>> CroppedActiveLayerProxy::_cachedImage(new cimg_library::CImg<gmic_pixel_type>);
std::unique_ptr<gmic_library::gmic_image<gmic_pixel_type>> CroppedActiveLayerProxy::_cachedImage(new gmic_library::gmic_image<gmic_pixel_type>);

void CroppedActiveLayerProxy::get(cimg_library::CImg<gmic_pixel_type> & image, double x, double y, double width, double height)
void CroppedActiveLayerProxy::get(gmic_library::gmic_image<gmic_pixel_type> & image, double x, double y, double width, double height)
{
if ((x != _x) || (y != _y) || (width != _width) || (height != _height)) {
update(x, y, width, height);
Expand Down Expand Up @@ -70,8 +67,8 @@ void CroppedActiveLayerProxy::update(double x, double y, double width, double he
_width = width;
_height = height;

cimg_library::CImgList<gmic_pixel_type> images;
cimg_library::CImgList<char> imageNames;
gmic_library::gmic_list<gmic_pixel_type> images;
gmic_library::gmic_list<char> imageNames;
GmicQtHost::getCroppedImages(images, imageNames, _x, _y, _width, _height, InputMode::Active);
if (images.size() > 0) {
GmicQtHost::applyColorProfile(images.front());
Expand Down
12 changes: 6 additions & 6 deletions src/CroppedActiveLayerProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@
#include <memory>
#include "GmicQt.h"

namespace cimg_library
namespace gmic_library
{
template <typename T> struct CImg;
template <typename T> struct CImgList;
} // namespace cimg_library
template <typename T> struct gmic_image;
template <typename T> struct gmic_list;
} // namespace gmic_library

namespace GmicQt
{
class CroppedActiveLayerProxy {
public:
CroppedActiveLayerProxy() = delete;

static void get(cimg_library::CImg<gmic_pixel_type> & image, double x, double y, double width, double height);
static void get(gmic_library::gmic_image<gmic_pixel_type> & image, double x, double y, double width, double height);
static QSize getSize(double x, double y, double width, double height);
static void clear();

private:
static void update(double x, double y, double width, double height);
static std::unique_ptr<cimg_library::CImg<float>> _cachedImage;
static std::unique_ptr<gmic_library::gmic_image<float>> _cachedImage;
static double _x;
static double _y;
static double _width;
Expand Down
11 changes: 4 additions & 7 deletions src/CroppedImageListProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#include <cmath>
#include "Common.h"
#include "Host/GmicQtHost.h"
#ifndef gmic_core
#include "CImg.h"
#endif
#include "gmic.h"

namespace GmicQt
Expand All @@ -42,11 +39,11 @@ double CroppedImageListProxy::_width = -1.0;
double CroppedImageListProxy::_height = -1.0;
double CroppedImageListProxy::_zoom = 0.0;
InputMode CroppedImageListProxy::_inputMode = InputMode::Unspecified;
std::unique_ptr<cimg_library::CImgList<gmic_pixel_type>> CroppedImageListProxy::_cachedImageList(new cimg_library::CImgList<gmic_pixel_type>);
std::unique_ptr<cimg_library::CImgList<char>> CroppedImageListProxy::_cachedImageNames(new cimg_library::CImgList<char>);
std::unique_ptr<gmic_library::gmic_list<gmic_pixel_type>> CroppedImageListProxy::_cachedImageList(new gmic_library::gmic_list<gmic_pixel_type>);
std::unique_ptr<gmic_library::gmic_list<char>> CroppedImageListProxy::_cachedImageNames(new gmic_library::gmic_list<char>);

void CroppedImageListProxy::get(cimg_library::CImgList<gmic_pixel_type> & images, cimg_library::CImgList<char> & imageNames, double x, double y, double width, double height, InputMode mode,
double zoom)
void CroppedImageListProxy::get(gmic_library::gmic_list<gmic_pixel_type> & images, gmic_library::gmic_list<char> & imageNames,
double x, double y, double width, double height, InputMode mode, double zoom)
{
if ((x != _x) || (y != _y) || (width != _width) || (height != _height) || (mode != _inputMode) || (zoom != _zoom)) {
update(x, y, width, height, mode, zoom);
Expand Down
14 changes: 7 additions & 7 deletions src/CroppedImageListProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#include <memory>
#include "GmicQt.h"

namespace cimg_library
namespace gmic_library
{
template <typename T> struct CImg;
template <typename T> struct CImgList;
} // namespace cimg_library
template <typename T> struct gmic_image;
template <typename T> struct gmic_list;
} // namespace gmic_library

namespace GmicQt
{
Expand All @@ -41,13 +41,13 @@ class CroppedImageListProxy {
public:
CroppedImageListProxy() = delete;

static void get(cimg_library::CImgList<gmic_pixel_type> & images, cimg_library::CImgList<char> & imageNames, double x, double y, double width, double height, InputMode mode, double zoom);
static void get(gmic_library::gmic_list<gmic_pixel_type> & images, gmic_library::gmic_list<char> & imageNames, double x, double y, double width, double height, InputMode mode, double zoom);
static void update(double x, double y, double width, double height, InputMode mode, double zoom);
static void clear();

private:
static std::unique_ptr<cimg_library::CImgList<float>> _cachedImageList;
static std::unique_ptr<cimg_library::CImgList<char>> _cachedImageNames;
static std::unique_ptr<gmic_library::gmic_list<float>> _cachedImageList;
static std::unique_ptr<gmic_library::gmic_list<char>> _cachedImageNames;
static double _x;
static double _y;
static double _width;
Expand Down
Loading