mirror of https://github.com/GNOME/gimp.git
new plugins
This commit is contained in:
parent
0a3f8a2d7b
commit
6263c616ab
|
@ -1,3 +1,7 @@
|
|||
Fri Jan 21 00:24:19 CET 2000 Stanislav Brabec <utx@penguin.cz>
|
||||
|
||||
plug-ins/rcm/rcm.c: Typo fix.
|
||||
|
||||
Thu Jan 20 23:28:35 CET 2000 Stanislav Brabec <utx@penguin.cz>
|
||||
|
||||
Added new plug-ins from Martin Weber <martweb@gmx.net>:
|
||||
|
|
|
@ -718,6 +718,7 @@ plug-ins/gfig/gfig-examples/Makefile
|
|||
plug-ins/gflare/Makefile
|
||||
plug-ins/gflare/gflares/Makefile
|
||||
plug-ins/gfli/Makefile
|
||||
plug-ins/gimp_ace/Makefile
|
||||
plug-ins/gimpressionist/Makefile
|
||||
plug-ins/gimpressionist/Brushes/Makefile
|
||||
plug-ins/gimpressionist/Paper/Makefile
|
||||
|
|
|
@ -76,6 +76,7 @@ libexec_PROGRAMS = \
|
|||
iwarp \
|
||||
jigsaw \
|
||||
$(JPEG) \
|
||||
kaleidoscope \
|
||||
laplace \
|
||||
lic \
|
||||
mail \
|
||||
|
@ -683,6 +684,15 @@ jpeg_LDADD = \
|
|||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
kaleidoscope_SOURCES = \
|
||||
kaleidoscope.c
|
||||
|
||||
kaleidoscope_LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GLIB_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
laplace_SOURCES = \
|
||||
laplace.c
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,12 @@
|
|||
Alex Stark <stark@niss.org>:
|
||||
Adaptive Contrast Enhancement algorithm and implementation.
|
||||
(in files: glace*)
|
||||
|
||||
Kevin Turner <kevint@poboxes.com>:
|
||||
GIMP plug-in wrapper for the above.
|
||||
(in files: dialog.c gimp_ace.*)
|
||||
|
||||
Please direct all comments and queries regarding the GIMP plug-in to
|
||||
Kevin Turner. Inquiries about other implementations of Adaptive
|
||||
Contrast Enhancement, or about the process itself may be directed to
|
||||
Alex Stark.
|
|
@ -0,0 +1,79 @@
|
|||
1999-12-31 Kevin Turner <kevint@poboxes.com>
|
||||
|
||||
* glace.c, glace.h: Eliminated COLOR_CLASSIC... it's not smart
|
||||
enough to survive.
|
||||
|
||||
* glace.c (Glace_Output): Changed COLOR_LUMIN to use the
|
||||
coefficients from color.h to compute Y. This is more consistant
|
||||
with the decomposition in gimp_ace.c (SeperateChannels).
|
||||
|
||||
* configure.in: Bumped version to 0.5.0.
|
||||
|
||||
* dialog.c (ace_dialog): use option menu for color method, not
|
||||
radio buttons.
|
||||
|
||||
1999-12-30 Kevin Turner <kevint@poboxes.com>
|
||||
|
||||
* glace.c (Glace_Output): Color method now configurable at runtime
|
||||
instead of compile-time #ifdefs.
|
||||
|
||||
* gimp_ace.c (SeperateChannels): The color space in which channels
|
||||
are seperated now depends on color_method.
|
||||
|
||||
* glace.h: put back the RGB image pointers for use with other
|
||||
color methods
|
||||
|
||||
* gimp_ace.c (acevals =): Added color_method member to initializer.
|
||||
|
||||
* dialog.c (radio_callback): new function
|
||||
(ace_dialog): add radio buttons for selecting color_method.
|
||||
|
||||
* glace.h (Glace_CfgInfo): added enum type Glace_ColorMethods, and
|
||||
added member colorMethod to Glace_CfgInfo struct.
|
||||
|
||||
* gimp_ace.h: include glace.h for Glace_ColorMethods, add
|
||||
color_method to AceValues struct.
|
||||
|
||||
* glace.c (Glace_FillTableForNotFilt): merge some casting changes
|
||||
from Alex
|
||||
|
||||
* gimp_ace.c (query): Change menu path.
|
||||
|
||||
1999-10-03 Kevin Turner <kevint@poboxes.com>
|
||||
|
||||
* glace.c, glace.h: Merged with Alex's "ace-not-gimp.zip" of 27-Sep-99
|
||||
That just means sifting in the #ifdefs... Still TODO is to take a
|
||||
good look at Glace_Output again and merge for real.
|
||||
|
||||
1999-07-21 Kevin Turner <kevint@poboxes.com>
|
||||
|
||||
* dialog.c (ace_dialog_new): change asprintf to g_strdup_printf
|
||||
(ace_dialog): Add toggle to link strength and bradj values
|
||||
* gimp_ace.c, gimp_ace.h: add link boolean to AceValues
|
||||
|
||||
1999-07-20 Kevin Turner <kevint@poboxes.com>
|
||||
|
||||
* glace.c (Glace_Output): Change the color output routine to use a
|
||||
Yxy chromacity system.
|
||||
|
||||
* color.h: Add constants for RGB <-> XYZ conversion matricies.
|
||||
|
||||
* gimp_ace.c (SeperateChannels): Seperation of rgb color to xy
|
||||
chromathings is now done here, not in GlaceOutput. This means we
|
||||
don't seperate out RGB channels into seperate buffers, but fill in
|
||||
two buffers for x and y. The luminosity buffer (the one which
|
||||
gets operated on) is handled the same way as previously.
|
||||
|
||||
* glace.h: {R,G,B}Ptr is gone, replaced by C{x,y}Ptr
|
||||
|
||||
1999-07-19 Kevin Turner <kevint@poboxes.com>
|
||||
|
||||
* Makefile.am, configure.in: first attempt at auto{make,conf}
|
||||
|
||||
* gimp_ace.c (do_ace): implement configurability options with
|
||||
acevals to cfgInfoPtr.
|
||||
(run): Add switch(run_mode) to call interactive
|
||||
interface, etc.
|
||||
|
||||
* dialog.c: new file
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
libexecdir = $(gimpplugindir)/plug-ins
|
||||
|
||||
libexec_PROGRAMS = gimp_ace
|
||||
|
||||
gimp_ace_SOURCES = \
|
||||
gimp_ace.c \
|
||||
gimp_ace.h \
|
||||
glace.c \
|
||||
glace.h \
|
||||
glaceG.c \
|
||||
glaceInt.h \
|
||||
dialog.c \
|
||||
color.h \
|
||||
acconfig.h
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DGLACE_GIMP \
|
||||
-DVERSION=\"0.5.0\"
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
|
@ -0,0 +1,483 @@
|
|||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AA = @AA@
|
||||
AS = @AS@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EMACS = @EMACS@
|
||||
EXTENSIVE_TESTS = @EXTENSIVE_TESTS@
|
||||
GAP_DECODE_MPEG = @GAP_DECODE_MPEG@
|
||||
GENCAT = @GENCAT@
|
||||
GIMP = @GIMP@
|
||||
GIMPDOCS = @GIMPDOCS@
|
||||
GIMPINSTALL = @GIMPINSTALL@
|
||||
GIMPTOOL = @GIMPTOOL@
|
||||
GIMP_CFLAGS = @GIMP_CFLAGS@
|
||||
GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@
|
||||
GIMP_LIBS = @GIMP_LIBS@
|
||||
GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@
|
||||
GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@
|
||||
GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@
|
||||
GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@
|
||||
GIMP_MODULES = @GIMP_MODULES@
|
||||
GIMP_MP_FLAGS = @GIMP_MP_FLAGS@
|
||||
GIMP_MP_LIBS = @GIMP_MP_LIBS@
|
||||
GIMP_PERL = @GIMP_PERL@
|
||||
GIMP_PLUGINS = @GIMP_PLUGINS@
|
||||
GIMP_THREAD_FLAGS = @GIMP_THREAD_FLAGS@
|
||||
GIMP_THREAD_LIBS = @GIMP_THREAD_LIBS@
|
||||
GIMP_VERSION = @GIMP_VERSION@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GNOME_CONFIG = @GNOME_CONFIG@
|
||||
GTKXMHTML_CFLAGS = @GTKXMHTML_CFLAGS@
|
||||
GTKXMHTML_LIBS = @GTKXMHTML_LIBS@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_CONFIG = @GTK_CONFIG@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
HELPBROWSER = @HELPBROWSER@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
IN_GIMP = @IN_GIMP@
|
||||
JPEG = @JPEG@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBAA = @LIBAA@
|
||||
LIBJPEG = @LIBJPEG@
|
||||
LIBMPEG = @LIBMPEG@
|
||||
LIBPNG = @LIBPNG@
|
||||
LIBTIFF = @LIBTIFF@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBUCB = @LIBUCB@
|
||||
LIBXMU = @LIBXMU@
|
||||
LIBXPM = @LIBXPM@
|
||||
LIBZ = @LIBZ@
|
||||
LN_S = @LN_S@
|
||||
LPC_COMMAND = @LPC_COMMAND@
|
||||
LPC_DEF = @LPC_DEF@
|
||||
LPR_COMMAND = @LPR_COMMAND@
|
||||
LPR_DEF = @LPR_DEF@
|
||||
LPSTAT_COMMAND = @LPSTAT_COMMAND@
|
||||
LPSTAT_DEF = @LPSTAT_DEF@
|
||||
LP_COMMAND = @LP_COMMAND@
|
||||
LP_DEF = @LP_DEF@
|
||||
LT_AGE = @LT_AGE@
|
||||
LT_CURRENT = @LT_CURRENT@
|
||||
LT_RELEASE = @LT_RELEASE@
|
||||
LT_REVISION = @LT_REVISION@
|
||||
MAILER = @MAILER@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MPEG = @MPEG@
|
||||
MSGFMT = @MSGFMT@
|
||||
NM = @NM@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
PNG = @PNG@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
PSP = @PSP@
|
||||
PYGIMP_CFLAGS_NOUI = @PYGIMP_CFLAGS_NOUI@
|
||||
PYGIMP_LIBS_NOUI = @PYGIMP_LIBS_NOUI@
|
||||
PYTHON = @PYTHON@
|
||||
PYTHON_CFLAGS = @PYTHON_CFLAGS@
|
||||
PYTHON_INCLUDES = @PYTHON_INCLUDES@
|
||||
PYTHON_LINK = @PYTHON_LINK@
|
||||
RANLIB = @RANLIB@
|
||||
SENDMAIL = @SENDMAIL@
|
||||
SO = @SO@
|
||||
TIFF = @TIFF@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WEBBROWSER = @WEBBROWSER@
|
||||
XJT = @XJT@
|
||||
XPM = @XPM@
|
||||
brushdata = @brushdata@
|
||||
gimpdatadir = @gimpdatadir@
|
||||
gimpdir = @gimpdir@
|
||||
gimpplugindir = @gimpplugindir@
|
||||
gradientdata = @gradientdata@
|
||||
l = @l@
|
||||
localedir = @localedir@
|
||||
palettedata = @palettedata@
|
||||
patterndata = @patterndata@
|
||||
prefix = @prefix@
|
||||
pyexecdir = @pyexecdir@
|
||||
pythondir = @pythondir@
|
||||
|
||||
libexecdir = $(gimpplugindir)/plug-ins
|
||||
|
||||
libexec_PROGRAMS = gimp_ace
|
||||
|
||||
gimp_ace_SOURCES = \
|
||||
gimp_ace.c \
|
||||
gimp_ace.h \
|
||||
glace.c \
|
||||
glace.h \
|
||||
glaceG.c \
|
||||
glaceInt.h \
|
||||
dialog.c \
|
||||
color.h \
|
||||
acconfig.h
|
||||
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DGLACE_GIMP \
|
||||
-DVERSION=\"0.5.0\"
|
||||
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(libexec_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I../..
|
||||
LIBS = @LIBS@
|
||||
gimp_ace_OBJECTS = gimp_ace.o glace.o glaceG.o dialog.o
|
||||
gimp_ace_LDADD = $(LDADD)
|
||||
gimp_ace_DEPENDENCIES = $(top_builddir)/libgimp/libgimp.la
|
||||
gimp_ace_LDFLAGS =
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = README AUTHORS ChangeLog Makefile.am Makefile.in NEWS \
|
||||
TODO
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/dialog.P .deps/gimp_ace.P .deps/glace.P \
|
||||
.deps/glaceG.P
|
||||
SOURCES = $(gimp_ace_SOURCES)
|
||||
OBJECTS = $(gimp_ace_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/gimp_ace/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libexecPROGRAMS:
|
||||
|
||||
clean-libexecPROGRAMS:
|
||||
-test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS)
|
||||
|
||||
distclean-libexecPROGRAMS:
|
||||
|
||||
maintainer-clean-libexecPROGRAMS:
|
||||
|
||||
install-libexecPROGRAMS: $(libexec_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libexecdir)
|
||||
@list='$(libexec_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libexecPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(libexec_PROGRAMS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
done
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
gimp_ace: $(gimp_ace_OBJECTS) $(gimp_ace_DEPENDENCIES)
|
||||
@rm -f gimp_ace
|
||||
$(LINK) $(gimp_ace_LDFLAGS) $(gimp_ace_OBJECTS) $(gimp_ace_LDADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = plug-ins/gimp_ace
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu plug-ins/gimp_ace/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-libexecPROGRAMS
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libexecPROGRAMS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libexecdir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-libexecPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-libexecPROGRAMS clean-compile clean-libtool clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-libexecPROGRAMS distclean-compile \
|
||||
distclean-libtool distclean-tags distclean-depend \
|
||||
distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libexecPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-depend \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-libexecPROGRAMS distclean-libexecPROGRAMS \
|
||||
clean-libexecPROGRAMS maintainer-clean-libexecPROGRAMS \
|
||||
uninstall-libexecPROGRAMS install-libexecPROGRAMS mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,30 @@
|
|||
0.5.0, 12/31/1999:
|
||||
|
||||
* The method used to reconstitute colors is now selectable from the
|
||||
dialog. The operational description used for Alex's method is "add
|
||||
white", while the method from 0.4.990720 is called "limit". Better
|
||||
translations are always apprecaite.
|
||||
|
||||
0.4.991003:
|
||||
|
||||
* Merged with Alex's update in theory, little changed in practice.
|
||||
|
||||
0.4.990721:
|
||||
|
||||
* Button to link strength and brightness adjust.
|
||||
|
||||
0.4.990720:
|
||||
|
||||
* Color image handling changed. No more frost, but red is weird.
|
||||
|
||||
0.4.990719:
|
||||
|
||||
* Addition of a user interface to fiddle with the options.
|
||||
|
||||
* gettext support in place (I hope). Translations appreciated.
|
||||
|
||||
* The coefficients used in the RGB -> luminosity conversion changed.
|
||||
See file "color.h"
|
||||
|
||||
* I wrote some help-text to go with the interface.
|
||||
http://www.oberlin.edu/~kturner/gimp/ace/gimp_ace-help.html
|
|
@ -0,0 +1,29 @@
|
|||
Adaptive Contrast Enhancement plug-in for the GIMP 1.x
|
||||
======================================================
|
||||
|
||||
FIXME: I still need a good concise, non-technical description of what
|
||||
this plug-in does in comparison to the other "Enhance Contrast"
|
||||
operations.
|
||||
|
||||
Technical Details
|
||||
=================
|
||||
|
||||
Adaptive Image Contrast Enhancement using Generalizations of Histogram
|
||||
Equalization
|
||||
J.A. Stark, NISS (January 1999).
|
||||
(FIXME: ¿published in IEEE Transactions on Image Processing?)
|
||||
http://www.niss.org/~stark/pubs.html
|
||||
|
||||
References
|
||||
==========
|
||||
|
||||
GIMP is the GNU Image Manipulation Program
|
||||
http://www.gimp.org/
|
||||
|
||||
The GIMP Plug-in Registry is at
|
||||
http://registry.gimp.org/
|
||||
|
||||
You can find Adaptive Contrast Enhancement at
|
||||
http://www.poboxes.com/kevint/gimp/gimp_ace.html
|
||||
|
||||
-- Kevin Turner <kevint@poboxes.com>
|
|
@ -0,0 +1,5 @@
|
|||
* fix 'make install'
|
||||
* Add preview
|
||||
* Merge with Alex on Glace_Output, add switch for how to handle out-of-gamut
|
||||
colors (either preserve-luma or preserve-chroma)
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/* These are the weighing factors used to convert color images to
|
||||
the one-dimensional channel (luminosity?) to operate on
|
||||
in gimp_ace.c:SeperateChannels()
|
||||
They're recombined in glace.c:Glace_Output(),
|
||||
which should undergo some scrutiny. */
|
||||
/* For more on this subject, see the thread in gimp-developer
|
||||
From: Carey Bunks <cbunks@bbn.com>
|
||||
Subject: [gimp-devel] Conversion to Grayscale Bug
|
||||
and http://www.inforamp.net/~poynton/ */
|
||||
|
||||
#ifndef NTSC_RGB
|
||||
|
||||
/* These are used to compute CIE luminace from linear RGB for
|
||||
contemporary CRT phosphors, as specified in ITU-R Recommendation
|
||||
BT.709 (formerly CCIR Rec. 709) */
|
||||
|
||||
/* Matrix for RGB -> XYZ conversion. */
|
||||
|
||||
#define X_r 0.412453
|
||||
#define X_g 0.357580
|
||||
#define X_b 0.180423
|
||||
|
||||
#define Y_r 0.212671
|
||||
#define Y_g 0.715160
|
||||
#define Y_b 0.072169
|
||||
|
||||
#define Z_r 0.019334
|
||||
#define Z_g 0.119193
|
||||
#define Z_b 0.950227
|
||||
|
||||
/* Matrix for XYZ -> RGB version. */
|
||||
|
||||
#define R_x 3.240479
|
||||
#define R_y -1.537150
|
||||
#define R_z -0.498535
|
||||
|
||||
#define G_x -0.969256
|
||||
#define G_y 1.876992
|
||||
#define G_z 0.041556
|
||||
|
||||
#define B_x 0.055648
|
||||
#define B_y -0.204043
|
||||
#define B_z 1.057311
|
||||
|
||||
#else
|
||||
|
||||
/* This computes luma from RGB, according to NTSC RGB CRT phosphors of
|
||||
1953. Standardized in ITU-R Recommendation BT.601-4. (formerly
|
||||
CCIR Rec. 601) */
|
||||
|
||||
#define Y_r 0.299
|
||||
#define Y_g 0.587
|
||||
#define Y_b 0.114
|
||||
|
||||
#endif
|
|
@ -0,0 +1,503 @@
|
|||
/* dialog.c: user interface for GIMP Adaptive Contrast Enhancment plug-in */
|
||||
/* Copyright (C) 1999 Kevin M. Turner <kevint@poboxes.com> */
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. See the file COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h> /* autostuff */
|
||||
|
||||
#include <stdio.h> /* for asprintf(wintitle,...) */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <libgimp/gimp.h>
|
||||
|
||||
#include <libintl.h> /* i18n - gettext */
|
||||
#define _(String) gettext (String)
|
||||
#ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
#else
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
#include "gimp_ace.h" /* AceValues */
|
||||
|
||||
static void ok_callback (GtkWidget *widget, gpointer data);
|
||||
static void close_callback (GtkWidget *widget, gpointer data);
|
||||
static GtkWidget *ace_dialog_new(GtkSignalFunc ok_callback,
|
||||
GtkSignalFunc close_callback,
|
||||
gboolean *go_ahead);
|
||||
static void adjust_double_changed (GtkAdjustment *adj,
|
||||
gpointer *unused);
|
||||
static void adjust_uint_changed (GtkAdjustment *adj,
|
||||
gpointer *unused);
|
||||
|
||||
static void omenu_callback (GtkWidget *menuitem,
|
||||
gpointer data);
|
||||
|
||||
static void toggled_cb (GtkToggleButton *toggle,
|
||||
gboolean *data);
|
||||
|
||||
static void strength_changed (GtkAdjustment *strength_adj,
|
||||
GtkAdjustment *bradj_adj);
|
||||
static void bradj_changed (GtkAdjustment *bradj_adj,
|
||||
gpointer unused);
|
||||
|
||||
#define SPACING 4
|
||||
#define HBOX_SPACING SPACING
|
||||
#define DIALOG_BORDER_WIDTH 0
|
||||
#define OUTER_BORDER_WIDTH 6
|
||||
#define ACTION_AREA_BORDER_WIDTH OUTER_BORDER_WIDTH
|
||||
#define TOP_AREA_BORDER_WIDTH OUTER_BORDER_WIDTH
|
||||
#define TABLE_ROW_SPACING SPACING
|
||||
#define TABLE_COL_SPACING SPACING
|
||||
|
||||
#define SPIN_ATTOPT_X GTK_EXPAND | GTK_FILL
|
||||
#define SPIN_ATTOPT_Y 0
|
||||
|
||||
#define SCALE_ATTOPT_X GTK_EXPAND | GTK_FILL
|
||||
#define SCALE_ATTOPT_Y 0
|
||||
|
||||
#define LABEL_ATTOPT 0
|
||||
|
||||
gboolean ace_dialog(guint32 drawable_id, AceValues *acevals)
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *table1;
|
||||
GtkObject *bradj_scale_adj;
|
||||
GtkWidget *bradj_scale;
|
||||
GtkObject *strength_scale_adj;
|
||||
GtkWidget *strength_scale;
|
||||
GtkWidget *link_toggle;
|
||||
GtkWidget *label;
|
||||
GtkWidget *hseparator;
|
||||
GtkWidget *table2;
|
||||
GtkObject *iter_spin_adj;
|
||||
GtkWidget *iter_spin;
|
||||
GtkObject *size_spin_adj;
|
||||
GtkWidget *size_spin;
|
||||
GtkObject *smooth_spin_adj;
|
||||
GtkWidget *smooth_spin;
|
||||
GtkObject *foobarum_spin_adj;
|
||||
GtkWidget *foobarum_spin;
|
||||
|
||||
GtkTooltips *tooltips;
|
||||
|
||||
GtkWidget *menuitem, *color_menu, *color_omenu;
|
||||
GtkWidget *frame;
|
||||
|
||||
gboolean go_ahead=FALSE;
|
||||
|
||||
#if 0
|
||||
printf("Waiting... (pid %d)\n", getpid());
|
||||
kill(getpid(), 19);
|
||||
#endif
|
||||
|
||||
/* Standard gimp_dialog creation. */
|
||||
dlg = ace_dialog_new((GtkSignalFunc) ok_callback,
|
||||
(GtkSignalFunc) close_callback,
|
||||
&go_ahead);
|
||||
|
||||
tooltips=gtk_tooltips_new();
|
||||
|
||||
/* Neato Box */
|
||||
vbox1 = gtk_vbox_new (FALSE, SPACING);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox),vbox1,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox1),
|
||||
TOP_AREA_BORDER_WIDTH);
|
||||
|
||||
/* Table which holds sliders */
|
||||
table1 = gtk_table_new (2, 3, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table1), SPACING);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table1), SPACING);
|
||||
|
||||
/* slider: strength */
|
||||
strength_scale_adj=gtk_adjustment_new (acevals->strength,
|
||||
0, 1, 0.01, 0.1, 0);
|
||||
strength_scale = gtk_hscale_new (GTK_ADJUSTMENT (strength_scale_adj));
|
||||
gtk_widget_set_name (strength_scale, "strength_scale");
|
||||
gtk_table_attach (GTK_TABLE (table1), strength_scale, 1, 2, 0, 1,
|
||||
SCALE_ATTOPT_X, SCALE_ATTOPT_Y,
|
||||
0, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (strength_scale), GTK_POS_LEFT);
|
||||
gtk_scale_set_digits (GTK_SCALE (strength_scale), 2);
|
||||
gtk_range_set_update_policy (GTK_RANGE (strength_scale),
|
||||
GTK_UPDATE_DELAYED);
|
||||
|
||||
/* slider: Brightness adjust */
|
||||
bradj_scale_adj=gtk_adjustment_new (acevals->bradj,
|
||||
0, 1, 0.01, 0.1, 0);
|
||||
bradj_scale = gtk_hscale_new (GTK_ADJUSTMENT (bradj_scale_adj));
|
||||
gtk_widget_set_name (bradj_scale, "bradj_scale");
|
||||
gtk_table_attach (GTK_TABLE (table1), bradj_scale, 1, 2, 1, 2,
|
||||
SCALE_ATTOPT_X, SCALE_ATTOPT_Y,
|
||||
0, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (bradj_scale), GTK_POS_LEFT);
|
||||
gtk_scale_set_digits (GTK_SCALE (bradj_scale), 2);
|
||||
gtk_range_set_update_policy (GTK_RANGE (bradj_scale),
|
||||
GTK_UPDATE_DELAYED);
|
||||
|
||||
/* Link toggle */
|
||||
link_toggle = gtk_toggle_button_new_with_label(_("Link"));
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(link_toggle),
|
||||
acevals->link);
|
||||
gtk_signal_connect (GTK_OBJECT(link_toggle),"toggled",
|
||||
GTK_SIGNAL_FUNC(toggled_cb),
|
||||
&(acevals->link));
|
||||
gtk_table_attach (GTK_TABLE (table1), link_toggle, 2, 3, 0, 2,
|
||||
LABEL_ATTOPT, LABEL_ATTOPT,
|
||||
0, 0);
|
||||
|
||||
/* Callbacks for above adjustments */
|
||||
gtk_object_set_user_data(GTK_OBJECT(strength_scale_adj),
|
||||
&(acevals->strength));
|
||||
gtk_signal_connect (GTK_OBJECT (strength_scale_adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (strength_changed),
|
||||
bradj_scale_adj);
|
||||
|
||||
gtk_object_set_user_data(GTK_OBJECT(bradj_scale_adj),
|
||||
&(acevals->bradj));
|
||||
gtk_object_set_data(GTK_OBJECT(bradj_scale_adj),
|
||||
"link", link_toggle);
|
||||
gtk_signal_connect (GTK_OBJECT (bradj_scale_adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (bradj_changed),
|
||||
NULL);
|
||||
|
||||
/* Labels for brightness adjust and strength */
|
||||
label = gtk_label_new (_("Strength:"));
|
||||
gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 0, 1,
|
||||
LABEL_ATTOPT, LABEL_ATTOPT,
|
||||
0, 0);
|
||||
|
||||
label = gtk_label_new (_("Brightness Adjust:"));
|
||||
gtk_table_attach (GTK_TABLE (table1), label, 0, 1, 1, 2,
|
||||
LABEL_ATTOPT, LABEL_ATTOPT,
|
||||
0, 0);
|
||||
|
||||
/* Seperator */
|
||||
hseparator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hseparator, FALSE, FALSE, 0);
|
||||
|
||||
/* Table which holds spinbuttons */
|
||||
/* (iterations, size, threshold) */
|
||||
|
||||
table2 = gtk_table_new (2, 4, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), table2, TRUE, TRUE, 0);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table2), SPACING);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table2), SPACING);
|
||||
|
||||
/* Iteration spin */
|
||||
iter_spin_adj = gtk_adjustment_new (acevals->iterations,
|
||||
1, 200, 1, 10, 0);
|
||||
iter_spin = gtk_spin_button_new (GTK_ADJUSTMENT (iter_spin_adj),
|
||||
1, 0);
|
||||
gtk_widget_set_name (iter_spin, "iteration_spin");
|
||||
gtk_table_attach (GTK_TABLE (table2), iter_spin, 0, 1, 1, 2,
|
||||
SPIN_ATTOPT_X, SPIN_ATTOPT_Y,
|
||||
0, 0);
|
||||
gtk_object_set_user_data(GTK_OBJECT(iter_spin_adj),
|
||||
&(acevals->iterations));
|
||||
gtk_signal_connect (GTK_OBJECT (iter_spin_adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (adjust_uint_changed), NULL);
|
||||
|
||||
/* Iteration label */
|
||||
label = gtk_label_new (_("Iterations:"));
|
||||
gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 0, 1,
|
||||
LABEL_ATTOPT, LABEL_ATTOPT,
|
||||
0, 0);
|
||||
|
||||
/* size spin */
|
||||
size_spin_adj = gtk_adjustment_new (acevals->wsize,
|
||||
4, 128, 1, 10, 0);
|
||||
size_spin = gtk_spin_button_new (GTK_ADJUSTMENT (size_spin_adj), 1, 0);
|
||||
gtk_widget_set_name (size_spin, "size_spin");
|
||||
gtk_table_attach (GTK_TABLE (table2), size_spin, 1, 2, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
||||
0, 0);
|
||||
gtk_object_set_user_data(GTK_OBJECT(size_spin_adj),
|
||||
&(acevals->wsize));
|
||||
gtk_signal_connect (GTK_OBJECT (size_spin_adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (adjust_uint_changed), NULL);
|
||||
|
||||
/* size label */
|
||||
label = gtk_label_new (_("Detail Size:"));
|
||||
gtk_table_attach (GTK_TABLE (table2), label, 1, 2, 0, 1,
|
||||
LABEL_ATTOPT, LABEL_ATTOPT,
|
||||
0, 0);
|
||||
|
||||
/* smoothing spin */
|
||||
smooth_spin_adj = gtk_adjustment_new (acevals->smoothing,
|
||||
0, 100, 5, 10, 0);
|
||||
smooth_spin = gtk_spin_button_new (GTK_ADJUSTMENT (smooth_spin_adj),
|
||||
1, 0);
|
||||
gtk_widget_set_name (smooth_spin, "smooth_spin");
|
||||
gtk_table_attach (GTK_TABLE (table2), smooth_spin, 2, 3, 1, 2,
|
||||
SPIN_ATTOPT_X, SPIN_ATTOPT_Y,
|
||||
0, 0);
|
||||
gtk_object_set_user_data(GTK_OBJECT(smooth_spin_adj),
|
||||
&(acevals->smoothing));
|
||||
gtk_signal_connect (GTK_OBJECT (smooth_spin_adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (adjust_double_changed), NULL);
|
||||
|
||||
/* smoothing label */
|
||||
label = gtk_label_new (_("Smoothing:"));
|
||||
gtk_table_attach (GTK_TABLE (table2), label, 2, 3, 0, 1,
|
||||
LABEL_ATTOPT, LABEL_ATTOPT,
|
||||
0, 0);
|
||||
|
||||
/* foobarum spin */
|
||||
foobarum_spin_adj = gtk_adjustment_new (acevals->coefftol,
|
||||
0, 1, .001, .01, 0);
|
||||
foobarum_spin = gtk_spin_button_new (GTK_ADJUSTMENT (foobarum_spin_adj),
|
||||
1, 3);
|
||||
gtk_widget_set_name (foobarum_spin, "foobarum_spin");
|
||||
gtk_table_attach (GTK_TABLE (table2), foobarum_spin, 3, 4, 1, 2,
|
||||
SPIN_ATTOPT_X, SPIN_ATTOPT_Y,
|
||||
0, 0);
|
||||
gtk_object_set_user_data(GTK_OBJECT(foobarum_spin_adj),
|
||||
&(acevals->coefftol));
|
||||
gtk_signal_connect (GTK_OBJECT (foobarum_spin_adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (adjust_double_changed), NULL);
|
||||
|
||||
/* foobarum label */
|
||||
label = gtk_label_new (_("foobarm:"));
|
||||
gtk_table_attach (GTK_TABLE (table2), label, 3, 4, 0, 1,
|
||||
LABEL_ATTOPT, LABEL_ATTOPT,
|
||||
0, 0);
|
||||
|
||||
/** Color method **/
|
||||
frame=gtk_frame_new(_("Color Overflow"));
|
||||
|
||||
color_menu=gtk_menu_new();
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label(_("limit"));
|
||||
gtk_menu_append(GTK_MENU(color_menu), menuitem);
|
||||
gtk_object_set_user_data(GTK_OBJECT(menuitem),
|
||||
GUINT_TO_POINTER(GLACE_COLOR_Yxy));
|
||||
gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC(omenu_callback),
|
||||
&(acevals->color_method));
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label(_("add white"));
|
||||
gtk_menu_append(GTK_MENU(color_menu), menuitem);
|
||||
gtk_object_set_user_data(GTK_OBJECT(menuitem),
|
||||
GUINT_TO_POINTER(GLACE_COLOR_LUMIN));
|
||||
gtk_signal_connect(GTK_OBJECT(menuitem),"activate",
|
||||
GTK_SIGNAL_FUNC(omenu_callback),
|
||||
&(acevals->color_method));
|
||||
|
||||
gtk_widget_show_all(color_menu);
|
||||
|
||||
color_omenu = gtk_option_menu_new();
|
||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(color_omenu),
|
||||
color_menu);
|
||||
|
||||
switch(acevals->color_method) {
|
||||
case GLACE_COLOR_Yxy:
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(color_omenu), 0);
|
||||
break;
|
||||
case GLACE_COLOR_LUMIN:
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(color_omenu), 1);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(frame), color_omenu);
|
||||
gtk_box_pack_start (GTK_BOX(vbox1), frame, FALSE, TRUE, 0);
|
||||
|
||||
/* done */
|
||||
|
||||
gtk_widget_show_all(dlg);
|
||||
|
||||
gtk_main();
|
||||
|
||||
return(go_ahead);
|
||||
}
|
||||
|
||||
/* ???_dialog_new: */
|
||||
/* This should probably be generalized into a libgimpui function,
|
||||
but there are many different strings for argv0, wmclass,
|
||||
and window title, and I find it easier to hardcode them now. */
|
||||
static GtkWidget *ace_dialog_new(GtkSignalFunc ok_callback,
|
||||
GtkSignalFunc close_callback,
|
||||
gboolean *go_ahead)
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *button;
|
||||
|
||||
guchar *color_cube;
|
||||
|
||||
gchar *wintitle;
|
||||
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
/* It's desirable to have an argv0 to pass to gtk_init,
|
||||
so that GTK+ knows what the program's name is... */
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("gimp_ace");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
/* FIXME: I don't understand any of this colormapcube stuff. */
|
||||
gtk_preview_set_gamma(gimp_gamma());
|
||||
gtk_preview_set_install_cmap(gimp_install_cmap());
|
||||
color_cube = gimp_color_cube();
|
||||
gtk_preview_set_color_cube(color_cube[0], color_cube[1], color_cube[2], color_cube[3]);
|
||||
|
||||
gtk_widget_set_default_visual(gtk_preview_get_visual());
|
||||
gtk_widget_set_default_colormap(gtk_preview_get_cmap());
|
||||
|
||||
dlg = gtk_dialog_new ();
|
||||
|
||||
gtk_window_set_wmclass(GTK_WINDOW(dlg),
|
||||
"plug-in-ace",
|
||||
"Gimp");
|
||||
|
||||
gtk_widget_set_name(dlg,"plug-in-ace");
|
||||
|
||||
/* This window title includes the version string. */
|
||||
wintitle = g_strdup_printf(_("Adaptive Contrast Enhancement v %s"),
|
||||
VERSION);
|
||||
gtk_window_set_title (GTK_WINDOW (dlg),
|
||||
wintitle);
|
||||
g_free(wintitle);
|
||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
close_callback,
|
||||
NULL);
|
||||
|
||||
/* Various border settings... */
|
||||
gtk_container_border_width(GTK_CONTAINER(dlg),
|
||||
DIALOG_BORDER_WIDTH);
|
||||
gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(dlg)->action_area),
|
||||
ACTION_AREA_BORDER_WIDTH);
|
||||
/* Action Area */
|
||||
|
||||
gtk_widget_set_name(GTK_DIALOG(dlg)->action_area,"action_area");
|
||||
|
||||
button = gtk_button_new_with_label(_("OK"));
|
||||
gtk_widget_set_name(button,"ok_button");
|
||||
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
GTK_SIGNAL_FUNC(ok_callback),
|
||||
go_ahead);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->action_area),
|
||||
button, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default(button);
|
||||
|
||||
button = gtk_button_new_with_label(_("Cancel"));
|
||||
gtk_widget_set_name(button,"cancel_button");
|
||||
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
close_callback,
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->action_area),
|
||||
button, TRUE, TRUE, 0);
|
||||
|
||||
/* FIXME: I'm missing a HELP button. */
|
||||
|
||||
return dlg;
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_uint_changed (GtkAdjustment *adj, gpointer *unused)
|
||||
{
|
||||
guint *variable;
|
||||
variable=gtk_object_get_user_data(GTK_OBJECT(adj));
|
||||
*variable=(guint)(adj->value);
|
||||
|
||||
/* dialog_update_preview(pre_info); */
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_double_changed (GtkAdjustment *adj, gpointer *unused)
|
||||
{
|
||||
gdouble *variable;
|
||||
variable=gtk_object_get_user_data(GTK_OBJECT(adj));
|
||||
*variable=(gdouble)(adj->value);
|
||||
|
||||
/* dialog_update_preview(pre_info); */
|
||||
}
|
||||
|
||||
static void
|
||||
toggled_cb (GtkToggleButton *toggle, gboolean *data)
|
||||
{
|
||||
*data=toggle->active;
|
||||
}
|
||||
|
||||
static void
|
||||
strength_changed (GtkAdjustment *strength_adj, GtkAdjustment *bradj_adj)
|
||||
{
|
||||
GtkToggleButton *link_toggle = NULL;
|
||||
gdouble *strength;
|
||||
strength=gtk_object_get_user_data (GTK_OBJECT(strength_adj));
|
||||
*strength=(gdouble)(strength_adj->value);
|
||||
|
||||
link_toggle=
|
||||
GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(bradj_adj),
|
||||
"link"));
|
||||
|
||||
if(link_toggle->active)
|
||||
gtk_adjustment_set_value (bradj_adj, *strength);
|
||||
}
|
||||
|
||||
static void
|
||||
bradj_changed (GtkAdjustment *bradj_adj, gpointer unused)
|
||||
{
|
||||
GtkToggleButton *link_toggle = NULL;
|
||||
gdouble *bradj_p=NULL;
|
||||
gdouble bradj=(gdouble)(bradj_adj->value);
|
||||
|
||||
if(TRUE) {
|
||||
bradj_p = gtk_object_get_user_data (GTK_OBJECT(bradj_adj));
|
||||
*bradj_p = bradj;
|
||||
}
|
||||
|
||||
if(FALSE) {
|
||||
link_toggle=
|
||||
GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(bradj_adj),
|
||||
"link"));
|
||||
gtk_toggle_button_set_active(link_toggle, FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
omenu_callback (GtkWidget *menuitem, gpointer data)
|
||||
{
|
||||
*((Glace_ColorMethods*)data) =
|
||||
(Glace_ColorMethods)GPOINTER_TO_UINT(
|
||||
gtk_object_get_user_data(GTK_OBJECT(menuitem)));
|
||||
printf("option menu set data to %d\n",
|
||||
*((Glace_ColorMethods*)data));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ok_callback (GtkWidget *unused, gpointer data)
|
||||
{
|
||||
gboolean *go_ahead=(gboolean*)data;
|
||||
|
||||
*go_ahead=TRUE;
|
||||
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void
|
||||
close_callback (GtkWidget *unused_widget, gpointer unused_data)
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
|
@ -0,0 +1,581 @@
|
|||
/* :PREAMBLE: gimp_ace.c
|
||||
* Adaptive Contrast Enhancement plug-in for the GIMP (v1.0)
|
||||
* (A windowed histogram equalization using the Fourier-series based
|
||||
* fast algorithm.)
|
||||
* Based on J. Alex Stark's <stark@niss.org> GLACE system.
|
||||
* GIMP Plug-in by Kevin Turner <kevint@poboxes.com> */
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. See the file COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/* :HEADERS:
|
||||
*/
|
||||
|
||||
#include "config.h" /* autostuff */
|
||||
|
||||
#ifndef GLACE_GIMP
|
||||
# define GLACE_GIMP
|
||||
#endif
|
||||
|
||||
#include <libintl.h> /* i18n - gettext */
|
||||
#define _(String) gettext (String)
|
||||
#ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
#else
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
#include "gimp_ace.h" /* defines the AceValues struct */
|
||||
#include "color.h" /* This has the RGB -> Y conversion factors.
|
||||
for the SeperateChannels */
|
||||
|
||||
|
||||
/* :*** Prototypes ***:
|
||||
*/
|
||||
|
||||
static void query (void);
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static gboolean do_ace(gint32 drawable_id);
|
||||
|
||||
static void GlaceGimp_ReadImgArrays(Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr,
|
||||
GDrawable *drawable_ptr);
|
||||
|
||||
static int SeperateChannels (guchar *inbuf, const gint buflen,
|
||||
const gboolean TypeRGB, const gboolean HasAlpha,
|
||||
const Glace_ColorMethods color_method,
|
||||
guchar **rbuf, guchar **gbuf, guchar **bbuf,
|
||||
guchar **Graybuf,
|
||||
guchar **xbuf, guchar **ybuf,
|
||||
guchar **ymaxbuf);
|
||||
|
||||
static void GlaceGimp_Process (
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr);
|
||||
|
||||
/* static void GlaceGimp_ScanListfiles (Glace_CfgInfo *cfgInfoPtr); */
|
||||
|
||||
/* :*** Definitions ***:
|
||||
*/
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
};
|
||||
|
||||
static AceValues acevals =
|
||||
{
|
||||
1.0, /* Strength (full) */
|
||||
0.0, /* brightness adjust (none) */
|
||||
0.0, /* foobarm (none) */
|
||||
0.0, /* smoothing (none) */
|
||||
10, /* iterations */
|
||||
25, /* window size */
|
||||
GLACE_COLOR_Yxy, /* Color method */
|
||||
TRUE /* link strength and brightness adjust in dialog. */
|
||||
};
|
||||
|
||||
/* :*** MAIN ***:
|
||||
*/
|
||||
|
||||
MAIN()
|
||||
|
||||
/* :FUNCTION: query
|
||||
*/
|
||||
|
||||
static void
|
||||
query ()
|
||||
{
|
||||
static GParamDef params[] = {
|
||||
/* Required params. */
|
||||
{ PARAM_INT32, "run_mode", "Interactive=0x0, Noninteractive=0x1" },
|
||||
{ PARAM_IMAGE, "image_id", "(unused)" },
|
||||
{ PARAM_DRAWABLE, "drawable_id", N_("Drawable to affect") },
|
||||
/* Our params. */
|
||||
{ PARAM_INT32, "ace_argc", "ace argument count" },
|
||||
{ PARAM_STRINGARRAY, "ace_argv", "ace argument vector" },
|
||||
};
|
||||
const int nparams = sizeof (params) / sizeof (GParamDef);
|
||||
|
||||
gimp_install_procedure ("plug_in_ace",
|
||||
_("Adaptive Contrast Enhancement"),
|
||||
_("FIXME: Write ACE help."),
|
||||
"Alex Stark, Kevin Turner,",
|
||||
"Alex Stark, Kevin Turner,",
|
||||
"1998,1999",
|
||||
"<Image>/Image/Colors/Auto/Adaptive Contrast",
|
||||
"GRAY*, RGB*", /*FIXME*/
|
||||
PROC_PLUG_IN,
|
||||
nparams, /* # Params */
|
||||
0, /* # return values */
|
||||
params,
|
||||
NULL); /* GParamDef *return_vals */
|
||||
}
|
||||
|
||||
/* :FUNCTION: run
|
||||
*/
|
||||
|
||||
static void
|
||||
run (gchar *name, gint nparams, GParam *param,
|
||||
gint *nreturn_vals, GParam **return_vals)
|
||||
{
|
||||
static GParam retvals[1];
|
||||
gint needparams;
|
||||
GRunModeType run_mode;
|
||||
|
||||
*return_vals=retvals;
|
||||
|
||||
*nreturn_vals=1;
|
||||
retvals[0].type = PARAM_STATUS;
|
||||
|
||||
/* Guilty until proven innocent. */
|
||||
retvals[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
|
||||
run_mode=(GRunModeType) param[0].data.d_int32;
|
||||
|
||||
switch(run_mode) {
|
||||
case RUN_NONINTERACTIVE:
|
||||
if (nparams < 3 ||
|
||||
param[0].type != PARAM_INT32 ||
|
||||
param[1].type != PARAM_IMAGE ||
|
||||
param[2].type != PARAM_DRAWABLE) {
|
||||
g_warning("gimp_ace: Caller is on crack! "
|
||||
"You're not passing me the parameters required for a plug-in. "
|
||||
"The first three types should be %d, %d, %d; but I'm reading "
|
||||
"%d, %d, %d.\n",
|
||||
PARAM_INT32, PARAM_IMAGE, PARAM_DRAWABLE,
|
||||
param[0].type, param[1].type, param[2].type);
|
||||
return;
|
||||
}
|
||||
if (param[3].type != PARAM_INT32 ||
|
||||
param[4].type != PARAM_STRING) {
|
||||
g_warning("gimp_ace: caller is passing ace_argc and ace_argv as "
|
||||
"types %d and %d, should be %d and %d.\n",
|
||||
param[3].type, param[4].type,
|
||||
PARAM_INT32, PARAM_STRINGARRAY);
|
||||
return;
|
||||
} /* endif param.type */
|
||||
/* FIXME: do something intelligent with the parameters. */
|
||||
break;
|
||||
case RUN_INTERACTIVE:
|
||||
retvals[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
gimp_get_data ("plug_in_ace",&acevals);
|
||||
if(!ace_dialog (-1, &acevals)) {
|
||||
/* No error, but dialog cancelled. */
|
||||
retvals[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
} /* else continue on and do antialias below. */
|
||||
gimp_set_data ("plug_in_ace", &acevals,
|
||||
sizeof (AceValues));
|
||||
break;
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data ("plug_in_ace", &acevals);
|
||||
break;
|
||||
}
|
||||
|
||||
retvals[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
retvals[0].data.d_status = do_ace(param[2].data.d_drawable)
|
||||
? STATUS_SUCCESS : STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
/* :*** Support Functions ***:
|
||||
*/
|
||||
|
||||
/* :FUNCTION: do_ace(gint32 drawable_id)
|
||||
*/
|
||||
static gboolean
|
||||
do_ace(gint32 drawable_id)
|
||||
{
|
||||
gchar *ace_argv[] = { "-reset",
|
||||
"25",
|
||||
"25",
|
||||
"10",
|
||||
"-factor",
|
||||
"0.0", /* 1.0 is identity, 0.0 is full effect. */
|
||||
"-prescale",
|
||||
"1.0",
|
||||
"-gauss",
|
||||
"0",
|
||||
"-hamming",
|
||||
"-gg",
|
||||
"-passthru",
|
||||
"1.0",
|
||||
"-inoffset",
|
||||
"127.5",
|
||||
"-tol",
|
||||
"0.0" };
|
||||
gint ace_argc=18;
|
||||
|
||||
/* -reset 25 25 10 -cumu -1.2 1.2 361 -factor 1.0 -prescale 1.0 -gauss
|
||||
0 -gg -passthru 1.0 -inoffset 127.5 -tol 0.0 -input inImg -output outImg1*/
|
||||
|
||||
/* gchar *ace_argv[] = { "-reset", "25", "25", "5", "-cumu", "-1.2",
|
||||
"1.2", "361", "-factor", "0.0", "-prescale",
|
||||
"1.0", "-gauss", "0", "-gg",
|
||||
"-passthru", "1.00", "-inoffset", "127.5", "-tol", "0.0"}; */
|
||||
|
||||
Glace_ClientData *clientData;
|
||||
GDrawable *drawable_ptr = gimp_drawable_get(drawable_id);
|
||||
|
||||
gimp_progress_init(_("Adaptive Contrast Enhancement:"));
|
||||
#if 0
|
||||
g_message("gimp_ace PID: %d\n",getpid());
|
||||
kill(getpid(),19);
|
||||
#endif
|
||||
|
||||
/* I don't know what most of this does.
|
||||
It's copied out of pnmace.c */
|
||||
clientData = Glace_AllocClientData ();
|
||||
Glace_WInit(GLACE_CDATA(wData));
|
||||
|
||||
Glace_CfgInit ( GLACE_CDATA(cfgInfoPtr) );
|
||||
|
||||
Glace_ParseArgs ( GLACE_CDATA(cfgInfoPtr),
|
||||
GLACE_CDATA(imgArraysPtr),
|
||||
ace_argc, ace_argv);
|
||||
|
||||
clientData->cfgInfoPtr->heFactor = 1.0 - acevals.strength;
|
||||
clientData->cfgInfoPtr->passthruFactor = 1.0 - acevals.bradj;
|
||||
clientData->cfgInfoPtr->numTerms = acevals.iterations;
|
||||
clientData->cfgInfoPtr->windBaseW = acevals.wsize;
|
||||
clientData->cfgInfoPtr->windBaseH = acevals.wsize;
|
||||
clientData->cfgInfoPtr->coeffTol = acevals.coefftol;
|
||||
clientData->cfgInfoPtr->gaussCwindWidth = acevals.smoothing;
|
||||
clientData->cfgInfoPtr->colorMethod= acevals.color_method;
|
||||
|
||||
GLACE_ERROR_EXIT( GLACE_CDATA(wData) );
|
||||
Glace_CfgAllocSeriesVectors ( GLACE_CDATA(cfgInfoPtr) );
|
||||
/* FIXME: GlaceGimp_ScanListfiles ( GLACE_CDATA(cfgInfoPtr) ); */
|
||||
GLACE_ERROR_EXIT( GLACE_CDATA(wData) );
|
||||
|
||||
Glace_CfgBeginToHeseries ( GLACE_CDATA(cfgInfoPtr) );
|
||||
GLACE_ERROR_EXIT( GLACE_CDATA(wData) );
|
||||
Glace_CfgHeseriesToAddback ( GLACE_CDATA(cfgInfoPtr) );
|
||||
|
||||
Glace_CFuncGen ( GLACE_CDATA(cfgInfoPtr) );
|
||||
|
||||
/* This also allocs the input/ref/ddH/ddV image arrays */
|
||||
/* FIXME */
|
||||
GlaceGimp_ReadImgArrays ( GLACE_CDATA(wData), GLACE_CDATA(cfgInfoPtr),
|
||||
GLACE_CDATA(imgArraysPtr), drawable_ptr );
|
||||
GLACE_ERROR_EXIT( GLACE_CDATA(wData) );
|
||||
|
||||
gimp_progress_update(0.1);
|
||||
|
||||
Glace_CfgAddbackToEnd ( GLACE_CDATA(cfgInfoPtr) );
|
||||
|
||||
Glace_AllocTables ( GLACE_CDATA(cfgInfoPtr), GLACE_CDATA(tableInfoPtr) );
|
||||
Glace_DefaultTmpImg ( GLACE_CDATA(cfgInfoPtr), GLACE_CDATA(imgArraysPtr) );
|
||||
Glace_AllocImgArrays ( GLACE_CDATA(cfgInfoPtr), GLACE_CDATA(imgArraysPtr) );
|
||||
|
||||
GlaceGimp_Process ( GLACE_CDATA(wData), GLACE_CDATA(cfgInfoPtr),
|
||||
GLACE_CDATA(tableInfoPtr), GLACE_CDATA(imgArraysPtr));
|
||||
GLACE_ERROR_EXIT( GLACE_CDATA(wData) );
|
||||
|
||||
Glace_CfgFreeSeriesVectors ( GLACE_CDATA(cfgInfoPtr) );
|
||||
Glace_FreeImgArrays ( GLACE_CDATA(cfgInfoPtr), GLACE_CDATA(imgArraysPtr) );
|
||||
Glace_FreeTables ( GLACE_CDATA(cfgInfoPtr), GLACE_CDATA(tableInfoPtr) );
|
||||
|
||||
Glace_FreeClientData ( clientData );
|
||||
|
||||
/* GlaceGimp_CloseFile (stdout); */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* :FUNCTION: FIXME GlaceGimp_ReadImgArrays
|
||||
* Assumptions: Input is one byte-per-pixel grayscale.
|
||||
*/
|
||||
|
||||
static void
|
||||
GlaceGimp_ReadImgArrays(Glace_WData wData, Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr,
|
||||
GDrawable *drawable_ptr)
|
||||
{
|
||||
guchar *gimp_buf=NULL;
|
||||
gint gimp_size;
|
||||
GPixelRgn src_rgn;
|
||||
gint x1, y1, x2, y2; /* Bounds of the selection */
|
||||
|
||||
/* Nurb Nurb Oink. */
|
||||
|
||||
GLACE_IMG(inImgPtr) =
|
||||
GLACE_IMG(inImgCxPtr) =
|
||||
GLACE_IMG(inImgCyPtr) =
|
||||
GLACE_IMG(inImgCYMaxPtr) =
|
||||
GLACE_IMG(inImgRPtr) =
|
||||
GLACE_IMG(inImgGPtr) =
|
||||
GLACE_IMG(inImgBPtr) = NULL;
|
||||
|
||||
WRAPPER(drawable_ptr)=drawable_ptr;
|
||||
|
||||
gimp_drawable_mask_bounds (drawable_ptr->id, &x1, &y1, &x2, &y2);
|
||||
|
||||
(((GlaceGimpData *)wData)->gimp_x0 ) =x1;
|
||||
(((GlaceGimpData *)wData)->gimp_y0 ) =y1;
|
||||
(imgArraysPtr->cols ) =x2-x1;
|
||||
(imgArraysPtr->rows ) =y2-y1;
|
||||
|
||||
gimp_pixel_rgn_init(&src_rgn,
|
||||
WRAPPER(drawable_ptr),
|
||||
WRAPPER(gimp_x0), WRAPPER(gimp_y0),
|
||||
GLACE_IMG(cols), GLACE_IMG(rows),
|
||||
FALSE, FALSE);
|
||||
|
||||
/* skip some pixels on output so we can mix the alpha back in. */
|
||||
GLACE_IMG(pixelBytePad) = gimp_drawable_has_alpha(drawable_ptr->id) ? 1 : 0;
|
||||
|
||||
/* This refers to precision, not number of channels. */
|
||||
GLACE_IMG(pixelSize) = 1;
|
||||
|
||||
gimp_size = GLACE_IMG(cols) * GLACE_IMG(rows) * drawable_ptr->bpp;
|
||||
WRAPPER(gimpImgPtr) = gimp_buf = g_new(guchar, gimp_size);
|
||||
|
||||
gimp_pixel_rgn_get_rect(&src_rgn, gimp_buf,
|
||||
WRAPPER(gimp_x0), WRAPPER(gimp_y0),
|
||||
GLACE_IMG(cols), GLACE_IMG(rows));
|
||||
|
||||
imgArraysPtr->inImgSize =
|
||||
SeperateChannels(gimp_buf, gimp_size,
|
||||
gimp_drawable_color(drawable_ptr->id),
|
||||
gimp_drawable_has_alpha(drawable_ptr->id),
|
||||
cfgInfoPtr->colorMethod,
|
||||
&imgArraysPtr->inImgPtr, /* Greybuf (to process) */
|
||||
&imgArraysPtr->inImgRPtr, /* rbuf */
|
||||
&imgArraysPtr->inImgGPtr, /* gbuf */
|
||||
&imgArraysPtr->inImgBPtr, /* bbuf */
|
||||
&imgArraysPtr->inImgCxPtr, /* xbuf */
|
||||
&imgArraysPtr->inImgCyPtr, /* ybuf */
|
||||
&imgArraysPtr->inImgCYMaxPtr); /* YMaxbuf */
|
||||
|
||||
imgArraysPtr->refImgPtr = imgArraysPtr->inImgPtr;
|
||||
|
||||
imgArraysPtr->refImgLBPtr = imgArraysPtr->refImgHBPtr =
|
||||
imgArraysPtr->inImgLBPtr = imgArraysPtr->inImgHBPtr =
|
||||
imgArraysPtr->inImgPtr;
|
||||
|
||||
GLACE_CFG(chrome)= gimp_drawable_color(drawable_ptr->id)
|
||||
? GLACE_CC : GLACE_GG;
|
||||
|
||||
/* This is forced config stuff. */
|
||||
/* if (GLACE_CFG(filtMethod) == GLACE_WINDOW) */
|
||||
GLACE_CFG(filtMethod) = GLACE_WINDOW;
|
||||
GLACE_IMG(ddHImgPtr) = GLACE_IMG(ddVImgPtr) = NULL;
|
||||
|
||||
GLACE_CFG(doublep)=GLACE_FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
SeperateChannels (guchar *inbuf, const gint buflen,
|
||||
const gboolean TypeRGB, const gboolean HasAlpha,
|
||||
const Glace_ColorMethods color_method,
|
||||
guchar **Graybuf,
|
||||
guchar **rbuf, guchar **gbuf, guchar **bbuf,
|
||||
guchar **xbuf, guchar **ybuf,
|
||||
guchar **Ymaxbuf)
|
||||
{
|
||||
int c=0, ic=0, bpp;
|
||||
guchar *Grayfoo;
|
||||
if(!TypeRGB && !HasAlpha) {
|
||||
*Graybuf = inbuf;
|
||||
return buflen;
|
||||
}
|
||||
if(!TypeRGB && HasAlpha) {
|
||||
if((buflen % 2) != 0)
|
||||
g_error("GRAYA with odd size %d?",buflen);
|
||||
if(*Graybuf == NULL)
|
||||
*Graybuf = g_new(guchar,buflen/2);
|
||||
|
||||
Grayfoo=*Graybuf;
|
||||
while(ic < buflen) {
|
||||
Grayfoo[c] = inbuf[ic++];
|
||||
ic++;
|
||||
c++;
|
||||
}
|
||||
return c;
|
||||
} /* if GRAYA */
|
||||
if(TypeRGB) {
|
||||
guchar R,G,B;
|
||||
guchar *xfoo, *yfoo, *Ymaxfoo;
|
||||
guchar *rfoo, *bfoo, *gfoo;
|
||||
|
||||
bpp = HasAlpha ? 4 : 3;
|
||||
if((buflen % bpp) != 0) {
|
||||
g_error("RGB: %d Alpha: %d. I think bpp should be %d, but that"
|
||||
"doesn't make sense with size %d, as R = %d",
|
||||
TypeRGB, HasAlpha, bpp, buflen, buflen % bpp);
|
||||
}
|
||||
|
||||
|
||||
if(*Graybuf == NULL)
|
||||
*Graybuf = g_new(guchar,buflen/bpp);
|
||||
|
||||
Grayfoo=*Graybuf;
|
||||
|
||||
if(color_method == GLACE_COLOR_Yxy) {
|
||||
if(*xbuf == NULL)
|
||||
*xbuf = g_new(guchar,buflen/bpp);
|
||||
if(*ybuf == NULL)
|
||||
*ybuf = g_new(guchar,buflen/bpp);
|
||||
if(*Ymaxbuf == NULL)
|
||||
*Ymaxbuf = g_new(guchar,buflen/bpp);
|
||||
|
||||
xfoo=*xbuf;
|
||||
yfoo=*ybuf;
|
||||
Ymaxfoo=*Ymaxbuf;
|
||||
|
||||
puts("Seperating into Yxy");
|
||||
} else {
|
||||
if(*rbuf == NULL)
|
||||
*rbuf = g_new(guchar,buflen/bpp);
|
||||
|
||||
if(*gbuf == NULL)
|
||||
*gbuf = g_new(guchar,buflen/bpp);
|
||||
|
||||
if(*bbuf == NULL)
|
||||
*bbuf = g_new(guchar,buflen/bpp);
|
||||
|
||||
rfoo=*rbuf;
|
||||
gfoo=*gbuf;
|
||||
bfoo=*bbuf;
|
||||
|
||||
puts("Seperating into RGB");
|
||||
}
|
||||
|
||||
while(ic < buflen) {
|
||||
R = inbuf[ic++];
|
||||
G = inbuf[ic++];
|
||||
B = inbuf[ic++];
|
||||
if(HasAlpha) ic++;
|
||||
|
||||
if(color_method != GLACE_COLOR_Yxy) {
|
||||
rfoo[c]=R;
|
||||
gfoo[c]=G;
|
||||
bfoo[c]=B;
|
||||
}
|
||||
|
||||
if((R==0) && (G==0) && (B==0)) {
|
||||
/* Black is a special case. Choose values
|
||||
that won't make divide by 0 errors. */
|
||||
Grayfoo[c] = 0;
|
||||
|
||||
if(color_method == GLACE_COLOR_Yxy) {
|
||||
xfoo[c] = 0;
|
||||
yfoo[c] = 255;
|
||||
Ymaxfoo[c] = 255;
|
||||
}
|
||||
} else {
|
||||
gfloat X1, Y1, Z1;
|
||||
gfloat x,y,z;
|
||||
gfloat rYmax, gYmax, bYmax;
|
||||
|
||||
/* Calculate XYZ coordinates for original image. */
|
||||
Y1 = Y_r * R + Y_g * G + Y_b * B;
|
||||
|
||||
/* This is the channel which is processed. */
|
||||
Grayfoo[c] = Y1;
|
||||
|
||||
if(color_method == GLACE_COLOR_Yxy) {
|
||||
X1 = X_r * R + X_g * G + X_b * B;
|
||||
Z1 = Z_r * R + Z_g * G + Z_b * B;
|
||||
|
||||
/* Find chromacity xy coordinates. */
|
||||
/* Multiplied by 255 because we're not storing
|
||||
them as floats from 0-1 but in an 8-bit
|
||||
data type. */
|
||||
xfoo[c] = x = 255.0 * X1 / ( X1 + Y1 + Z1 );
|
||||
yfoo[c] = y = 255.0 * Y1 / ( X1 + Y1 + Z1 );
|
||||
|
||||
z = 255.0 - x - y;
|
||||
|
||||
/* This calculates the maximum displayable
|
||||
luminosity for this color. */
|
||||
rYmax = 255.0 / ((1/y) * (R_x * x + R_z * z) + R_y);
|
||||
gYmax = 255.0 / ((1/y) * (G_x * x + G_z * z) + G_y);
|
||||
bYmax = 255.0 / ((1/y) * (B_x * x + B_z * z) + B_y);
|
||||
|
||||
Ymaxfoo[c] = MIN(MIN(rYmax,gYmax),bYmax);
|
||||
} /* endif Yxy */
|
||||
} /* endif rgb != 0 */
|
||||
c++;
|
||||
} /* whend */
|
||||
return c;
|
||||
} /* endif rgb */
|
||||
g_error("Fell through SeperateChannels.");
|
||||
return -1;
|
||||
} /* SeperateChannels() */
|
||||
|
||||
/**************************************************************/
|
||||
/*
|
||||
* :FUNCTION: Glace_Process
|
||||
*/
|
||||
void
|
||||
GlaceGimp_Process (
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
)
|
||||
{
|
||||
guint k;
|
||||
|
||||
Glace_WindChk (cfgInfoPtr, GLACE_IMG(cols), GLACE_IMG(rows));
|
||||
GLACE_ERROR_CHECK( GLACE_CFG(wData) );
|
||||
|
||||
Glace_InitAccIm (cfgInfoPtr, imgArraysPtr);
|
||||
|
||||
if (GLACE_CFG(outputMethod) == GLACE_NORMAL) {
|
||||
for (k = GLACE_CFG(firstTerm);
|
||||
k <= (unsigned) GLACE_CFG(numTerms);
|
||||
k++) {
|
||||
Glace_SetForTerm(tableInfoPtr, k, GLACE_COS);
|
||||
Glace_TermlyReport( cfgInfoPtr, tableInfoPtr);
|
||||
|
||||
Glace_SetTables (cfgInfoPtr, tableInfoPtr);
|
||||
Glace_GenGen ( cfgInfoPtr, tableInfoPtr, imgArraysPtr);
|
||||
GLACE_ERROR_CHECK( GLACE_CFG(wData) );
|
||||
|
||||
Glace_SetForTerm(tableInfoPtr, k, GLACE_SIN);
|
||||
|
||||
Glace_SetTables (cfgInfoPtr, tableInfoPtr);
|
||||
Glace_GenGen ( cfgInfoPtr, tableInfoPtr, imgArraysPtr);
|
||||
GLACE_ERROR_CHECK( GLACE_CFG(wData) );
|
||||
|
||||
Glace_WMessage( GLACE_CFG(wData), ";\n" );
|
||||
|
||||
gimp_progress_update(0.10 + 0.90 * k/GLACE_CFG(numTerms));
|
||||
}
|
||||
} else {
|
||||
Glace_DiagGen (cfgInfoPtr, tableInfoPtr, imgArraysPtr);
|
||||
}
|
||||
GLACE_ERROR_CHECK( GLACE_CFG(wData) );
|
||||
Glace_Output (wData, cfgInfoPtr, imgArraysPtr );
|
||||
}
|
||||
|
||||
/* :FUNCTION: FIXME GlacePnm_ScanListfiles
|
||||
*/
|
||||
|
||||
/*static void
|
||||
GlaceGimp_ScanListfiles (Glace_CfgInfo *cfgInfoPtr)
|
||||
{
|
||||
g_warning("GlaceGimp_ScanListFiles in gimp_ace.c not yet implemented.\n");
|
||||
}*/
|
||||
|
||||
/* GlaceGimp_CloseFile (stdout); */
|
|
@ -0,0 +1,14 @@
|
|||
/* $Id$ */
|
||||
|
||||
#include "glace.h"
|
||||
|
||||
typedef struct {
|
||||
gdouble strength;
|
||||
gdouble bradj;
|
||||
gdouble coefftol;
|
||||
gdouble smoothing;
|
||||
guint iterations;
|
||||
guint wsize;
|
||||
Glace_ColorMethods color_method;
|
||||
gboolean link;
|
||||
} AceValues;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,987 @@
|
|||
/* $Id$ */
|
||||
/* :PREAMBLE: Glace.h
|
||||
*
|
||||
* Main header file for GLACE programs:
|
||||
* NOTE: This is designed to load your program-specific headers for you
|
||||
*
|
||||
* For PBMPLUS and Tk/Tcl-based and GIMP versions
|
||||
* #define GLACE_PNM or GLACE_TK or GLACE_GIMP before inclusion
|
||||
* Automatically includes pgm.h or tk.h, or gimp headers as appropriate.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. See the file COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/* :DEFS AND SUCH:
|
||||
*/
|
||||
|
||||
#ifdef _PGM_H_
|
||||
#error DO NOT LOAD PBMPLUS (OR DERIVATIVE) FIRST
|
||||
#endif
|
||||
|
||||
#ifndef _GLACE_H_
|
||||
#define _GLACE_H_
|
||||
|
||||
|
||||
#ifndef BUFSIZ
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef GLACE_PNM
|
||||
/* pbmpluss.h deals with WATCOMC */
|
||||
# include "pbmpluss.h"
|
||||
# include "pnm.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
# define __WIN32__
|
||||
/*# define DllEntryPoint LibMain*/
|
||||
# include "glace.wcp"
|
||||
#endif
|
||||
|
||||
#ifdef GLACE_TK
|
||||
# include "tk.h"
|
||||
#endif
|
||||
|
||||
#ifdef GLACE_GIMP
|
||||
# include <glib.h>
|
||||
# include <libgimp/gimp.h>
|
||||
#endif
|
||||
|
||||
/* This isn't really the right place for this, but... */
|
||||
#define BYTE_SPLIT(x,hb,lb) \
|
||||
lb = (Glace_Gray) (((unsigned int) (x+0.5)) & 0377);\
|
||||
hb = (Glace_Gray) ((((unsigned int) (x+0.5))>>8))
|
||||
/*lb = ((Glace_Gray) x);*/
|
||||
/*lb = ((unsigned int) x) - (hb<<8);*/
|
||||
|
||||
|
||||
/*
|
||||
* There is also an internal header file glaceInt.h
|
||||
*/
|
||||
|
||||
#ifdef _OVAR_
|
||||
#define GLACE_OVAR(A) A __attribute__ ((unused))
|
||||
#else
|
||||
#define GLACE_OVAR(A) A
|
||||
#endif
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/* :*** Simple Things ***:
|
||||
*
|
||||
* :+++++++: #defines
|
||||
*/
|
||||
#define GLACE_PI ((double) 3.141592653589793)
|
||||
|
||||
#define GLACE_TRUE 1
|
||||
#define GLACE_FALSE 0
|
||||
#define GLACE_BOOL int
|
||||
|
||||
/* avoiding 0, 1, etc. */
|
||||
#define GLACE_ERROR 99
|
||||
#define GLACE_OK 0
|
||||
|
||||
#define GLACE_STRMAX 100
|
||||
|
||||
#define GLACE_MIDGRAY ((float) 127.5)
|
||||
#define GLACE_MAXMAXGRAY 255
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Grays and colours typedefs
|
||||
*/
|
||||
|
||||
|
||||
typedef signed long Glace_BigGray;
|
||||
typedef signed short Glace_MidGray;
|
||||
#ifndef _PGM_H_
|
||||
typedef unsigned char Glace_Gray;
|
||||
|
||||
|
||||
|
||||
#undef max
|
||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
#undef min
|
||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||
#undef abs
|
||||
#define abs(a) ((a) >= 0 ? (a) : -(a))
|
||||
#undef odd
|
||||
#define odd(n) ((n) & 1)
|
||||
|
||||
#else
|
||||
|
||||
#define Glace_Gray gray
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Glace_Gray r, g, b;
|
||||
} Glace_Pixel;
|
||||
#define GLACE_GETR(p) ((p).r)
|
||||
#define GLACE_GETG(p) ((p).g)
|
||||
#define GLACE_GETB(p) ((p).b)
|
||||
|
||||
/************* added definitions *****************/
|
||||
#define GLACE_PUTR(p,red) ((p).r = (red))
|
||||
#define GLACE_PUTG(p,grn) ((p).g = (grn))
|
||||
#define GLACE_PUTB(p,blu) ((p).b = (blu))
|
||||
/**************************************************/
|
||||
|
||||
#define GLACE_ASSIGN(p,red,grn,blu) do { (p).r = (red); (p).g = (grn); (p).b = (blu); } while ( 0 )
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/* :*** Structures ***:
|
||||
*
|
||||
* :+++++++: Glace_WData. Wrapper data structure (dummy typedef)
|
||||
*/
|
||||
|
||||
typedef char *Glace_WData;
|
||||
/*typedef char Glace_WErrorInfo;*/
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Glace_ImgArrays. Image arrays structure
|
||||
*
|
||||
* This is a structure that holds the pointers and defining parameters of
|
||||
* the image arrays: input, reference, filtering, accumulation, and
|
||||
* temporary. The output is done row-by-row.
|
||||
*/
|
||||
|
||||
/*
|
||||
typedef enum {
|
||||
GLACE_TMP_IMG_BIG, GLACE_TMP_IMG_MID
|
||||
} Glace_TmpImgGraySize;
|
||||
*/
|
||||
|
||||
typedef char *Glace_ImageHandle;
|
||||
|
||||
/*
|
||||
* Structure definition
|
||||
*/
|
||||
|
||||
typedef struct Glace_ImgArrays {
|
||||
Glace_ImageHandle inputImageHandle, refImageHandle,
|
||||
ddHImageHandle, ddVImageHandle, outputImageHandle;
|
||||
|
||||
Glace_Gray *ddHImgPtr,
|
||||
*ddVImgPtr;
|
||||
|
||||
long inImgSize; /* Allocated size for input image,
|
||||
taking into account * pixel planes passed on (1 to 5) */
|
||||
Glace_Gray *inImgPtr;
|
||||
/*long inImgBSize;*/ /* for input gray bytes. 0: not alloc or use inImgPtr
|
||||
* 0: not alloc or use inImgPtr
|
||||
* *2 if LB+HB (ie doublep)
|
||||
*/
|
||||
Glace_Gray *inImgHBPtr;
|
||||
Glace_Gray *inImgLBPtr;
|
||||
|
||||
/* Some color methods take RGB, others take Yxy. */
|
||||
/* (The C is to remind you that x,y are coordinates in color space,
|
||||
and not cartesian pixel coordinates.) */
|
||||
|
||||
Glace_Gray *inImgCxPtr;
|
||||
Glace_Gray *inImgCyPtr;
|
||||
Glace_Gray *inImgCYMaxPtr;
|
||||
|
||||
Glace_Gray *inImgRPtr;
|
||||
Glace_Gray *inImgGPtr;
|
||||
Glace_Gray *inImgBPtr;
|
||||
|
||||
int pixelSize;
|
||||
int pixelBytePad; /* Set by Glace_WPutImgRowStart or before */
|
||||
|
||||
long refImgSize;
|
||||
Glace_Gray *refImgPtr;
|
||||
/* long refImgBSize;*/
|
||||
Glace_Gray *refImgHBPtr;
|
||||
Glace_Gray *refImgLBPtr;
|
||||
|
||||
|
||||
long accImgSize;
|
||||
Glace_MidGray *accImgPtr;
|
||||
Glace_MidGray *outAccImgPtr; /* a dummy pointer that refers to the
|
||||
accumulator array to be output. This
|
||||
can be other than the true accumulator
|
||||
if a diagnostic image is being
|
||||
generated. */
|
||||
int cols;
|
||||
int rows;
|
||||
long putImgSize; /* The wrapper can use this how it likes, eg size
|
||||
of a single row or of a whole output image. */
|
||||
Glace_Gray *putImgRowPtr;
|
||||
|
||||
long tmpImgSize;
|
||||
/* basically internal; in size_t. If zero, then tmp is unallocated. */
|
||||
|
||||
int tmpImgRPad, tmpImgCPad; /*added to rows and cols*/
|
||||
/*Glace_TmpImgGraySize tmpImgGraySize;*/
|
||||
size_t tmpImgGraySize;
|
||||
|
||||
char *tmpImgPtr;
|
||||
/* Glace_BigGray *bgTmpImgPtr;
|
||||
Glace_MidGray *mgTmpImgPtr;*/
|
||||
|
||||
Glace_WData wData;
|
||||
} Glace_ImgArrays;
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Glace_CfgInfo. Configuration information
|
||||
*/
|
||||
|
||||
#define GLACE_CFG_DEFAULT_NUM_TERMS 240
|
||||
#define GLACE_CFG_DEFAULT_A_WITH_F GLACE_NONE
|
||||
/*#define GLACE_CFG_DEFAULT_A_WITH_F GLACE_LOCALMEAN*/
|
||||
#define GLACE_TOL_DOUBLEP 0.00001
|
||||
#define GLACE_TOL_SINGLEP 0.0025
|
||||
|
||||
|
||||
/* Default value is indicated by zero throughout */
|
||||
typedef enum {
|
||||
GLACE_AUTO = 0, GLACE_MANUAL
|
||||
} Glace_Modes;
|
||||
|
||||
typedef enum {
|
||||
GLACE_MISSING = 0, GLACE_LISTFILE, GLACE_COMMANDLINE
|
||||
} Glace_DimSrcs;
|
||||
|
||||
typedef enum {
|
||||
GLACE_NORMAL = 0, GLACE_COSRAW, GLACE_COSFILT, GLACE_SINRAW, GLACE_SINFILT
|
||||
} Glace_OutputMethods;
|
||||
|
||||
typedef enum {
|
||||
GLACE_STANDARD = 0, GLACE_SERIES, GLACE_FACTOR
|
||||
} Glace_HeTypes;
|
||||
|
||||
typedef enum {
|
||||
GLACE_CC = 0, GLACE_CG, GLACE_GG
|
||||
} Glace_ChromeTypes;
|
||||
|
||||
typedef enum {
|
||||
GLACE_WINDOW = 0, GLACE_DIRDIFF
|
||||
} Glace_FiltMethods;
|
||||
|
||||
typedef enum {
|
||||
GLACE_INPUT = 0, GLACE_SEPARATE
|
||||
} Glace_RefImageModes;
|
||||
|
||||
typedef enum {
|
||||
GLACE_NONE = 0, GLACE_ZEROINPUT, GLACE_LOCALMEAN
|
||||
} Glace_AddbackTypes;
|
||||
|
||||
typedef enum {
|
||||
GLACE_PNM_VER = 0, GLACE_TK_VER, GLACE_GIMP_VER
|
||||
} Glace_WrapTypes;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GLACE_COLOR_Yxy = 0, GLACE_COLOR_LUMIN
|
||||
} Glace_ColorMethods;
|
||||
|
||||
typedef struct Glace_CfgInfo
|
||||
{
|
||||
FILE *wListfile, *dListfile, *sListfile;
|
||||
|
||||
Glace_OutputMethods outputMethod;
|
||||
int numTerms, firstTerm, termsSerialised;
|
||||
unsigned int activeTerms;
|
||||
GLACE_BOOL verbose;
|
||||
GLACE_BOOL hammingCwind;
|
||||
GLACE_BOOL gaussCwind;
|
||||
GLACE_BOOL addbackCwind;
|
||||
GLACE_BOOL doClip;
|
||||
|
||||
GLACE_BOOL doublep;
|
||||
GLACE_BOOL doubleout;
|
||||
Glace_ChromeTypes chrome;
|
||||
|
||||
|
||||
Glace_HeTypes heType;
|
||||
|
||||
long currentSeriesAllocation;
|
||||
double *heseriesSeries, *cwindSeries;
|
||||
double *addbackSeries;
|
||||
int *windCWSeries, *windCHSeries, *windSWSeries, *windSHSeries;
|
||||
|
||||
Glace_FiltMethods filtMethod;
|
||||
int windBaseW, windBaseH;
|
||||
float addbackFactor;
|
||||
/* if dd filtering is used, then we remap arrays */
|
||||
#define GLACE_CFG_COSDIM windCWSeries
|
||||
#define GLACE_CFG_COSBV windCHSeries
|
||||
#define GLACE_CFG_SINDIM windSWSeries
|
||||
#define GLACE_CFG_SINBV windSHSeries
|
||||
|
||||
|
||||
Glace_DimSrcs dimensionSrc;
|
||||
|
||||
Glace_Modes prescaleMode;
|
||||
Glace_Modes inoffsetMode;
|
||||
Glace_Modes addbackMode;
|
||||
Glace_AddbackTypes addbackType;
|
||||
float passthruFactor;
|
||||
float prescaleVal;
|
||||
float heFactor;
|
||||
float inoffsetVal;
|
||||
float gaussCwindWidth;
|
||||
float coeffTol;
|
||||
|
||||
Glace_ColorMethods colorMethod;
|
||||
|
||||
Glace_RefImageModes refimageMode;
|
||||
|
||||
GLACE_BOOL genCFunc;
|
||||
float cFuncMin, cFuncMax;
|
||||
int cFuncPoints;
|
||||
|
||||
Glace_WData wData;
|
||||
Glace_WrapTypes wrapType;
|
||||
GLACE_BOOL plainGlace;
|
||||
} Glace_CfgInfo;
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Glace_TableInfo. Term-wise and table information
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
GLACE_SIN, GLACE_COS
|
||||
} Glace_TermTypes;
|
||||
|
||||
typedef double Glace_FpSeries;
|
||||
|
||||
typedef struct Glace_TableInfo
|
||||
{
|
||||
int filtShifts, notFiltShifts;
|
||||
float filtFactor, notFiltFactor;
|
||||
Glace_TermTypes termType; /* which one is being filtered */
|
||||
unsigned int termNum;
|
||||
|
||||
/* long *notFiltTable, *filtTable;*/
|
||||
long *seriesTable;
|
||||
int accShift;
|
||||
|
||||
Glace_FpSeries *seriesAH, *seriesAL, *seriesBH, *seriesBL;
|
||||
|
||||
float abFactor, abShifts;
|
||||
|
||||
double waveFactor;
|
||||
|
||||
Glace_WData wData;
|
||||
} Glace_TableInfo;
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Glace_ClientData. Umbrella clientdata
|
||||
*/
|
||||
|
||||
|
||||
typedef struct Glace_ClientData
|
||||
{
|
||||
Glace_WData wData;
|
||||
Glace_CfgInfo *cfgInfoPtr;
|
||||
Glace_TableInfo *tableInfoPtr;
|
||||
Glace_ImgArrays *imgArraysPtr;
|
||||
} Glace_ClientData;
|
||||
|
||||
|
||||
|
||||
#if defined(GLACE_IMG)
|
||||
#undef GLACE_IMG
|
||||
#endif
|
||||
#define GLACE_IMG(A) (imgArraysPtr->A)
|
||||
|
||||
|
||||
|
||||
#if defined(GLACE_TRM)
|
||||
#undef GLACE_TRM
|
||||
#endif
|
||||
#define GLACE_TRM(A) (tableInfoPtr->A)
|
||||
|
||||
|
||||
|
||||
#if defined(GLACE_CFG)
|
||||
#undef GLACE_CFG
|
||||
#endif
|
||||
#define GLACE_CFG(A) (cfgInfoPtr->A)
|
||||
|
||||
|
||||
|
||||
#if defined(GLACE_CDATA)
|
||||
#undef GLACE_CDATA
|
||||
#endif
|
||||
#define GLACE_CDATA(A) (((Glace_ClientData *) clientData)->A)
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/* :*** Procedures ***:
|
||||
*
|
||||
* :+++++++: Dummy tests
|
||||
*
|
||||
* These were originally used as dummy operations (a kind of NOP)
|
||||
* that used a variable or structure pointer such that the error
|
||||
* should never occur. This keeps the compiler happy. Pointers
|
||||
* to structures are often unused in some versions, or if they are
|
||||
* included for future expansion.
|
||||
*
|
||||
* Note that these tests could be used in anger, but that the message
|
||||
* would be non-specific.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
#define GLACE_NULL_TEST(wData,ptr) if (ptr==NULL) \
|
||||
Glace_WError( wData,"Pointer " \
|
||||
"null test failed");
|
||||
#define GLACE_TEST(wData,T) if (T) Glace_WError( wData,\
|
||||
"Test failure");
|
||||
*/
|
||||
|
||||
|
||||
#define GLACE_ERROR_EXIT(wData) if (Glace_WIsError(wData)) \
|
||||
exit(1);
|
||||
#define GLACE_ERROR_CHECK(wData) if (Glace_WIsError(wData)) \
|
||||
return;
|
||||
#define GLACE_ERROR_VALUE(wData) if (Glace_WIsError(wData)) \
|
||||
return Glace_WErrorValue( wData );
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Cfg. Configuration information
|
||||
*/
|
||||
|
||||
/*
|
||||
* CONFIG
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
Glace_CfgInit (
|
||||
Glace_CfgInfo *cfgInfoPtr);
|
||||
|
||||
void
|
||||
Glace_CfgAllocSeriesVectors (
|
||||
Glace_CfgInfo *cfgInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_CfgBeginToHeseries (
|
||||
Glace_CfgInfo *cfgInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_CfgHeseriesToAddback (
|
||||
Glace_CfgInfo *cfgInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_CfgAddbackToEnd (
|
||||
Glace_CfgInfo *cfgInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_CfgFreeSeriesVectors (
|
||||
Glace_CfgInfo *cfgInfoPtr
|
||||
);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: W. Wrapper-specifics
|
||||
*
|
||||
* The following are implemented differently for each wrapper.
|
||||
* PGM system: glaceP.c and
|
||||
* TK/TCL system: glaceT.c
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/*
|
||||
* WRAPPER:
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Glace_WData
|
||||
Glace_WDataAlloc();
|
||||
|
||||
void
|
||||
Glace_WInit(
|
||||
Glace_WData wData
|
||||
);
|
||||
|
||||
Glace_WrapTypes
|
||||
Glace_WWrapTell();
|
||||
|
||||
void
|
||||
Glace_WMessage(
|
||||
Glace_WData wData, char* messageStr );
|
||||
|
||||
int /* Sets error and returns error flag (but may exit) */
|
||||
Glace_WError(
|
||||
Glace_WData wData,
|
||||
char* argErrStr
|
||||
);
|
||||
|
||||
int /* Returns error flag */
|
||||
Glace_WErrorValue(
|
||||
Glace_WData wData
|
||||
);
|
||||
|
||||
int /* Returns boolean */
|
||||
Glace_WIsError(
|
||||
Glace_WData wData
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*----------*/
|
||||
void
|
||||
Glace_WPutImgStart(
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
void
|
||||
Glace_WPutImgRowStart(
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr,
|
||||
int row
|
||||
);
|
||||
void
|
||||
Glace_WPutImgRowFinish(
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr,
|
||||
int row
|
||||
);
|
||||
void
|
||||
Glace_WPutImgFinish(
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
int
|
||||
Glace_WKeyMatch(
|
||||
char* str,
|
||||
char* keyWord,
|
||||
int minChars
|
||||
);
|
||||
|
||||
void
|
||||
Glace_WUsage(
|
||||
Glace_WData wData,
|
||||
char* usage
|
||||
);
|
||||
|
||||
void
|
||||
Glace_WOpenImage(
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
char *name,
|
||||
Glace_ImageHandle *handlePtr
|
||||
);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Term-wise and table info
|
||||
*/
|
||||
|
||||
|
||||
/* TABLE INFO
|
||||
*
|
||||
* This supplies the lookup tables and other related information that is
|
||||
* specific to the current term being processed.
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
Glace_SetForTerm (
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
int k,
|
||||
Glace_TermTypes type /* which one is being filtered */
|
||||
);
|
||||
|
||||
void
|
||||
Glace_TermlyReport (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_AllocTables (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_FreeTables (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_SetTables (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_FillTableForFilt (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
float scale
|
||||
);
|
||||
|
||||
void
|
||||
Glace_FillTableForNotFilt (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: CFunc. Cumulation function
|
||||
*/
|
||||
|
||||
int
|
||||
Glace_CFuncGen (
|
||||
Glace_CfgInfo *cfgInfoPtr
|
||||
);
|
||||
float
|
||||
Glace_CFuncPoint (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
float x
|
||||
);
|
||||
float
|
||||
Glace_CFuncIdealPoint (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
float x
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Allocation and reallocation
|
||||
*/
|
||||
|
||||
/*
|
||||
* Etc.
|
||||
*/
|
||||
/**************************************************************/
|
||||
char *
|
||||
Glace_CallocReallocFree(
|
||||
void *p,
|
||||
long *nObjPtr,
|
||||
long newNObj,
|
||||
size_t size,
|
||||
float minBound
|
||||
);
|
||||
|
||||
void
|
||||
Glace_FreeImgArrays (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_SetTmpImg (
|
||||
Glace_ImgArrays *imgArraysPtr,
|
||||
size_t graySize,
|
||||
int rowPad,
|
||||
int colPad
|
||||
);
|
||||
|
||||
void
|
||||
Glace_DefaultTmpImg (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
void
|
||||
Glace_AllocImgArrays (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_AllocInputImgArrays (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
|
||||
void
|
||||
Glace_FreeInputImgArrays (
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
|
||||
|
||||
Glace_ClientData *
|
||||
Glace_AllocClientData ();
|
||||
|
||||
void
|
||||
Glace_FreeClientData (
|
||||
Glace_ClientData *clientData
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Process procedures
|
||||
*/
|
||||
|
||||
void
|
||||
Glace_Process (
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
|
||||
/*
|
||||
void
|
||||
GlaceArgError (
|
||||
const char *message,
|
||||
char *argv[],
|
||||
int numArgs,
|
||||
int problemArg
|
||||
);
|
||||
*/
|
||||
int
|
||||
Glace_ParseArgs (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr,
|
||||
int argc,
|
||||
char *argv[]);
|
||||
|
||||
|
||||
void
|
||||
Glace_WindChk(
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
int rows,
|
||||
int cols
|
||||
);
|
||||
|
||||
int
|
||||
Glace_Output (
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
void
|
||||
Glace_InitAccIm (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr);
|
||||
|
||||
void
|
||||
Glace_GenGen (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr);
|
||||
|
||||
void
|
||||
Glace_DiagGen (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
void
|
||||
Glace_DiagOutput (
|
||||
Glace_WData wData,
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
);
|
||||
|
||||
|
||||
|
||||
void
|
||||
Glace_CallFilt (
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
Glace_ImgArrays *imgArraysPtr);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Filt. Filtering
|
||||
*/
|
||||
|
||||
/**********************************************************************/
|
||||
/*
|
||||
* FILT
|
||||
*
|
||||
* Image array filtering
|
||||
* Implemented in glaceFilt.c
|
||||
*/
|
||||
|
||||
void
|
||||
Glace_FiltWind(
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_Gray * inImgHBPtr,
|
||||
Glace_Gray * inImgLBPtr, Glace_BigGray * outImgPtr,
|
||||
/*signed long *lTable,*/
|
||||
int cols, int rows,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
int width, int height
|
||||
);
|
||||
|
||||
void
|
||||
Glace_FiltDD(
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_Gray * inImgPtr, Glace_MidGray * outImgPtr,
|
||||
/*signed long *lTable,*/
|
||||
int cols, int rows,
|
||||
Glace_TableInfo *tableInfoPtr,
|
||||
Glace_Gray *hBiasArray, Glace_Gray *vBiasArray,
|
||||
int numPasses
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: Heseries. Generating signed power-law series
|
||||
*/
|
||||
|
||||
/**********************************************************************/
|
||||
/*
|
||||
* HESERIES
|
||||
*
|
||||
* HE Fourier series generation
|
||||
* Implemented in glaceHeseries.c
|
||||
*/
|
||||
|
||||
/* Internal structure.
|
||||
*
|
||||
* A dummy definition is used for this structure.
|
||||
* The caller must preallocate it.
|
||||
*/
|
||||
|
||||
/* An unreasonable value for the series, used to flag errors */
|
||||
#define GLACE_HESERIES_ERRORFLAG (-1000000.0)
|
||||
|
||||
#define GLACE_HESERIES_RESERVE 100
|
||||
typedef struct Glace_HeseriesInfo
|
||||
{
|
||||
char dummy[GLACE_HESERIES_RESERVE];
|
||||
} Glace_HeseriesInfo;
|
||||
|
||||
void
|
||||
Glace_HeseriesInit (Glace_HeseriesInfo *heseriesPtr, float heFactor);
|
||||
double
|
||||
Glace_HeseriesVal (Glace_HeseriesInfo *heseriesPtr, int k);
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/* :*** Wrapper specific data ***:
|
||||
*/
|
||||
|
||||
# if defined(WRAPPER)
|
||||
# undef WRAPPER
|
||||
# endif
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: GLACE_PNM
|
||||
*/
|
||||
|
||||
#ifdef GLACE_PNM
|
||||
#
|
||||
typedef struct GlacePnmData
|
||||
{
|
||||
Glace_Gray **ddHImgPtrPtr, **ddVImgPtrPtr;
|
||||
Glace_Gray **inImgPtrPtr;
|
||||
Glace_Gray **refImgPtrPtr;
|
||||
|
||||
int errorValue;
|
||||
} GlacePnmData;
|
||||
#
|
||||
#
|
||||
# define WRAPPER(A) (((GlacePnmData *) wData)->A)
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: GLACE_GIMP
|
||||
*/
|
||||
|
||||
#ifdef GLACE_GIMP
|
||||
#
|
||||
typedef struct GlaceGimpData
|
||||
{
|
||||
/* Glace_Gray **ddHImgPtrPtr, **ddVImgPtrPtr; */
|
||||
/* Glace_Gray **inImgPtrPtr; / No, I don't have a clue as to how */
|
||||
/* Glace_Gray **refImgPtrPtr; / much of this is used, or where. [kmt] */
|
||||
/* [jas]: These are used in PNM to remember pointers to arrays */
|
||||
|
||||
Glace_Gray *dest_row;
|
||||
|
||||
/* Is this a good place to store these things? */
|
||||
/* [jas]: yes, this is exactly the place! */
|
||||
GPixelRgn dest_rgn_ptr;
|
||||
GDrawable *drawable_ptr;
|
||||
gint32 gimp_x0, gimp_y0;
|
||||
|
||||
guchar *gimpImgPtr;
|
||||
|
||||
int errorValue;
|
||||
} GlaceGimpData;
|
||||
#
|
||||
#
|
||||
# define WRAPPER(A) (((GlaceGimpData *) wData)->A)
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*
|
||||
* :+++++++: GLACE_TK
|
||||
*/
|
||||
|
||||
|
||||
#ifdef GLACE_TK
|
||||
#
|
||||
typedef struct GlaceTkData
|
||||
{
|
||||
Tk_PhotoImageBlock outputImageBlock;
|
||||
|
||||
Glace_Gray *outImgPtr;
|
||||
|
||||
Tcl_Interp *interp;
|
||||
int errorValue;
|
||||
} GlaceTkData;
|
||||
#
|
||||
#
|
||||
# define WRAPPER(A) (((GlaceTkData *) wData)->A)
|
||||
# define INTERP(A) ((GlaceTkData *) A)->interp
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,325 @@
|
|||
/* :PREAMBLE: GlaceG.c
|
||||
*
|
||||
* Wrapper-specific Code:
|
||||
* GIMP plug-in version
|
||||
*
|
||||
* Based on glaceT.c and glaceP.c by J.Alex Stark
|
||||
* g_ified by Kevin M. Turner
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. See the file COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/* :HEADERS:
|
||||
*/
|
||||
#ifndef GLACE_GIMP
|
||||
# define GLACE_GIMP
|
||||
#endif
|
||||
|
||||
#include "glaceInt.h"
|
||||
|
||||
#include <ctype.h> /* for tolower in keymatch */
|
||||
|
||||
/* Other things we're implementing
|
||||
* Included first, because glace.h needs to know about it.
|
||||
*/
|
||||
|
||||
/* :*** Internal Functions ***:
|
||||
* GlaceWMalloc,Realloc,Calloc, and Free
|
||||
* have been implemented as defines in an #ifdef block in glaceInt.h
|
||||
* Ugly, but true.
|
||||
*/
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
/* :*** Errors and Messages ***:
|
||||
|
||||
* :FUNCTION: Glace_WError
|
||||
*/
|
||||
int /* Sets error and returns error flag (but may exit) */
|
||||
Glace_WError (
|
||||
Glace_WData wData,
|
||||
char *argErrStr
|
||||
)
|
||||
{
|
||||
if (wData == NULL)
|
||||
g_warning ("Fatal error (error rountine called"
|
||||
" with invalid package data structure.");
|
||||
WRAPPER (errorValue) = GLACE_ERROR;
|
||||
|
||||
g_warning (argErrStr);
|
||||
|
||||
return GLACE_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* :FUNCTION: Glace_WErrorValue
|
||||
*/
|
||||
int /* Returns error flag */
|
||||
Glace_WErrorValue (
|
||||
Glace_WData wData
|
||||
)
|
||||
{
|
||||
return WRAPPER (errorValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* :FUNCTION: Glace_WIsError
|
||||
*/
|
||||
int /* Returns boolean */
|
||||
Glace_WIsError (
|
||||
Glace_WData wData
|
||||
)
|
||||
{
|
||||
return (WRAPPER (errorValue) == GLACE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* :FUNCTION: Glace_WMessage
|
||||
*/
|
||||
void
|
||||
Glace_WMessage (
|
||||
GLACE_OVAR(Glace_WData wData),
|
||||
char *messageStr)
|
||||
{
|
||||
fprintf (stderr, "%s", messageStr);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
/* :*** Wrapper-specific Setup ***:
|
||||
|
||||
* :FUNCTION: Glace_WInit
|
||||
*/
|
||||
void
|
||||
Glace_WInit (
|
||||
GLACE_OVAR(Glace_WData wData))
|
||||
{
|
||||
#ifdef __EMX__
|
||||
_fsetmode (stdin, "b");
|
||||
_fsetmode (stdout, "b");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
/*
|
||||
* :FUNCTION: Glace_WWrapTell
|
||||
*/
|
||||
Glace_WrapTypes
|
||||
Glace_WWrapTell()
|
||||
{
|
||||
return GLACE_GIMP_VER;
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
/*
|
||||
* :FUNCTION: Glace_WDataAlloc
|
||||
*/
|
||||
Glace_WData
|
||||
Glace_WDataAlloc ()
|
||||
{
|
||||
return (Glace_WData) GlaceWMalloc (sizeof (GlaceGimpData));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* :*** Argument Parsing and Warning ***:
|
||||
|
||||
* :FUNCTION: Glace_WKeyMatch
|
||||
*
|
||||
* NB This is an independent rewrite of PBMPLUS routine,
|
||||
* just to be sure about copyright issues. [Alex]
|
||||
*
|
||||
* (Probably not necessary for GIMP version. Feel free to substitute
|
||||
* pm_keymatch back in...) [kmt]
|
||||
*/
|
||||
int
|
||||
Glace_WKeyMatch(
|
||||
char* str,
|
||||
char* keyword,
|
||||
int minchars
|
||||
)
|
||||
{
|
||||
int i, slen;
|
||||
|
||||
slen = strlen(str);
|
||||
|
||||
if (slen < minchars)
|
||||
return 0;
|
||||
|
||||
else if (slen > (int) strlen(keyword))
|
||||
return 0;
|
||||
|
||||
else
|
||||
for (i=0; i<slen; i++)
|
||||
if (tolower(str[i]) != tolower(keyword[i]))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
/*
|
||||
* :FUNCTION: Glace_WUsage
|
||||
*/
|
||||
void
|
||||
Glace_WUsage(
|
||||
Glace_WData wData,
|
||||
char* usage
|
||||
)
|
||||
{
|
||||
Glace_WMessage(wData, usage);
|
||||
WRAPPER(errorValue) = GLACE_ERROR;
|
||||
}
|
||||
|
||||
/* :*** Image Input and Output ***:
|
||||
|
||||
* :FUNCTION: FIXME Glace_WOpenImage
|
||||
*/
|
||||
void
|
||||
Glace_WOpenImage(GLACE_OVAR(Glace_WData wData),
|
||||
GLACE_OVAR(Glace_CfgInfo *cfgInfoPtr),
|
||||
char *name,
|
||||
Glace_ImageHandle *handlePtr
|
||||
)
|
||||
{
|
||||
/* g_print(" *** Glace_WOpenImage doesn't do jack! ***\n"); */
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
/*
|
||||
* :FUNCTION: FIXME Glace_WPutImgStart
|
||||
* Here we initalize a pixel region to write to,
|
||||
* and set the output pointer to the temp space.
|
||||
*/
|
||||
void
|
||||
Glace_WPutImgStart(
|
||||
GLACE_OVAR(Glace_WData wData),
|
||||
GLACE_OVAR(Glace_CfgInfo *cfgInfoPtr),
|
||||
Glace_ImgArrays *imgArraysPtr
|
||||
)
|
||||
{
|
||||
/* gimp_pixel_rgn_init (GPixelRgn *pr,
|
||||
GDrawable *drawable,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
int dirty,
|
||||
int shadow) */
|
||||
|
||||
/* puts(" *** I am Glace_WPutImgStart, here me roar! ***"); */
|
||||
|
||||
gimp_pixel_rgn_init(&WRAPPER(dest_rgn_ptr),
|
||||
WRAPPER(drawable_ptr),
|
||||
WRAPPER(gimp_x0), WRAPPER(gimp_y0),
|
||||
GLACE_IMG(cols), GLACE_IMG(rows),
|
||||
TRUE, TRUE);
|
||||
|
||||
/* GLACE_IMG(putImgRowPtr)=(Glace_Gray *)GLACE_IMG(tmpImgPtr); */
|
||||
|
||||
GLACE_IMG(putImgRowPtr) = WRAPPER(gimpImgPtr);
|
||||
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
/*
|
||||
* :FUNCTION: Glace_WPutImgRowStart
|
||||
* (we don't use it)
|
||||
*/
|
||||
void
|
||||
Glace_WPutImgRowStart(
|
||||
GLACE_OVAR(Glace_WData wData),
|
||||
GLACE_OVAR(Glace_CfgInfo *cfgInfoPtr),
|
||||
GLACE_OVAR(Glace_ImgArrays *imgArraysPtr),
|
||||
GLACE_OVAR(int row)
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* :FUNCTION: FIXME Glace_WPutImgRowFinish
|
||||
* It *should* take the row of data that has been produced and
|
||||
* give it to the Gimp. I think it does this, but the output
|
||||
* sure doesn't look right.
|
||||
*/
|
||||
void
|
||||
Glace_WPutImgRowFinish (
|
||||
GLACE_OVAR(Glace_WData wData),
|
||||
Glace_CfgInfo *cfgInfoPtr,
|
||||
Glace_ImgArrays * imgArraysPtr,
|
||||
GLACE_OVAR(int row)
|
||||
)
|
||||
{
|
||||
/* If we were outputting by row, we'd do this: */
|
||||
/* gimp_pixel_rgn_set_row (GPixelRgn *pr,
|
||||
guchar *buf,
|
||||
int x,
|
||||
int y,
|
||||
int width) */
|
||||
|
||||
/* gimp_pixel_rgn_set_row(&WRAPPER(dest_rgn_ptr),
|
||||
GLACE_IMG(putImgRowPtr),
|
||||
WRAPPER(gimp_x0),
|
||||
WRAPPER(gimp_y0) + row,
|
||||
GLACE_IMG(cols));*/
|
||||
|
||||
/* But we're writing it all to a temp buffer instead... */
|
||||
/* Faster, and the temp buffer is already allocated. */
|
||||
|
||||
GLACE_IMG(putImgRowPtr) += GLACE_IMG(cols) * WRAPPER(drawable_ptr)->bpp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* :FUNCTION: Glace_WPutImgFinish
|
||||
*/
|
||||
void
|
||||
Glace_WPutImgFinish (
|
||||
GLACE_OVAR(Glace_WData wData),
|
||||
GLACE_OVAR(Glace_CfgInfo *cfgInfoPtr),
|
||||
GLACE_OVAR(Glace_ImgArrays * imgArraysPtr)
|
||||
)
|
||||
{
|
||||
/* g_print("*** Glace_WPutImgFinish coming through. ***\n"); */
|
||||
|
||||
|
||||
/* We could do something like this to write the entire image
|
||||
at one time instead of row by row. */
|
||||
|
||||
gimp_pixel_rgn_set_rect (&WRAPPER(dest_rgn_ptr),
|
||||
WRAPPER(gimpImgPtr),
|
||||
WRAPPER(gimp_x0), WRAPPER(gimp_y0),
|
||||
GLACE_IMG(cols), GLACE_IMG(rows));
|
||||
|
||||
gimp_drawable_flush (WRAPPER(drawable_ptr));
|
||||
gimp_drawable_merge_shadow (WRAPPER(drawable_ptr)->id, TRUE);
|
||||
gimp_drawable_update (WRAPPER(drawable_ptr)->id,
|
||||
WRAPPER(gimp_x0), WRAPPER(gimp_y0),
|
||||
GLACE_IMG(cols), GLACE_IMG(rows));
|
||||
gimp_drawable_detach (WRAPPER(drawable_ptr));
|
||||
gimp_displays_flush();
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. See the file COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "glace.h"
|
||||
|
||||
/* GLACE_GIMP implements these as macros, not functions. */
|
||||
/* But this is wrapper-specific stuff, so that should be okay, right? */
|
||||
/*
|
||||
* The alternative would be just to #ifdef them out and define macros
|
||||
* in glaceG.c [jas].
|
||||
*/
|
||||
#ifdef GLACE_GIMP
|
||||
#define GlaceWMalloc(size) g_malloc(size)
|
||||
#define GlaceWRealloc(p, size) g_realloc(p, size)
|
||||
#define GlaceWCalloc(nObj, size) g_malloc0((size) * (nObj))
|
||||
#define GlaceWFree(ptr) g_free(ptr)
|
||||
#else
|
||||
void *GlaceWMalloc(size_t size);
|
||||
void *GlaceWRealloc(void *p,size_t size);
|
||||
void *GlaceWCalloc(size_t nObj, size_t size);
|
||||
void GlaceWFree(void *p);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if __STDC__
|
||||
#define ARGS(alist) alist
|
||||
#else /*__STDC__*/
|
||||
#define ARGS(alist) ()
|
||||
#define const
|
||||
#endif /*__STDC__*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* For glaceCfg.c
|
||||
*/
|
||||
|
||||
#define HLB 15
|
||||
#define BIG_TMP_BITS 31
|
||||
#define MID_TMP_BITS 15
|
||||
#define ACC_BITS 14
|
||||
#define OUT_BITS 8
|
||||
#define AFT_FILTVAL ldexp(255.0, BIG_TMP_BITS-8)
|
||||
#define MAFT_FILTVAL ldexp(255.0, MID_TMP_BITS-8)
|
||||
#define BSHIFT (BIG_TMP_BITS-HLB)
|
||||
#define MSHIFT (MID_TMP_BITS-HLB)
|
||||
#define NOT_FILTVAL ldexp(255.0, HLB-8-1)
|
||||
#define FORCE_NO_BIT_SHIFT (-1000)
|
||||
#define MAX_BIT_SHIFT (32)
|
||||
|
||||
#define MAX_MESSAGE_LEN 150
|
|
@ -109,8 +109,8 @@ query (void)
|
|||
INIT_I18N();
|
||||
gimp_install_procedure ("plug-in-rotate-colormap",
|
||||
_("Colormap rotation as in xv"),
|
||||
_("Exchanges two color ranges."
|
||||
"Based on code from Pavel Grinfeld (pavel@ml.com)."
|
||||
_("Exchanges two color ranges. "
|
||||
"Based on code from Pavel Grinfeld (pavel@ml.com). "
|
||||
"This version written by Sven Anders (anderss@fmi.uni-passau.de)."),
|
||||
"Sven Anders (anderss@fmi.uni-passau.de) and Pavel Grinfeld (pavel@ml.com)",
|
||||
"Sven Anders (anderss@fmi.uni-passau.de)",
|
||||
|
|
Loading…
Reference in New Issue