Skip to content

Commit 2e21946

Browse files
committed
gimp-plugin-fix-ca 4.1 (July 19, 2024)
Discovered scripting didn't work with fix-ca, therefore fixed it. Discovered that sometime after Feb29 there was an update made which broke the MSYS2 build, this also turned-out to be a fix-ca.c issue. Tried to build a working make check, and also found some problems, such as scripting and exporting tga files. Issue reported upstream. - Fixed bug in fix-ca.c to run in non-interactive script mode. - Added make check due to testing non-interactive scripting mode. - Modify github workflow to work with no available display. - Updated rmp spec to run make check. Useful self-test.
1 parent d18c153 commit 2e21946

File tree

11 files changed

+81
-24
lines changed

11 files changed

+81
-24
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
choiceL: [--disable-silent-rules, --enable-silent-rules --enable-debugtime]
9+
choiceL: [--disable-silent-rules, --enable-silent-rules, --enable-debugtime]
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212
- name: Create configure
1313
run: |
1414
sudo apt-get update -y
15-
sudo apt-get install autoconf automake libtool gcc libgimp2.0-dev
15+
sudo apt-get install autoconf automake libtool gcc gimp libgimp2.0-dev
1616
autoreconf -i
1717
automake
1818
- name: Choose configure
@@ -22,6 +22,9 @@ jobs:
2222
- name: Test make strip
2323
if: matrix.choiceL == '--disable-silent-rules'
2424
run: make strip
25+
- name: Do a make check
26+
if: matrix.choiceL == '--enable-silent-rules'
27+
run: make check
2528
- name: Test user-level install/uninstall
2629
if: matrix.choiceL == '--disable-silent-rules'
2730
run: |
@@ -50,7 +53,7 @@ jobs:
5053
run:
5154
shell: msys2 {0}
5255
steps:
53-
- uses: actions/checkout@v4
56+
- uses: actions/checkout@v3
5457
- uses: msys2/setup-msys2@v2
5558
with:
5659
msystem: ${{ matrix.msystem }}
@@ -67,7 +70,7 @@ jobs:
6770
local:
6871
runs-on: ubuntu-latest
6972
steps:
70-
- uses: actions/checkout@v2
73+
- uses: actions/checkout@v3
7174
- name: Create configure
7275
run: |
7376
sudo apt-get update -y

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile.am - Top level automakefile for fix-ca
22

3-
SUBDIRS = . po
3+
SUBDIRS = . po tests
44

55
# The braces around ACLOCAL_FLAGS below instead of parentheses are intentional!
66
# Otherwise autoreconf misparses the line.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ make install
227227

228228
## Version History
229229

