Initial revision

parent c7a60e7a
*.lo
*.la
.deps
.libs
INSTALL
Makefile
Makefile.in
aclocal.m4
confdefs.h
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
install-sh
libtool
ltconfig
ltmain.sh
missing
mkinstalldirs
stamp-h
stamp-h.in
testgegl
gegl-config
This diff is collapsed.
Thu Jan 20 09:20:48 PST 2000 calvinw@mindspring.com
* initial import
* The following classes have initial versions:
GeglObject -- base class for gegl classes
GeglOp -- class for operators
GeglPointOp -- operators that only need (x,y) to compute pixel (x,y)
GeglFillOp -- fills images with a color
GeglPrintOp -- prints out the pixel values of an image (floats only now)
GeglImageBuffers -- buffers for image data and pointers to data
GeglColorModel -- ColorSpace, color channels, alpha info, data type
GeglColorModelRgb -- subclass of RGB color models
GeglColorModelRgbFloat -- floating pt channels RGB color model
GeglColor -- stores channels for a single color
* There is a small test program -- testgegl
SUBDIRS = gegl
bin_SCRIPTS = \
gegl-config
EXTRA_DIST = \
gegl.m4 \
geglConf.sh.in \
gegl-config.in
m4datadir = $(datadir)/aclocal
m4data_DATA = gegl.m4
## Put `exec' in the name because this should be installed by
## `install-exec', not `install-data'.
confexecdir=$(libdir)
You must use Gob 0.92.1 with gegl-0.0.2 and you should apply the patch
patch_for_gob-0.92.1 that is in this directory to the main.c of gob when you
build it.
This has to do with a fix for circular headers created by gob in some cases,
but which isnt completely worked out yet (or which I dont understand how to
make gob do yet).
There is some support for remaking generated .c and .h files automatically.
Look in src directory gegl/Makefile.am for rules at the bottom.
>make clean only removes *.o's but not .h's or .c's or .gobs
>make gobclean removes the generated .c and .h files by gob, and leaves .gobs
>make gobs builds all generated .c and .h files from .gobs
Dependencies more or less work so if you edit a gob file, the make will pick up
that depend and rerun gob for you before compiling, but the very first build
seems to have trouble sometimes. (.deps files problem somehow). Just cd to
the gegl dir and do a make gobs for the first time.
The testgegl file just creates some operators and runs them. There is a PrintOp
for debugging. See testgegl.c for details.
calvinw@mindspring.com
#undef PACKAGE
#undef VERSION
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
DIE=0
PROJECT=GEGL
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
THISDIR="`pwd`"
cd $srcdir
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $PROJECT."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
# Do we really need libtool?
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile $PROJECT."
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have automake installed to compile $PROJECT."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
for dir in .
do
echo processing $dir
(cd $dir; \
aclocalinclude="$ACLOCAL_FLAGS"; \
aclocal $aclocalinclude; \
autoheader; automake --add-missing --gnu $am_opt; autoconf)
done
cd $THISDIR
$srcdir/configure "$@"
echo
echo "Now type 'make' to compile $PROJECT."
AC_INIT(gegl/gegl-object.gob)
AM_CONFIG_HEADER(config.h)
GEGL_MAJOR_VERSION=0
GEGL_MINOR_VERSION=0
GEGL_MICRO_VERSION=2
GEGL_VERSION=$GEGL_MAJOR_VERSION.$GEGL_MINOR_VERSION.$GEGL_MICRO_VERSION
GEGL_VERSION_INFO=`expr $GEGL_MAJOR_VERSION + $GEGL_MINOR_VERSION`:$GEGL_MICRO_VERSION:$GEGL_MINOR_VERSION
AC_SUBST(GEGL_MAJOR_VERSION)
AC_SUBST(GEGL_MINOR_VERSION)
AC_SUBST(GEGL_MICRO_VERSION)
AC_SUBST(GEGL_VERSION)
AC_SUBST(GEGL_VERSION_INFO)
VERSION=$GEGL_VERSION
AM_INIT_AUTOMAKE(libgegl, $VERSION)
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
, enable_ansi=no)
AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL
AM_MAINTAINER_MODE
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
fi
changequote([,])dnl
dnl Check for GTK+
AM_PATH_GTK(1.2.6,,
AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
changequote(,)dnl
dnl Evil stuff to extract GLIB stuff from gtk-config output
dnl (we want to make sure it matches with the gtk we're using)
GLIB_CFLAGS=`echo $GTK_CFLAGS | sed 's/^.*\(-I[^ ]*glib[^ ]* *-I[^ ]*\).*$/\1/'`
GLIB_LDFLAGS=`echo $GTK_LIBS | sed -e 's/^.*-lgdk[^ ]* *\(-L[^ ]*\).*$/\1/' -e 's/^.* -lgdk[^ ]* .*$//'`
if test -z "$GLIB_LDFLAGS" ; then
GLIB_LDFLAGS=`echo $GTK_LIBS | sed 's/^ *\(-L[^ ]*\) .*$/\1/'`
fi
GLIB_LIBS="$GLIB_LDFLAGS `echo $GTK_LIBS | sed 's/^.*\(-lglib[^ ]*\).*$/\1/'`"
if eval "test x$GCC = xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
fi
changequote([,])dnl
GEGL_LIBDIR='-L${libdir}'
GEGL_INCLUDEDIR='-I${includedir}'
GEGL_LIBS='-lgegl'
CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
LDFLAGS="$LDFLAGS `echo $GTK_LIBS | sed 's/\(.*\)\(-lgtk.*\)/\1/'`"
LIBS="$LIBS $GTK_LIBS"
AC_SUBST(GEGL_LIBDIR)
AC_SUBST(GEGL_INCLUDEDIR)
AC_SUBST(GEGL_LIBS)
AC_OUTPUT([
Makefile
gegl/Makefile
gegl-config], [case "$CONFIG_FILES" in *gegl-config*) chmod +x gegl-config;; esac])
#!/bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no
usage="\
Usage: gegl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo @GEGL_VERSION@
;;
--cflags)
if test @includedir@ != /usr/include ; then
includes=-I@includedir@
fi
echo $includes
;;
--libs)
libdirs=-L@libdir@
echo $libdirs -lgegl -lm
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
# Configure paths for GEGL
# Calvin Williamson
# stolen from Raph Levien 98-11-18
# stolen from Manish Singh 98-9-30
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_GEGL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for GEGL, and define GEGL_CFLAGS and GEGL_LIBS
dnl
AC_DEFUN(AM_PATH_GEGL,
[dnl
dnl Get the cflags and libraries from the gegl-config script
dnl
AC_ARG_WITH(gegl-prefix,[ --with-gegl-prefix=PFX Prefix where GEGL is installed (optional)],
gegl_prefix="$withval", gegl_prefix="")
AC_ARG_WITH(gegl-exec-prefix,[ --with-gegl-exec-prefix=PFX Exec prefix where GEGL is installed (optional)],
gegl_exec_prefix="$withval", gegl_exec_prefix="")
AC_ARG_ENABLE(gegltest, [ --disable-gegltest Do not try to compile and run a test GEGL program],
, enable_gegltest=yes)
if test x$gegl_exec_prefix != x ; then
gegl_args="$gegl_args --exec-prefix=$gegl_exec_prefix"
if test x${GEGL_CONFIG+set} != xset ; then
GEGL_CONFIG=$gegl_exec_prefix/bin/gegl-config
fi
fi
if test x$gegl_prefix != x ; then
gegl_args="$gegl_args --prefix=$gegl_prefix"
if test x${GEGL_CONFIG+set} != xset ; then
GEGL_CONFIG=$gegl_prefix/bin/gegl-config
fi
fi
AC_PATH_PROG(GEGL_CONFIG, gegl-config, no)
min_gegl_version=ifelse([$1], ,0.2.5,$1)
AC_MSG_CHECKING(for GEGL - version >= $min_gegl_version)
no_gegl=""
if test "$GEGL_CONFIG" = "no" ; then
no_gegl=yes
else
GEGL_CFLAGS=`$GEGL_CONFIG $geglconf_args --cflags`
GEGL_LIBS=`$GEGL_CONFIG $geglconf_args --libs`
gegl_major_version=`$GEGL_CONFIG $gegl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
gegl_minor_version=`$GEGL_CONFIG $gegl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
gegl_micro_version=`$GEGL_CONFIG $gegl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gegltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GEGL_CFLAGS"
LIBS="$LIBS $GEGL_LIBS"
dnl
dnl Now check if the installed GEGL is sufficiently new. (Also sanity
dnl checks the results of gegl-config to some extent
dnl
rm -f conf.gegltest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gegl/gegl.h>
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.gegltest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_gegl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gegl_version");
exit(1);
}
if (($gegl_major_version > major) ||
(($gegl_major_version == major) && ($gegl_minor_version > minor)) ||
(($gegl_major_version == major) && ($gegl_minor_version == minor) && ($gegl_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'gegl-config --version' returned %d.%d.%d, but the minimum version\n", $gegl_major_version, $gegl_minor_version, $gegl_micro_version);
printf("*** of GEGL required is %d.%d.%d. If gegl-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If gegl-config was wrong, set the environment variable GEGL_CONFIG\n");
printf("*** to point to the correct copy of gegl-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_gegl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_gegl" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$GEGL_CONFIG" = "no" ; then
echo "*** The gegl-config script installed by GEGL could not be found"
echo "*** If GEGL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the GEGL_CONFIG environment variable to the"
echo "*** full path to gegl-config."
else
if test -f conf.gegltest ; then
:
else
echo "*** Could not run GEGL test program, checking why..."
CFLAGS="$CFLAGS $GEGL_CFLAGS"
LIBS="$LIBS $GEGL_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <gegl/gegl.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GEGL or finding the wrong"
echo "*** version of GEGL. If it is not finding GEGL, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GEGL was incorrectly installed"
echo "*** or that you have moved GEGL since it was installed. In the latter case, you"
echo "*** may want to edit the gegl-config script: $GEGL_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GEGL_CFLAGS=""
GEGL_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GEGL_CFLAGS)
AC_SUBST(GEGL_LIBS)
rm -f conf.gegltest
])
noinst_PROGRAMS = testgegl
lib_LTLIBRARIES = libgegl.la
GOB = \
gegl-object.gob \
gegl-color-model.gob \
gegl-color-model-rgb.gob \
gegl-color-model-rgb-float.gob \
gegl-image-buffer.gob \
gegl-op.gob \
gegl-point-op.gob \
gegl-print-op.gob \
gegl-color.gob \
gegl-graphics-state.gob \
gegl-fill-op.gob
GOB_SRC = \
gegl-object.c \
gegl-color-model.c \
gegl-color-model-rgb.c \
gegl-color-model-rgb-float.c \
gegl-image-buffer.c \
gegl-op.c \
gegl-point-op.c \
gegl-print-op.c \
gegl-color.c \
gegl-graphics-state.c \
gegl-fill-op.c
GOB_PUBLIC_H = \
gegl-object.h \
gegl-color-model.h \
gegl-color-model-rgb.h \
gegl-color-model-rgb-float.h \
gegl-image-buffer.h \
gegl-op.h \
gegl-point-op.h \
gegl-print-op.h \
gegl-color.h \
gegl-graphics-state.h \
gegl-fill-op.h
libgegl_la_SOURCES = \
$(GOB_SRC) \
gegl-utils.c
libgegl_la_LDFLAGS = -version-info @GEGL_VERSION_INFO@
libgeglincdir = $(includedir)/gegl
libgeglinc_HEADERS = $(GOB_PUBLIC_H)
INCLUDES = -I$(top_srcdir) -I$(top_builddir) -DGEGL_COMPILATION
DEPS = libgegl.la
LDADDS = libgegl.la
testgegl_SOURCES=testgegl.c
testgegl_LDFLAGS =
testgegl_DEPENDENCIES = $(DEPS)
testgegl_LDADD = $(LDADDS) -lm
tests: testgegl
%.c: %.gob
gob $<
%.h: %.gob
gob $<
%-private.h: %.gob
gob $<
distclean:
$(MAKE) clean
rm -f $(GOB_PUBLIC_H) $(GOB_SRC) *-private.h
gobclean:
rm -f $(GOB_PUBLIC_H) $(GOB_SRC) *-private.h
gobs:
for blah in $(GOB); do \
gob $$blah; \
done
%h{
#include "gegl-color-model-rgb.h"
%}
%{
#include "gegl-color-model-rgb-float.h"
#include "gegl-color-model-rgb-float-private.h"
#include "gegl-color-model-rgb-private.h"
#include "gegl-color-model-private.h"
#include "gegl-color.h"
#if 0
extern GeglChannelValue *gegl_color_get_channel_values(GeglColor *);
#endif
%}
class Gegl:Color:Model:Rgb:Float from Gegl:Color:Model:Rgb {
public
GeglColorModelRgbFloat *
new(gboolean has_alpha)
{
GeglColorModelRgbFloat * self = GEGL_COLOR_MODEL_RGB_FLOAT(GET_NEW);
/*Call the constructor */
if (!constructor(self, has_alpha))
return NULL;
/*Okay its constructed*/
GEGL_OBJECT(self)->constructed = TRUE;
return self;
}
protected
gboolean
constructor(self, gboolean has_alpha)
{
GeglColorModelPrivate *color_modelP = (GeglColorModelPrivate*)
(GEGL_COLOR_MODEL (self)->_priv);
if (GEGL_OBJECT(self)->constructed)
return FALSE;
/* Chain up to superclass*/
if (!gegl_color_model_rgb_constructor (
GEGL_COLOR_MODEL_RGB(self), has_alpha))
return FALSE;
color_modelP->data_type = FLOAT;
color_modelP->channel_data_type_name = NULL;
color_modelP->bytes_per_channel = 4;
color_modelP->bytes_per_pixel =
color_modelP->bytes_per_channel *
color_modelP->num_channels;
return TRUE;
}
override (Gtk:Object)
void
destroy (GtkObject *object)
{
/* Dispose of the data type string here */
/* Chain up on destroy */
PARENT_HANDLER (object)
}
override (Gegl:Color:Model)
void
set_color (GeglColorModel *cm,
GeglColor *color,
GeglColorConstant constant)
{
GeglChannelValue * channel_values =
gegl_color_get_channel_values(color);
gboolean has_alpha = gegl_color_model_has_alpha (cm);
GeglColorModelRgb * cm_rgb = GEGL_COLOR_MODEL_RGB(cm);
gint r = gegl_color_model_rgb_get_red_index (cm_rgb);
gint g = gegl_color_model_rgb_get_green_index (cm_rgb);
gint b = gegl_color_model_rgb_get_blue_index (cm_rgb);
gint a = gegl_color_model_alpha_channel (GEGL_COLOR_MODEL(cm_rgb));
switch (constant)
{
case COLOR_WHITE:
channel_values[r].f = 1.0;
channel_values[g].f = 1.0;
channel_values[b].f = 1.0;
if (has_alpha)
channel_values[a].f = 1.0;
break;
case COLOR_BLACK:
channel_values[r].f = 0.0;
channel_values[g].f = 0.0;
channel_values[b].f = 0.0;
if (has_alpha)
channel_values[a].f = 1.0;
break;
case COLOR_RED:
channel_values[r].f = 1.0;
channel_values[g].f = 0.0;
channel_values[b].f = 0.0;
if (has_alpha)
channel_values[a].f = 1.0;
break;
case COLOR_GREEN:
channel_values[r].f = 0.0;
channel_values[g].f = 1.0;
channel_values[b].f = 0.0;
if (has_alpha)
channel_values[a].f = 1.0;
break;
case COLOR_BLUE:
channel_values[r].f = 0.0;
channel_values[g].f = 0.0;
channel_values[b].f = 1.0;
if (has_alpha)
channel_values[a].f = 1.0;
break;
case COLOR_GRAY:
case COLOR_HALF_WHITE:
channel_values[r].f = 0.5;
channel_values[g].f = 0.5;
channel_values[b].f = 0.5;
if (has_alpha)
channel_values[a].f = 1.0;
break;
case COLOR_WHITE_TRANSPARENT:
channel_values[r].f = 1.0;
channel_values[g].f = 1.0;
channel_values[b].f = 1.0;
if (!has_alpha)
channel_values[a].f = 0.0;
break;
case COLOR_TRANSPARENT:
case COLOR_BLACK_TRANSPARENT:
channel_values[r].f = 0.0;
channel_values[g].f = 0.0;
channel_values[b].f = 0.0;
if (has_alpha)
channel_values[a].f = 0.0;
break;
}
}
}
%h{
#ifndef __GEGL_COLOR_F_H__
#define __GEGL_COLOR_F_H__
typedef struct _GeglColor GeglColor;
#endif
#include "gegl-color-model.h"
%}
%{
#include "gegl-color-model-rgb.h"
#include "gegl-color-model-rgb-private.h"
#include "gegl-color-model-private.h"
%}
class Gegl:Color:Model:Rgb from Gegl:Color:Model {
private gint red_index;
private gint green_index;
private gint blue_index;
protected
gboolean
constructor(self, gboolean has_alpha)
{
GeglColorModelPrivate *color_modelP =
(GeglColorModelPrivate*)(GEGL_COLOR_MODEL (self)->_priv);
if (GEGL_OBJECT(self)->constructed)
return FALSE;
/* Chain up to superclass*/
if (!gegl_color_model_constructor (GEGL_COLOR_MODEL(self), has_alpha))
return FALSE;
if (color_modelP->has_alpha)
{
color_modelP->alpha_channel = 3;
color_modelP->num_channels = 4;
}
else
{
color_modelP->alpha_channel = -1;
color_modelP->num_channels = 3;
}
/* We can set these here */
color_modelP->colorspace = RGB;
color_modelP->is_additive = TRUE;
color_modelP->color_space_name = NULL;