230+
- 4.1 (July 19, 2024) Upgraded code to work with 2.10.34 (broke in MSYS2). Fixed non-interactive scripting, added make check and updated other files for self-tests.
230231
- 4.0 (February 29, 2024) Upgraded code to use GIMP-2.10 API. Now Gimp-Fix-CA works with RGB/RGBA with precisions of 8bit, 16bit, 32bit, or double for each color of R,G,B,A. Also added Lens X/Y center and a lens centerline in the preview window. Local Language support now included for the installable Gimp-Fix-CA. This version is bumped to 4.0 since it requires GIMP-2.10.xx, and also because non-interactive scripting also requires Lateral Lens X/Y positions (default=-1,-1)
231232
- 3.0.4 (December 2, 2023) mostly edits around make system. Minimal mods to fix-ca.c code (which needs updating).
232233
- 3.0.3 (October 8, 2022) autoconf/automake/configure/make added for building fix.ca

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ AC_PREREQ([2.68])
2121
#
2222
m4_define([fix_ca_name], [gimp-fix-ca])
2323
m4_define([fix_ca_major_version], [4])
24-
m4_define([fix_ca_minor_version], [0])
24+
m4_define([fix_ca_minor_version], [1])
2525
m4_define([fix_ca_version],[fix_ca_major_version.fix_ca_minor_version])
2626
m4_define([fix_ca_package_name], [gimp-fix-ca])
2727
m4_define([fix_ca_package_home], [https://github.com/JoesCat/gimp-fix-ca])
@@ -51,8 +51,10 @@ AC_PROG_CC
5151
AC_PROG_SED
5252
AC_PROG_LN_S
5353
AC_PROG_MKDIR_P
54+
AC_PATH_PROG([CHMOD],[chmod],[:])
5455
AC_PATH_PROG([STRIP],[strip],[:])
5556
AC_PATH_PROG([GIMPTOOL],[gimptool-2.0],[:])
57+
AC_PATH_PROG([MD5SUM],[md5sum],[:])
5658
AC_PATH_PROG([MSGFMT],[msgfmt],[:])
5759
AC_PATH_PROG([MSGINIT],[msginit],[:])
5860
AC_PATH_PROG([MSGMERGE],[msgmerge],[:])
@@ -240,6 +242,7 @@ AH_BOTTOM([
240242
AC_CONFIG_FILES([
241243
Makefile
242244
po/Makefile
245+
tests/Makefile
243246
rpm/gimp-fix-ca.spec
244247
])
245248
AC_OUTPUT

fix-ca.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@
4949
#define N_(x) x
5050
#endif
5151

52+
#ifdef TEST_FIX_CA
53+
#define PROCEDURE_NAME "Test-Fix-CA"
54+
#else
5255
#define PROCEDURE_NAME "Fix-CA"
56+
#endif
5357
#define DATA_KEY_VALS "fix_ca"
5458

5559
/* Size controls in Fix CA dialog box */
@@ -104,7 +108,8 @@ static void fix_ca_region (guchar *srcPTR, guchar *dstPTR,
104108
gint x1, gint x2, gint y1, gint y2,
105109
gboolean show_progress);
106110
static gboolean fix_ca_dialog (gint32 drawable_ID, FixCaParams *params);
107-
static void preview_update (GimpPreview *preview, FixCaParams *params);
111+
//static void preview_update (GimpPreview *preview, FixCaParams *params);
112+
static void preview_update (GimpDrawablePreview *preview, FixCaParams *params);
108113
static int color_size (const Babl *format);
109114
static gdouble get_pixel (guchar *ptr, gint bpc);
110115
static void set_pixel (guchar *dest, gdouble d, gint bpc);
@@ -238,6 +243,8 @@ static void run (const gchar *name, gint nparams,
238243
#endif
239244
textdomain( GETTEXT_PACKAGE );
240245
#endif
246+
gegl_init (NULL, NULL);
247+
241248
switch (run_mode) {
242249
case GIMP_RUN_NONINTERACTIVE:
243250
fix_ca_params.blue = param[3].data.d_float;
@@ -317,6 +324,8 @@ static void run (const gchar *name, gint nparams,
317324
}
318325
}
319326

327+
gegl_exit ();
328+
320329
values[0].data.d_status = status;
321330
}
322331

@@ -348,8 +357,6 @@ static int fix_ca (gint32 drawable_ID, FixCaParams *params)
348357
return -1;
349358
}
350359

351-
//gegl_init (NULL, NULL);
352-
353360
/* fetch pixel regions and setup shadow buffer */
354361
srcBuf = gimp_drawable_get_buffer (drawable_ID);
355362
destBuf = gimp_drawable_get_shadow_buffer (drawable_ID);
@@ -377,8 +384,6 @@ static int fix_ca (gint32 drawable_ID, FixCaParams *params)
377384
gimp_drawable_merge_shadow (drawable_ID, TRUE);
378385
gimp_drawable_update (drawable_ID, x, y, width, height);
379386

380-
//gegl_exit ();
381-
382387
#ifdef DEBUG_TIME
383388
gettimeofday(&tv2, NULL);
384389

@@ -393,7 +398,7 @@ static gboolean fix_ca_dialog (gint32 drawable_ID, FixCaParams *params)
393398
GtkWidget *dialog;
394399
GtkWidget *main_vbox;
395400
GtkWidget *combo;
396-
GtkWidget *preview;
401+
GtkWidget *preview; /* GimpDrawablePreview widget */
397402
GtkWidget *table;
398403
GtkWidget *frame;
399404
GtkObject *adj;
@@ -609,19 +614,23 @@ static gboolean fix_ca_dialog (gint32 drawable_ID, FixCaParams *params)
609614
return run;
610615
}
611616

612-
static void preview_update (GimpPreview *preview, FixCaParams *params)
617+
//static void preview_update (GtkWidget *widget, FixCaParams *params)
618+
static void preview_update (GimpDrawablePreview *preview, FixCaParams *params)
613619
{
620+
GimpPreview *ptr;
614621
gint32 preview_ID;
615622
gint b, i, j, x, y, width, height, xImg, yImg, bppImg, bpcImg, size;
616623
GeglBuffer *srcBuf;
617624
guchar *srcImg, *destImg, *prevImg;
618625
const Babl *format;
619626
gdouble d;
620627

621-
preview_ID = gimp_drawable_preview_get_drawable_id (preview);
628+
/* GimpPreview is a subset of GimpScrolledPreview */
629+
ptr = (GimpPreview *)(preview);
630+
gimp_preview_get_position (ptr, &x, &y);
631+
gimp_preview_get_size (ptr, &width, &height);
622632

623-
gimp_preview_get_position (preview, &x, &y);
624-
gimp_preview_get_size (preview, &width, &height);
633+
preview_ID = gimp_drawable_preview_get_drawable_id (preview);
625634

626635
format = gimp_drawable_get_format (preview_ID);
627636
bppImg = babl_format_get_bytes_per_pixel(format);
@@ -661,7 +670,7 @@ static void preview_update (GimpPreview *preview, FixCaParams *params)
661670
}
662671
}
663672

664-
gimp_preview_draw_buffer (preview, prevImg, width * bppImg/b);
673+
gimp_preview_draw_buffer (ptr, prevImg, width * bppImg/b);
665674

666675
g_object_unref (srcBuf);
667676
g_free(prevImg);

org.gimp.extension.fix-ca.metainfo.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
<metadata_license>CC0-1.0</metadata_license>
3939
<project_license>GPL-3.0+</project_license>
4040
<releases>
41-
<release version="4.0" date="2024-02-24" />
41+
<release version="4.1" date="2024-07-19" />
42+
<release version="4.0" date="2024-02-29" />
4243
<release version="3.0.4" date="2023-12-02" />
4344
<release version="3.0.3" date="2022-10-09" />
4445
</releases>

rpm/gimp-fix-ca.spec.in

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
%define moname gimp20-fix-ca
55
%define plugindir %{_libdir}/gimp/2.0/plug-ins/fix-ca
66

7-
Name: @FIX_CA_PACKAGE_NAME@
7+
Name: gimp-fix-ca
88
Version: @FIX_CA_VERSION@
99
Release: 0
1010
Summary: A Gimp2 plugin for correcting Chromatic Aberration (CA)
1111
License: GPLv3+
1212
Group: Graphics/Editors and Converters
1313
URL: https://github.com/JoesCat/gimp-fix-ca
14-
Source0: https://github.com/JoesCat/gimp-fix-ca/releases/download/%{version}/%{name}-%{version}.tar.gz
14+
Source0: https://github.com/JoesCat/gimp-fix-ca/archive/%{version}/gimp-fix-ca-%{version}.tar.gz
1515

1616
BuildRequires: autoconf
1717
BuildRequires: automake
@@ -22,14 +22,12 @@ BuildRequires: gtk+2-devel
2222
BuildRequires: pkgconfig(gimp-2.0)
2323
Requires: gimp >= 2.10.0
2424

25-
2625
%description
2726
A Gimp2 plug-in to correct Chromatic Aberration (CA).
2827
Fix-CA can fix Lateral CA caused due to light travelling through lenses,
2928
and fix Directional CA due to light travelling through dense material
3029
such as glass or water.
3130

32-
3331
%prep
3432
%setup -q
3533

@@ -39,13 +37,14 @@ automake --add-missing
3937
%configure
4038
%make_build
4139

40+
%check
41+
make check
4242

4343
%install
4444
%make_install INSTALLDIR="%{buildroot}/%{plugindir}" \
4545
LOCALEDIR="%{buildroot}/%{_datadir}/locale"
4646
%find_lang %{moname}
4747

48-
4948
%files -f %{moname}.lang
5049
%license COPYING
5150
%{plugindir}/fix-ca

tests/Makefile.am

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
AM_CFLAGS = ${CFLAGS} ${CPPFLAGS} ${GIMP_CFLAGS} ${GTK_CFLAGS} ${WCFLAGS} ${FCA_CFLAGS} -I${top_srcdir} -I${top_builddir}
2+
3+
AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} ${GIMP_CFLAGS} -I${includedir}
4+
5+
EXTRA_DIST = test-fix-ca.c test-fix-ca.scm test1.md5
6+
7+
noinst_PROGRAMS = test-fix-ca
8+
test_fix_ca_name = test-fix-ca
9+
test_fix_ca_SOURCES = test-fix-ca.c
10+
test_fix_ca.$(OBJEXT): fix-ca-config.h
11+
test_fix_ca_LDADD = ${LIBS} ${GIMP_LIBS} ${GTK_LIBS} ${WSLIB} ${FCA_LIB}
12+
13+
update-tests:
14+
echo "#!/bin/sh" > ${builddir}/test1.sh; \
15+
echo "rm -f ${builddir}/test1.tga" >> ${builddir}/test1.sh; \
16+
echo "${GIMPTOOL} --install-script ${srcdir}/test-fix-ca.scm" >> ${builddir}/test1.sh; \
17+
echo "${GIMPTOOL} --install-bin ${builddir}/test-fix-ca" >> ${builddir}/test1.sh; \
18+
echo "gimp --verbose --console-messages -i -b '(test \"${top_srcdir}/img-fix-ca/full-branches.jpg\" \"${builddir}/test1.bmp\" 6.0 -2.4 658 1280 1 0.0 0.0 0.0 0.0)' -b '(gimp-quit 0)'" >> ${builddir}/test1.sh; \
19+
echo "${GIMPTOOL} --uninstall-bin test-fix-ca" >> ${builddir}/test1.sh; \
20+
echo "${GIMPTOOL} --uninstall-script test-fix-ca.scm" >> ${builddir}/test1.sh; \
21+
echo "${MD5SUM} -c ${top_srcdir}/tests/test1.md5" >> ${builddir}/test1.sh; \
22+
${CHMOD} +x ${builddir}/test1.sh
23+
24+
TESTS = ${builddir}/test1.sh
25+
26+
test1.sh:
27+
make update-tests
28+
29+
clean-local:
30+
rm -f ${builddir}/test?.sh ${builddir}/test?.bmp
31+
32+
.PHONY: update-tests

tests/test-fix-ca.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define TEST_FIX_CA 1
2+
#include "../fix-ca.c"

tests/test-fix-ca.scm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(define (test filename result bluel redl lensx lensy interpolation bluex redx bluey redy)
2+
(define image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
3+
(define drawable (car (gimp-image-get-active-layer image)))
4+
(Test-Fix-CA RUN-NONINTERACTIVE image drawable bluel redl lensx lensy interpolation bluex redx bluey redy)
5+
(gimp-file-save RUN-NONINTERACTIVE image drawable result result)
6+
(gimp-image-delete image))

tests/test1.md5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c472550cda23c8cb717853ac0dd93e2b test1.bmp

0 commit comments

Comments
 (0)