diff options
Diffstat (limited to '')
-rw-r--r-- | plug-ins/file-fli/Makefile.am | 49 | ||||
-rw-r--r-- | plug-ins/file-fli/Makefile.in | 1003 | ||||
-rw-r--r-- | plug-ins/file-fli/fli-gimp.c | 984 | ||||
-rw-r--r-- | plug-ins/file-fli/fli.c | 1033 | ||||
-rw-r--r-- | plug-ins/file-fli/fli.h | 153 |
5 files changed, 3222 insertions, 0 deletions
diff --git a/plug-ins/file-fli/Makefile.am b/plug-ins/file-fli/Makefile.am new file mode 100644 index 0000000..55e6322 --- /dev/null +++ b/plug-ins/file-fli/Makefile.am @@ -0,0 +1,49 @@ +## Process this file with automake to produce Makefile.in + +libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la +libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la +libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la +libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la + +if OS_WIN32 +mwindows = -mwindows +endif + +if HAVE_WINDRES +include $(top_srcdir)/build/windows/gimprc-plug-ins.rule +file_fli_RC = file-fli.rc.o +endif + +AM_LDFLAGS = $(mwindows) + +libexecdir = $(gimpplugindir)/plug-ins/file-fli + +libexec_PROGRAMS = file-fli + +file_fli_SOURCES = \ + fli.h \ + fli.c \ + fli-gimp.c + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + $(GTK_CFLAGS) \ + $(GEGL_CFLAGS) \ + -I$(includedir) + +LDADD = \ + $(libgimpui) \ + $(libgimpwidgets) \ + $(libgimpconfig) \ + $(libgimp) \ + $(libgimpcolor) \ + $(libgimpmath) \ + $(libgimpbase) \ + $(GTK_LIBS) \ + $(GEGL_LIBS) \ + $(RT_LIBS) \ + $(INTLLIBS) \ + $(file_fli_RC) diff --git a/plug-ins/file-fli/Makefile.in b/plug-ins/file-fli/Makefile.in new file mode 100644 index 0000000..03b35e4 --- /dev/null +++ b/plug-ins/file-fli/Makefile.in @@ -0,0 +1,1003 @@ +# Makefile.in generated by automake 1.16.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 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. + +@SET_MAKE@ + +# Version resources for Microsoft Windows + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +libexec_PROGRAMS = file-fli$(EXEEXT) +subdir = plug-ins/file-fli +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4macros/gtk-doc.m4 \ + $(top_srcdir)/m4macros/intltool.m4 \ + $(top_srcdir)/m4macros/libtool.m4 \ + $(top_srcdir)/m4macros/ltoptions.m4 \ + $(top_srcdir)/m4macros/ltsugar.m4 \ + $(top_srcdir)/m4macros/ltversion.m4 \ + $(top_srcdir)/m4macros/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/m4macros/alsa.m4 \ + $(top_srcdir)/m4macros/ax_compare_version.m4 \ + $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \ + $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \ + $(top_srcdir)/m4macros/detectcflags.m4 \ + $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(libexecdir)" +PROGRAMS = $(libexec_PROGRAMS) +am_file_fli_OBJECTS = fli.$(OBJEXT) fli-gimp.$(OBJEXT) +file_fli_OBJECTS = $(am_file_fli_OBJECTS) +file_fli_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +file_fli_DEPENDENCIES = $(libgimpui) $(libgimpwidgets) \ + $(libgimpconfig) $(libgimp) $(libgimpcolor) $(libgimpmath) \ + $(libgimpbase) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(file_fli_RC) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/fli-gimp.Po ./$(DEPDIR)/fli.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(file_fli_SOURCES) +DIST_SOURCES = $(file_fli_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/build/windows/gimprc-plug-ins.rule \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +AA_LIBS = @AA_LIBS@ +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALL_LINGUAS = @ALL_LINGUAS@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPSTREAM_UTIL = @APPSTREAM_UTIL@ +AR = @AR@ +AS = @AS@ +ATK_CFLAGS = @ATK_CFLAGS@ +ATK_LIBS = @ATK_LIBS@ +ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BABL_CFLAGS = @BABL_CFLAGS@ +BABL_LIBS = @BABL_LIBS@ +BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@ +BUG_REPORT_URL = @BUG_REPORT_URL@ +BUILD_EXEEXT = @BUILD_EXEEXT@ +BUILD_OBJEXT = @BUILD_OBJEXT@ +BZIP2_LIBS = @BZIP2_LIBS@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@ +CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@ +CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@ +CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CC_VERSION = @CC_VERSION@ +CFLAGS = @CFLAGS@ +CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DESKTOP_DATADIR = @DESKTOP_DATADIR@ +DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@ +DLLTOOL = @DLLTOOL@ +DOC_SHOOTER = @DOC_SHOOTER@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_AA = @FILE_AA@ +FILE_EXR = @FILE_EXR@ +FILE_HEIF = @FILE_HEIF@ +FILE_JP2_LOAD = @FILE_JP2_LOAD@ +FILE_MNG = @FILE_MNG@ +FILE_PDF_SAVE = @FILE_PDF_SAVE@ +FILE_PS = @FILE_PS@ +FILE_WMF = @FILE_WMF@ +FILE_XMC = @FILE_XMC@ +FILE_XPM = @FILE_XPM@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@ +FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GDBUS_CODEGEN = @GDBUS_CODEGEN@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@ +GEGL = @GEGL@ +GEGL_CFLAGS = @GEGL_CFLAGS@ +GEGL_LIBS = @GEGL_LIBS@ +GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@ +GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GEXIV2_CFLAGS = @GEXIV2_CFLAGS@ +GEXIV2_LIBS = @GEXIV2_LIBS@ +GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@ +GIMP_API_VERSION = @GIMP_API_VERSION@ +GIMP_APP_VERSION = @GIMP_APP_VERSION@ +GIMP_BINARY_AGE = @GIMP_BINARY_AGE@ +GIMP_COMMAND = @GIMP_COMMAND@ +GIMP_DATA_VERSION = @GIMP_DATA_VERSION@ +GIMP_FULL_NAME = @GIMP_FULL_NAME@ +GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@ +GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@ +GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@ +GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@ +GIMP_MKENUMS = @GIMP_MKENUMS@ +GIMP_MODULES = @GIMP_MODULES@ +GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@ +GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@ +GIMP_PLUGINS = @GIMP_PLUGINS@ +GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@ +GIMP_REAL_VERSION = @GIMP_REAL_VERSION@ +GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@ +GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@ +GIMP_UNSTABLE = @GIMP_UNSTABLE@ +GIMP_USER_VERSION = @GIMP_USER_VERSION@ +GIMP_VERSION = @GIMP_VERSION@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@ +GIO_UNIX_LIBS = @GIO_UNIX_LIBS@ +GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@ +GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@ +GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@ +GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GS_LIBS = @GS_LIBS@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@ +GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@ +GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@ +GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@ +GUDEV_CFLAGS = @GUDEV_CFLAGS@ +GUDEV_LIBS = @GUDEV_LIBS@ +HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ +HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ +HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@ +HAVE_CXX14 = @HAVE_CXX14@ +HAVE_FINITE = @HAVE_FINITE@ +HAVE_ISFINITE = @HAVE_ISFINITE@ +HAVE_VFORK = @HAVE_VFORK@ +HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@ +ISO_CODES_LOCATION = @ISO_CODES_LOCATION@ +JPEG_LIBS = @JPEG_LIBS@ +JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@ +JSON_GLIB_LIBS = @JSON_GLIB_LIBS@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ +LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@ +LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@ +LIBHEIF_LIBS = @LIBHEIF_LIBS@ +LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@ +LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@ +LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@ +LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@ +LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LT_VERSION_INFO = @LT_VERSION_INFO@ +LZMA_CFLAGS = @LZMA_CFLAGS@ +LZMA_LIBS = @LZMA_LIBS@ +MAIL = @MAIL@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@ +MIME_INFO_LIBS = @MIME_INFO_LIBS@ +MIME_TYPES = @MIME_TYPES@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@ +MNG_CFLAGS = @MNG_CFLAGS@ +MNG_LIBS = @MNG_LIBS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@ +MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@ +NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@ +NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENEXR_CFLAGS = @OPENEXR_CFLAGS@ +OPENEXR_LIBS = @OPENEXR_LIBS@ +OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@ +OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@ +OPENJPEG_LIBS = @OPENJPEG_LIBS@ +OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@ +PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@ +PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@ +PATHSEP = @PATHSEP@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@ +PERL_VERSION = @PERL_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_LIBS = @PNG_LIBS@ +POFILES = @POFILES@ +POPPLER_CFLAGS = @POPPLER_CFLAGS@ +POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@ +POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@ +POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@ +POPPLER_LIBS = @POPPLER_LIBS@ +POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYBIN_PATH = @PYBIN_PATH@ +PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ +PYCAIRO_LIBS = @PYCAIRO_LIBS@ +PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@ +PYGTK_CFLAGS = @PYGTK_CFLAGS@ +PYGTK_CODEGEN = @PYGTK_CODEGEN@ +PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ +PYGTK_LIBS = @PYGTK_LIBS@ +PYLINK_LIBS = @PYLINK_LIBS@ +PYTHON = @PYTHON@ +PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@ +RT_LIBS = @RT_LIBS@ +SCREENSHOT_LIBS = @SCREENSHOT_LIBS@ +SED = @SED@ +SENDMAIL = @SENDMAIL@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCKET_LIBS = @SOCKET_LIBS@ +SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@ +SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@ +SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@ +STRIP = @STRIP@ +SVG_CFLAGS = @SVG_CFLAGS@ +SVG_LIBS = @SVG_LIBS@ +SYMPREFIX = @SYMPREFIX@ +TIFF_LIBS = @TIFF_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WEBKIT_CFLAGS = @WEBKIT_CFLAGS@ +WEBKIT_LIBS = @WEBKIT_LIBS@ +WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@ +WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@ +WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@ +WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@ +WEBPMUX_LIBS = @WEBPMUX_LIBS@ +WEBP_CFLAGS = @WEBP_CFLAGS@ +WEBP_LIBS = @WEBP_LIBS@ +WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@ +WEB_PAGE = @WEB_PAGE@ +WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@ +WINDRES = @WINDRES@ +WMF_CFLAGS = @WMF_CFLAGS@ +WMF_CONFIG = @WMF_CONFIG@ +WMF_LIBS = @WMF_LIBS@ +WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@ +XDG_EMAIL = @XDG_EMAIL@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@ +XMC_CFLAGS = @XMC_CFLAGS@ +XMC_LIBS = @XMC_LIBS@ +XMKMF = @XMKMF@ +XMLLINT = @XMLLINT@ +XMU_LIBS = @XMU_LIBS@ +XPM_LIBS = @XPM_LIBS@ +XSLTPROC = @XSLTPROC@ +XVFB_RUN = @XVFB_RUN@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Z_LIBS = @Z_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gimpdatadir = @gimpdatadir@ +gimpdir = @gimpdir@ +gimplocaledir = @gimplocaledir@ +gimpplugindir = @gimpplugindir@ +gimpsysconfdir = @gimpsysconfdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = $(gimpplugindir)/plug-ins/file-fli +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +manpage_gimpdir = @manpage_gimpdir@ +mkdir_p = @mkdir_p@ +ms_librarian = @ms_librarian@ +mypaint_brushes_dir = @mypaint_brushes_dir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la +libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la +libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la +libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la +@OS_WIN32_TRUE@mwindows = -mwindows +@HAVE_WINDRES_TRUE@GIMPPLUGINRC = $(top_builddir)/build/windows/gimp-plug-ins.rc +@HAVE_WINDRES_TRUE@file_fli_RC = file-fli.rc.o +AM_LDFLAGS = $(mwindows) +file_fli_SOURCES = \ + fli.h \ + fli.c \ + fli-gimp.c + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + $(GTK_CFLAGS) \ + $(GEGL_CFLAGS) \ + -I$(includedir) + +LDADD = \ + $(libgimpui) \ + $(libgimpwidgets) \ + $(libgimpconfig) \ + $(libgimp) \ + $(libgimpcolor) \ + $(libgimpmath) \ + $(libgimpbase) \ + $(GTK_LIBS) \ + $(GEGL_LIBS) \ + $(RT_LIBS) \ + $(INTLLIBS) \ + $(file_fli_RC) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plug-ins/file-fli/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plug-ins/file-fli/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/build/windows/gimprc-plug-ins.rule $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +file-fli$(EXEEXT): $(file_fli_OBJECTS) $(file_fli_DEPENDENCIES) $(EXTRA_file_fli_DEPENDENCIES) + @rm -f file-fli$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(file_fli_OBJECTS) $(file_fli_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fli-gimp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fli.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(libexecdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/fli-gimp.Po + -rm -f ./$(DEPDIR)/fli.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/fli-gimp.Po + -rm -f ./$(DEPDIR)/fli.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libexecPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libexecPROGRAMS clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libexecPROGRAMS \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-libexecPROGRAMS + +.PRECIOUS: Makefile + + +# `windres` seems a very stupid tool and it breaks with double shlashes +# in parameter paths. Strengthen the rule a little. +@HAVE_WINDRES_TRUE@%.rc.o: +@HAVE_WINDRES_TRUE@ $(WINDRES) --define ORIGINALFILENAME_STR="$*$(EXEEXT)" \ +@HAVE_WINDRES_TRUE@ --define INTERNALNAME_STR="$*" \ +@HAVE_WINDRES_TRUE@ --define TOP_SRCDIR="`echo $(top_srcdir) | sed 's*//*/*'`" \ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_srcdir)/app | sed 's%/\+%/%'`" \ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir)/app | sed 's%/\+%/%'`"\ +@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir) | sed 's%/\+%/%'`"\ +@HAVE_WINDRES_TRUE@ $(GIMPPLUGINRC) $@ + +# 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: diff --git a/plug-ins/file-fli/fli-gimp.c b/plug-ins/file-fli/fli-gimp.c new file mode 100644 index 0000000..fb14649 --- /dev/null +++ b/plug-ins/file-fli/fli-gimp.c @@ -0,0 +1,984 @@ +/* + * GFLI 1.3 + * + * A gimp plug-in to read and write FLI and FLC movies. + * + * Copyright (C) 1998 Jens Ch. Restemeier <jchrr@hrz.uni-bielefeld.de> + * + * 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 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + * This is a first loader for FLI and FLC movies. It uses as the same method as + * the gif plug-in to store the animation (i.e. 1 layer/frame). + * + * Current disadvantages: + * - Generates A LOT OF warnings. + * - Consumes a lot of memory (See wish-list: use the original data or + * compression). + * - doesn't support palette changes between two frames. + * + * Wish-List: + * - I'd like to have a different format for storing animations, so I can use + * Layers and Alpha-Channels for effects. An older version of + * this plug-in created one image per frame, and went real soon out of + * memory. + * - I'd like a method that requests unmodified frames from the original + * image, and stores modified without destroying the original file. + * - I'd like a way to store additional information about a image to it, for + * example copyright stuff or a timecode. + * - I've thought about a small utility to mix MIDI events as custom chunks + * between the FLI chunks. Anyone interested in implementing this ? + */ + +/* + * History: + * 1.0 first release + * 1.1 first support for FLI saving (BRUN and LC chunks) + * 1.2 support for load/save ranges, fixed SGI & SUN problems (I hope...), fixed FLC + * 1.3 made saving actually work, alpha channel is silently ignored; + loading was broken too, fixed it --Sven + */ + +#include <config.h> + +#include <errno.h> +#include <string.h> + +#include <glib/gstdio.h> + +#include <libgimp/gimp.h> +#include <libgimp/gimpui.h> + +#include "fli.h" + +#include "libgimp/stdplugins-intl.h" + + +#define LOAD_PROC "file-fli-load" +#define SAVE_PROC "file-fli-save" +#define INFO_PROC "file-fli-info" +#define PLUG_IN_BINARY "file-fli" +#define PLUG_IN_ROLE "gimp-file-fli" + + +static void query (void); +static void run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); + +/* return the image-ID of the new image, or -1 in case of an error */ +static gint32 load_image (const gchar *filename, + gint32 from_frame, + gint32 to_frame, + GError **error); +static gboolean load_dialog (const gchar *filename); + +static gboolean save_image (const gchar *filename, + gint32 image_id, + gint32 from_frame, + gint32 to_frame, + GError **error); +static gboolean save_dialog (gint32 image_id); + +static gboolean get_info (const gchar *filename, + gint32 *width, + gint32 *height, + gint32 *frames, + GError **error); + +/* + * GIMP interface + */ +const GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + query, /* query_proc */ + run, /* run_proc */ +}; + +static const GimpParamDef load_args[] = +{ + { GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" }, + { GIMP_PDB_STRING, "filename", "The name of the file to load" }, + { GIMP_PDB_STRING, "raw-filename", "The name entered" }, + { GIMP_PDB_INT32, "from-frame", "Load beginning from this frame" }, + { GIMP_PDB_INT32, "to-frame", "End loading with this frame" } +}; + +static const GimpParamDef load_return_vals[] = +{ + { GIMP_PDB_IMAGE, "image", "Output image" }, +}; + +static const GimpParamDef save_args[] = +{ + { GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" }, + { GIMP_PDB_IMAGE, "image", "Input image" }, + { GIMP_PDB_DRAWABLE, "drawable", "Input drawable (unused)" }, + { GIMP_PDB_STRING, "filename", "The name of the file to export" }, + { GIMP_PDB_STRING, "raw-filename", "The name entered" }, + { GIMP_PDB_INT32, "from-frame", "Export beginning from this frame" }, + { GIMP_PDB_INT32, "to-frame", "End exporting with this frame" }, +}; + +static const GimpParamDef info_args[] = +{ + { GIMP_PDB_STRING, "filename", "The name of the file to get info" }, +}; +static const GimpParamDef info_return_vals[] = +{ + { GIMP_PDB_INT32, "width", "Width of one frame" }, + { GIMP_PDB_INT32, "height", "Height of one frame" }, + { GIMP_PDB_INT32, "frames", "Number of Frames" }, +}; + + +static gint32 from_frame; +static gint32 to_frame; + +MAIN () + +static void +query (void) +{ + /* + * Load/export procedures + */ + gimp_install_procedure (LOAD_PROC, + "load FLI-movies", + "This is an experimantal plug-in to handle FLI movies", + "Jens Ch. Restemeier", + "Jens Ch. Restemeier", + "1997", + N_("AutoDesk FLIC animation"), + NULL, + GIMP_PLUGIN, + G_N_ELEMENTS (load_args) - 2, + G_N_ELEMENTS (load_return_vals), + load_args, + load_return_vals); + + gimp_register_file_handler_mime (LOAD_PROC, "image/x-flic"); + gimp_register_magic_load_handler (LOAD_PROC, + "fli,flc", + "", + ""); + + gimp_install_procedure (SAVE_PROC, + "export FLI-movies", + "This is an experimantal plug-in to handle FLI movies", + "Jens Ch. Restemeier", + "Jens Ch. Restemeier", + "1997", + N_("AutoDesk FLIC animation"), + "INDEXED,GRAY", + GIMP_PLUGIN, + G_N_ELEMENTS (save_args), 0, + save_args, NULL); + + gimp_register_file_handler_mime (SAVE_PROC, "image/x-flic"); + gimp_register_save_handler (SAVE_PROC, + "fli,flc", + ""); + + /* + * Utility functions: + */ + gimp_install_procedure (INFO_PROC, + "Get information about a Fli movie", + "This is a experimantal plug-in to handle FLI movies", + "Jens Ch. Restemeier", + "Jens Ch. Restemeier", + "1997", + NULL, + NULL, + GIMP_PLUGIN, + G_N_ELEMENTS (info_args), + G_N_ELEMENTS (info_return_vals), + info_args, + info_return_vals); +} + +static void +run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals) +{ + static GimpParam values[5]; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + GimpRunMode run_mode; + gint32 pc; + gint32 image_ID; + gint32 drawable_ID; + gint32 orig_image_ID; + GimpExportReturn export = GIMP_EXPORT_CANCEL; + GError *error = NULL; + + INIT_I18N (); + gegl_init (NULL, NULL); + + run_mode = param[0].data.d_int32; + + *nreturn_vals = 1; + *return_vals = values; + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + + if (strcmp (name, LOAD_PROC) == 0) + { + switch (run_mode) + { + case GIMP_RUN_NONINTERACTIVE: + /* + * check for valid parameters: + * (Or can I trust GIMP ?) + */ + if ((nparams < G_N_ELEMENTS (load_args) - 2) || + (G_N_ELEMENTS (load_args) < nparams)) + { + status = GIMP_PDB_CALLING_ERROR; + break; + } + for (pc = 0; pc < G_N_ELEMENTS (load_args) - 2; pc++) + { + if (load_args[pc].type != param[pc].type) + { + status = GIMP_PDB_CALLING_ERROR; + break; + } + } + for (pc = G_N_ELEMENTS (load_args) - 2; pc < nparams; pc++) + { + if (load_args[pc].type != param[pc].type) + { + status = GIMP_PDB_CALLING_ERROR; + break; + } + } + + to_frame = ((nparams < G_N_ELEMENTS (load_args) - 1) ? + 1 : param[3].data.d_int32); + from_frame = ((nparams < G_N_ELEMENTS (load_args)) ? + -1 : param[4].data.d_int32); + + image_ID = load_image (param[1].data.d_string, + from_frame, to_frame, &error); + + if (image_ID != -1) + { + *nreturn_vals = 2; + values[1].type = GIMP_PDB_IMAGE; + values[1].data.d_image = image_ID; + } + else + { + status = GIMP_PDB_EXECUTION_ERROR; + } + break; + + case GIMP_RUN_INTERACTIVE: + if (load_dialog (param[1].data.d_string)) + { + image_ID = load_image (param[1].data.d_string, + from_frame, to_frame, &error); + + if (image_ID != -1) + { + *nreturn_vals = 2; + values[1].type = GIMP_PDB_IMAGE; + values[1].data.d_image = image_ID; + } + else + { + status = GIMP_PDB_EXECUTION_ERROR; + } + } + else + { + status = GIMP_PDB_CANCEL; + } + break; + + case GIMP_RUN_WITH_LAST_VALS: + status = GIMP_PDB_CALLING_ERROR; + break; + } + } + else if (strcmp (name, SAVE_PROC) == 0) + { + image_ID = orig_image_ID = param[1].data.d_int32; + drawable_ID = param[2].data.d_int32; + + switch (run_mode) + { + case GIMP_RUN_NONINTERACTIVE: + if (nparams != G_N_ELEMENTS (save_args)) + { + status = GIMP_PDB_CALLING_ERROR; + break; + } + for (pc = 0; pc < G_N_ELEMENTS (save_args); pc++) + { + if (save_args[pc].type!=param[pc].type) + { + status = GIMP_PDB_CALLING_ERROR; + break; + } + } + if (! save_image (param[3].data.d_string, image_ID, + param[5].data.d_int32, + param[6].data.d_int32, &error)) + { + status = GIMP_PDB_EXECUTION_ERROR; + } + break; + + case GIMP_RUN_INTERACTIVE: + case GIMP_RUN_WITH_LAST_VALS: + gimp_ui_init (PLUG_IN_BINARY, FALSE); + + export = gimp_export_image (&image_ID, &drawable_ID, "FLI", + GIMP_EXPORT_CAN_HANDLE_INDEXED | + GIMP_EXPORT_CAN_HANDLE_GRAY | + GIMP_EXPORT_CAN_HANDLE_ALPHA | + GIMP_EXPORT_CAN_HANDLE_LAYERS); + + if (export == GIMP_EXPORT_CANCEL) + { + values[0].data.d_status = GIMP_PDB_CANCEL; + return; + } + + if (save_dialog (param[1].data.d_image)) + { + if (! save_image (param[3].data.d_string, + image_ID, from_frame, to_frame, &error)) + { + status = GIMP_PDB_EXECUTION_ERROR; + } + } + else + { + status = GIMP_PDB_CANCEL; + } + break; + } + + if (export == GIMP_EXPORT_EXPORT) + gimp_image_delete (image_ID); + } + else if (strcmp (name, INFO_PROC) == 0) + { + gint32 width, height, frames; + + /* + * check for valid parameters; + */ + if (nparams != G_N_ELEMENTS (info_args)) + status = GIMP_PDB_CALLING_ERROR; + + if (status == GIMP_PDB_SUCCESS) + { + for (pc = 0; pc < G_N_ELEMENTS (save_args); pc++) + { + if (info_args[pc].type != param[pc].type) + { + status = GIMP_PDB_CALLING_ERROR; + break; + } + } + } + + if (status == GIMP_PDB_SUCCESS) + { + if (get_info (param[0].data.d_string, + &width, &height, &frames, &error)) + { + *nreturn_vals = 4; + values[1].type = GIMP_PDB_INT32; + values[1].data.d_int32 = width; + values[2].type = GIMP_PDB_INT32; + values[2].data.d_int32 = height; + values[3].type = GIMP_PDB_INT32; + values[3].data.d_int32 = frames; + } + else + { + status = GIMP_PDB_EXECUTION_ERROR; + } + } + } + else + { + status = GIMP_PDB_CALLING_ERROR; + } + + if (status != GIMP_PDB_SUCCESS && error) + { + *nreturn_vals = 2; + values[1].type = GIMP_PDB_STRING; + values[1].data.d_string = error->message; + } + + values[0].data.d_status = status; +} + +/* + * Open FLI animation and return header-info + */ +static gboolean +get_info (const gchar *filename, + gint32 *width, + gint32 *height, + gint32 *frames, + GError **error) +{ + FILE *file; + s_fli_header fli_header; + + *width = 0; *height = 0; *frames = 0; + + file = g_fopen (filename ,"rb"); + + if (!file) + { + g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), + _("Could not open '%s' for reading: %s"), + gimp_filename_to_utf8 (filename), g_strerror (errno)); + return FALSE; + } + + fli_read_header (file, &fli_header); + fclose (file); + + *width = fli_header.width; + *height = fli_header.height; + *frames = fli_header.frames; + + return TRUE; +} + +/* + * load fli animation and store as framestack + */ +static gint32 +load_image (const gchar *filename, + gint32 from_frame, + gint32 to_frame, + GError **error) +{ + FILE *file; + GeglBuffer *buffer; + gint32 image_id, layer_ID; + guchar *fb, *ofb, *fb_x; + guchar cm[768], ocm[768]; + s_fli_header fli_header; + gint cnt; + + gimp_progress_init_printf (_("Opening '%s'"), + gimp_filename_to_utf8 (filename)); + + file = g_fopen (filename ,"rb"); + if (!file) + { + g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), + _("Could not open '%s' for reading: %s"), + gimp_filename_to_utf8 (filename), g_strerror (errno)); + return -1; + } + + fli_read_header (file, &fli_header); + if (fli_header.magic == NO_HEADER) + { + fclose (file); + return -1; + } + else + { + fseek (file, 128, SEEK_SET); + } + + /* + * Fix parameters + */ + if ((from_frame==-1) && (to_frame==-1)) + { + /* to make scripting easier: */ + from_frame=1; to_frame=fli_header.frames; + } + if (to_frame<from_frame) + { + to_frame = fli_header.frames; + } + if (from_frame < 1) + { + from_frame = 1; + } + if (to_frame < 1) + { + /* nothing to do ... */ + fclose (file); + return -1; + } + if (from_frame >= fli_header.frames) + { + /* nothing to do ... */ + fclose (file); + return -1; + } + if (to_frame>fli_header.frames) + { + to_frame = fli_header.frames; + } + + image_id = gimp_image_new (fli_header.width, fli_header.height, GIMP_INDEXED); + gimp_image_set_filename (image_id, filename); + + fb = g_malloc (fli_header.width * fli_header.height); + ofb = g_malloc (fli_header.width * fli_header.height); + + /* + * Skip to the beginning of requested frames: + */ + for (cnt = 1; cnt < from_frame; cnt++) + { + fli_read_frame (file, &fli_header, ofb, ocm, fb, cm); + memcpy (ocm, cm, 768); + fb_x = fb; fb = ofb; ofb = fb_x; + } + /* + * Load range + */ + for (cnt = from_frame; cnt <= to_frame; cnt++) + { + gchar *name_buf = g_strdup_printf (_("Frame (%i)"), cnt); + + layer_ID = gimp_layer_new (image_id, name_buf, + fli_header.width, fli_header.height, + GIMP_INDEXED_IMAGE, + 100, + gimp_image_get_default_new_layer_mode (image_id)); + g_free (name_buf); + + buffer = gimp_drawable_get_buffer (layer_ID); + + fli_read_frame (file, &fli_header, ofb, ocm, fb, cm); + + gegl_buffer_set (buffer, GEGL_RECTANGLE (0, 0, + fli_header.width, + fli_header.height), 0, + NULL, fb, GEGL_AUTO_ROWSTRIDE); + + g_object_unref (buffer); + + if (cnt > 0) + gimp_layer_add_alpha (layer_ID); + + gimp_image_insert_layer (image_id, layer_ID, -1, 0); + + if (cnt < to_frame) + { + memcpy (ocm, cm, 768); + fb_x = fb; fb = ofb; ofb = fb_x; + } + + gimp_progress_update ((double) cnt + 1 / (double)(to_frame - from_frame)); + } + + gimp_image_set_colormap (image_id, cm, 256); + + fclose (file); + + g_free (fb); + g_free (ofb); + + gimp_progress_update (1.0); + + return image_id; +} + + +#define MAXDIFF 195075 /* 3 * SQR (255) + 1 */ + +/* + * get framestack and store as fli animation + * (some code was taken from the GIF plugin.) + */ +static gboolean +save_image (const gchar *filename, + gint32 image_id, + gint32 from_frame, + gint32 to_frame, + GError **error) +{ + FILE *file; + gint32 *framelist; + gint nframes; + gint colors, i; + guchar *cmap; + guchar bg; + guchar red, green, blue; + gint diff, sum, max; + gint offset_x, offset_y, xc, yc, xx, yy; + guint rows, cols, bytes; + guchar *src_row; + guchar *fb, *ofb; + guchar cm[768]; + GimpRGB background; + s_fli_header fli_header; + gint cnt; + + framelist = gimp_image_get_layers (image_id, &nframes); + + if ((from_frame == -1) && (to_frame == -1)) + { + /* to make scripting easier: */ + from_frame = 0; to_frame = nframes; + } + if (to_frame < from_frame) + { + to_frame = nframes; + } + if (from_frame < 1) + { + from_frame = 1; + } + if (to_frame < 1) + { + /* nothing to do ... */ + return FALSE; + } + if (from_frame > nframes) + { + /* nothing to do ... */ + return FALSE; + } + if (to_frame > nframes) + { + to_frame = nframes; + } + + gimp_context_get_background (&background); + gimp_rgb_get_uchar (&background, &red, &green, &blue); + + switch (gimp_image_base_type (image_id)) + { + case GIMP_GRAY: + /* build grayscale palette */ + for (i = 0; i < 256; i++) + { + cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i; + } + bg = GIMP_RGB_LUMINANCE (red, green, blue) + 0.5; + break; + + case GIMP_INDEXED: + max = MAXDIFF; + bg = 0; + cmap = gimp_image_get_colormap (image_id, &colors); + for (i = 0; i < MIN (colors, 256); i++) + { + cm[i*3+0] = cmap[i*3+0]; + cm[i*3+1] = cmap[i*3+1]; + cm[i*3+2] = cmap[i*3+2]; + + diff = red - cm[i*3+0]; + sum = SQR (diff); + diff = green - cm[i*3+1]; + sum += SQR (diff); + diff = blue - cm[i*3+2]; + sum += SQR (diff); + + if (sum < max) + { + bg = i; + max = sum; + } + } + for (i = colors; i < 256; i++) + { + cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i; + } + break; + + default: + g_message (_("Sorry, I can export only INDEXED and GRAY images.")); + return FALSE; + } + + gimp_progress_init_printf (_("Exporting '%s'"), + gimp_filename_to_utf8 (filename)); + + /* + * First build the fli header. + */ + fli_header.filesize = 0; /* will be fixed when writing the header */ + fli_header.frames = 0; /* will be fixed during the write */ + fli_header.width = gimp_image_width (image_id); + fli_header.height = gimp_image_height (image_id); + + if ((fli_header.width == 320) && (fli_header.height == 200)) + { + fli_header.magic = HEADER_FLI; + } + else + { + fli_header.magic = HEADER_FLC; + } + fli_header.depth = 8; /* I've never seen a depth != 8 */ + fli_header.flags = 3; + fli_header.speed = 1000 / 25; + fli_header.created = 0; /* program ID. not necessary... */ + fli_header.updated = 0; /* date in MS-DOS format. ignore...*/ + fli_header.aspect_x = 1; /* aspect ratio. Will be added as soon.. */ + fli_header.aspect_y = 1; /* ... as GIMP supports it. */ + fli_header.oframe1 = fli_header.oframe2 = 0; /* will be fixed during the write */ + + file = g_fopen (filename ,"wb"); + if (!file) + { + g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), + _("Could not open '%s' for writing: %s"), + gimp_filename_to_utf8 (filename), g_strerror (errno)); + return FALSE; + } + fseek (file, 128, SEEK_SET); + + fb = g_malloc (fli_header.width * fli_header.height); + ofb = g_malloc (fli_header.width * fli_header.height); + + /* initialize with bg color */ + memset (fb, bg, fli_header.width * fli_header.height); + + /* + * Now write all frames + */ + for (cnt = from_frame; cnt <= to_frame; cnt++) + { + GeglBuffer *buffer; + const Babl *format = NULL; + + buffer = gimp_drawable_get_buffer (framelist[nframes-cnt]); + + if (gimp_drawable_is_gray (framelist[nframes-cnt])) + { + if (gimp_drawable_has_alpha (framelist[nframes-cnt])) + format = babl_format ("Y' u8"); + else + format = babl_format ("Y'A u8"); + } + else + { + format = gegl_buffer_get_format (buffer); + } + + cols = gegl_buffer_get_width (buffer); + rows = gegl_buffer_get_height (buffer); + + gimp_drawable_offsets (framelist[nframes-cnt], &offset_x, &offset_y); + + bytes = babl_format_get_bytes_per_pixel (format); + + src_row = g_malloc (cols * bytes); + + /* now paste it into the framebuffer, with the necessary offset */ + for (yc = 0, yy = offset_y; yc < rows; yc++, yy++) + { + if (yy >= 0 && yy < fli_header.height) + { + gegl_buffer_get (buffer, GEGL_RECTANGLE (0, yc, cols, 1), 1.0, + format, src_row, + GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); + + for (xc = 0, xx = offset_x; xc < cols; xc++, xx++) + { + if (xx >= 0 && xx < fli_header.width) + fb[yy * fli_header.width + xx] = src_row[xc * bytes]; + } + } + } + + g_free (src_row); + g_object_unref (buffer); + + /* save the frame */ + if (cnt > from_frame) + { + /* save frame, allow all codecs */ + fli_write_frame (file, &fli_header, ofb, cm, fb, cm, W_ALL); + } + else + { + /* save first frame, no delta information, allow all codecs */ + fli_write_frame (file, &fli_header, NULL, NULL, fb, cm, W_ALL); + } + + if (cnt < to_frame) + memcpy (ofb, fb, fli_header.width * fli_header.height); + + gimp_progress_update ((double) cnt + 1 / (double)(to_frame - from_frame)); + } + + /* + * finish fli + */ + fli_write_header (file, &fli_header); + fclose (file); + + g_free (fb); + g_free (ofb); + g_free (framelist); + + gimp_progress_update (1.0); + + return TRUE; +} + +/* + * Dialogs for interactive usage + */ +static gboolean +load_dialog (const gchar *filename) +{ + GtkWidget *dialog; + GtkWidget *table; + GtkWidget *spinbutton; + GtkAdjustment *adj; + gint32 width, height, nframes; + gboolean run; + + get_info (filename, &width, &height, &nframes, NULL); + + from_frame = 1; + to_frame = nframes; + + gimp_ui_init (PLUG_IN_BINARY, FALSE); + + dialog = gimp_dialog_new (_("GFLI 1.3 - Load framestack"), PLUG_IN_ROLE, + NULL, 0, + gimp_standard_help_func, LOAD_PROC, + + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_Open"), GTK_RESPONSE_OK, + + NULL); + + gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); + + table = gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (table), 12); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_table_set_col_spacings (GTK_TABLE (table), 6); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + table, FALSE, FALSE, 0); + gtk_widget_show (table); + + /* + * Maybe I add on-the-fly RGB conversion, to keep palettechanges... + * But for now you can set a start- and a end-frame: + */ + adj = (GtkAdjustment *) gtk_adjustment_new (from_frame, 1, nframes, 1, 10, 0); + spinbutton = gimp_spin_button_new (adj, 1, 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); + gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, + C_("frame-range", "_From:"), 0.0, 0.5, + spinbutton, 1, TRUE); + g_signal_connect (adj, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &from_frame); + + adj = (GtkAdjustment *) gtk_adjustment_new (to_frame, 1, nframes, 1, 10, 0); + spinbutton = gimp_spin_button_new (adj, 1, 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); + gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, + C_("frame-range", "_To:"), 0.0, 0.5, + spinbutton, 1, TRUE); + g_signal_connect (adj, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &to_frame); + + gtk_widget_show (dialog); + + run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); + + gtk_widget_destroy (dialog); + + return run; +} + +static gboolean +save_dialog (gint32 image_id) +{ + GtkWidget *dialog; + GtkWidget *table; + GtkWidget *spinbutton; + GtkAdjustment *adj; + gint nframes; + gboolean run; + + g_free (gimp_image_get_layers (image_id, &nframes)); + + from_frame = 1; + to_frame = nframes; + + dialog = gimp_export_dialog_new (_("GFLI 1.3"), PLUG_IN_BINARY, SAVE_PROC); + + table = gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (table), 12); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_table_set_col_spacings (GTK_TABLE (table), 6); + gtk_box_pack_start (GTK_BOX (gimp_export_dialog_get_content_area (dialog)), + table, FALSE, FALSE, 0); + gtk_widget_show (table); + + /* + * Maybe I add on-the-fly RGB conversion, to keep palettechanges... + * But for now you can set a start- and a end-frame: + */ + adj = (GtkAdjustment *) gtk_adjustment_new (from_frame, 1, nframes, 1, 10, 0); + spinbutton = gimp_spin_button_new (adj, 1, 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); + gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, + C_("frame-range", "_From:"), 0.0, 0.5, + spinbutton, 1, TRUE); + g_signal_connect (adj, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &from_frame); + + adj = (GtkAdjustment *) gtk_adjustment_new (to_frame, 1, nframes, 1, 10, 0); + spinbutton = gimp_spin_button_new (adj, 1, 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); + gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, + C_("frame-range", "_To:"), 0.0, 0.5, + spinbutton, 1, TRUE); + g_signal_connect (adj, "value-changed", + G_CALLBACK (gimp_int_adjustment_update), + &to_frame); + + gtk_widget_show (dialog); + + run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); + + gtk_widget_destroy (dialog); + + return run; +} diff --git a/plug-ins/file-fli/fli.c b/plug-ins/file-fli/fli.c new file mode 100644 index 0000000..d5400cf --- /dev/null +++ b/plug-ins/file-fli/fli.c @@ -0,0 +1,1033 @@ + +/* + * Written 1998 Jens Ch. Restemeier <jchrr@hrz.uni-bielefeld.de> + * + * 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 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + +/* + * This code can be used to read and write FLI movies. It is currently + * only used for the GIMP fli plug-in, but it can be used for other + * programs, too. + */ + +#include "config.h" + +#include <glib/gstdio.h> + +#include <string.h> +#include <stdio.h> + +#include "fli.h" + +/* + * To avoid endian-problems I wrote these functions: + */ +static unsigned char +fli_read_char (FILE *f) +{ + unsigned char b; + + fread (&b, 1, 1, f); + return b; +} + +static unsigned short +fli_read_short (FILE *f) +{ + unsigned char b[2]; + + fread (&b, 1, 2, f); + return (unsigned short) (b[1]<<8) | b[0]; +} + +static unsigned long +fli_read_long (FILE *f) +{ + unsigned char b[4]; + + fread (&b, 1, 4, f); + return (unsigned long) (b[3]<<24) | (b[2]<<16) | (b[1]<<8) | b[0]; +} + +static void +fli_write_char (FILE *f, + unsigned char b) +{ + fwrite (&b, 1, 1, f); +} + +static void +fli_write_short (FILE *f, + unsigned short w) +{ + unsigned char b[2]; + + b[0] = w & 255; + b[1] = (w >> 8) & 255; + fwrite (&b, 1, 2, f); +} + +static void +fli_write_long (FILE *f, + unsigned long l) +{ + unsigned char b[4]; + + b[0] = l & 255; + b[1] = (l >> 8) & 255; + b[2] = (l >> 16) & 255; + b[3] = (l >> 24) & 255; + + fwrite (&b, 1, 4, f); +} + +void +fli_read_header (FILE *f, + s_fli_header *fli_header) +{ + fli_header->filesize = fli_read_long (f); /* 0 */ + fli_header->magic = fli_read_short (f); /* 4 */ + fli_header->frames = fli_read_short (f); /* 6 */ + fli_header->width = fli_read_short (f); /* 8 */ + fli_header->height = fli_read_short (f); /* 10 */ + fli_header->depth = fli_read_short (f); /* 12 */ + fli_header->flags = fli_read_short (f); /* 14 */ + + if (fli_header->magic == HEADER_FLI) + { + /* FLI saves speed in 1/70s */ + fli_header->speed = fli_read_short (f) * 14; /* 16 */ + } + else + { + if (fli_header->magic == HEADER_FLC) + { + /* FLC saves speed in 1/1000s */ + fli_header->speed = fli_read_long (f); /* 16 */ + } + else + { + fprintf (stderr, "error: magic number is wrong !\n"); + fli_header->magic = NO_HEADER; + } + } + + if (fli_header->width == 0) + fli_header->width = 320; + + if (fli_header->height == 0) + fli_header->height = 200; +} + +void +fli_write_header (FILE *f, + s_fli_header *fli_header) +{ + fli_header->filesize = ftell (f); + fseek (f, 0, SEEK_SET); + fli_write_long (f, fli_header->filesize); /* 0 */ + fli_write_short (f, fli_header->magic); /* 4 */ + fli_write_short (f, fli_header->frames); /* 6 */ + fli_write_short (f, fli_header->width); /* 8 */ + fli_write_short (f, fli_header->height); /* 10 */ + fli_write_short (f, fli_header->depth); /* 12 */ + fli_write_short (f, fli_header->flags); /* 14 */ + if (fli_header->magic == HEADER_FLI) + { + /* FLI saves speed in 1/70s */ + fli_write_short (f, fli_header->speed / 14); /* 16 */ + } + else + { + if (fli_header->magic == HEADER_FLC) + { + /* FLC saves speed in 1/1000s */ + fli_write_long (f, fli_header->speed); /* 16 */ + fseek (f, 80, SEEK_SET); + fli_write_long (f, fli_header->oframe1); /* 80 */ + fli_write_long (f, fli_header->oframe2); /* 84 */ + } + else + { + fprintf (stderr, "error: magic number in header is wrong !\n"); + } + } +} + +void +fli_read_frame (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *old_cmap, + unsigned char *framebuf, + unsigned char *cmap) +{ + s_fli_frame fli_frame; + unsigned long framepos; + int c; + + framepos = ftell (f); + + fli_frame.size = fli_read_long (f); + fli_frame.magic = fli_read_short (f); + fli_frame.chunks = fli_read_short (f); + + if (fli_frame.magic == FRAME) + { + fseek (f, framepos + 16, SEEK_SET); + for (c = 0; c < fli_frame.chunks; c++) + { + s_fli_chunk chunk; + unsigned long chunkpos; + + chunkpos = ftell (f); + chunk.size = fli_read_long (f); + chunk.magic = fli_read_short (f); + switch (chunk.magic) + { + case FLI_COLOR: + fli_read_color (f, fli_header, old_cmap, cmap); + break; + case FLI_COLOR_2: + fli_read_color_2 (f, fli_header, old_cmap, cmap); + break; + case FLI_BLACK: + fli_read_black (f, fli_header, framebuf); + break; + case FLI_BRUN: + fli_read_brun (f, fli_header, framebuf); + break; + case FLI_COPY: + fli_read_copy (f, fli_header, framebuf); + break; + case FLI_LC: + fli_read_lc (f, fli_header, old_framebuf, framebuf); + break; + case FLI_LC_2: + fli_read_lc_2 (f, fli_header, old_framebuf, framebuf); + break; + case FLI_MINI: + /* unused, skip */ + break; + default: + /* unknown, skip */ + break; + } + if (chunk.size & 1) + chunk.size++; + fseek (f, chunkpos + chunk.size, SEEK_SET); + } + } + /* else: unknown, skip */ + + fseek (f, framepos + fli_frame.size, SEEK_SET); +} + +void +fli_write_frame (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *old_cmap, + unsigned char *framebuf, + unsigned char *cmap, + unsigned short codec_mask) +{ + s_fli_frame fli_frame; + unsigned long framepos, frameend; + + framepos = ftell (f); + fseek (f, framepos + 16, SEEK_SET); + + switch (fli_header->frames) + { + case 0: + fli_header->oframe1 = framepos; + break; + case 1: + fli_header->oframe2 = framepos; + break; + } + + fli_frame.size = 0; + fli_frame.magic = FRAME; + fli_frame.chunks = 0; + + /* + * create color chunk + */ + if (fli_header->magic == HEADER_FLI) + { + if (fli_write_color (f, fli_header, old_cmap, cmap)) + fli_frame.chunks++; + } + else + { + if (fli_header->magic == HEADER_FLC) + { + if (fli_write_color_2 (f, fli_header, old_cmap, cmap)) + fli_frame.chunks++; + } + else + { + fprintf (stderr, "error: magic number in header is wrong !\n"); + } + } + +#if 0 + if (codec_mask & W_COLOR) + { + if (fli_write_color (f, fli_header, old_cmap, cmap)) + fli_frame.chunks++; + } + if (codec_mask & W_COLOR_2) + { + if (fli_write_color_2 (f, fli_header, old_cmap, cmap)) + fli_frame.chunks++; + } +#endif + /* create bitmap chunk */ + if (old_framebuf == NULL) + { + fli_write_brun (f, fli_header, framebuf); + } + else + { + fli_write_lc (f, fli_header, old_framebuf, framebuf); + } + fli_frame.chunks++; + + frameend = ftell (f); + fli_frame.size = frameend - framepos; + fseek (f, framepos, SEEK_SET); + fli_write_long (f, fli_frame.size); + fli_write_short (f, fli_frame.magic); + fli_write_short (f, fli_frame.chunks); + fseek (f, frameend, SEEK_SET); + fli_header->frames++; +} + +/* + * palette chunks from the classical Autodesk Animator. + */ +void +fli_read_color (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap) +{ + unsigned short num_packets, cnt_packets, col_pos; + + col_pos = 0; + num_packets = fli_read_short (f); + for (cnt_packets = num_packets; cnt_packets > 0; cnt_packets--) + { + unsigned short skip_col, num_col, col_cnt; + skip_col = fli_read_char (f); + num_col = fli_read_char (f); + if (num_col == 0) + { + for (col_pos = 0; col_pos < 768; col_pos++) + { + cmap[col_pos] = fli_read_char (f) << 2; + } + return; + } + for (col_cnt = skip_col; (col_cnt > 0) && (col_pos < 768); col_cnt--) + { + cmap[col_pos] = old_cmap[col_pos];col_pos++; + cmap[col_pos] = old_cmap[col_pos];col_pos++; + cmap[col_pos] = old_cmap[col_pos];col_pos++; + } + for (col_cnt = num_col; (col_cnt > 0) && (col_pos < 768); col_cnt--) + { + cmap[col_pos++] = fli_read_char (f) << 2; + cmap[col_pos++] = fli_read_char (f) << 2; + cmap[col_pos++] = fli_read_char (f) << 2; + } + } +} + +int +fli_write_color (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap) +{ + unsigned long chunkpos; + unsigned short num_packets; + s_fli_chunk chunk; + + chunkpos = ftell (f); + fseek (f, chunkpos + 8, SEEK_SET); + num_packets = 0; + if (old_cmap == NULL) + { + unsigned short col_pos; + + num_packets = 1; + fli_write_char (f, 0); /* skip no color */ + fli_write_char (f, 0); /* 256 color */ + for (col_pos = 0; col_pos < 768; col_pos++) + { + fli_write_char (f, cmap[col_pos] >> 2); + } + } + else + { + unsigned short cnt_skip, cnt_col, col_pos, col_start; + + col_pos = 0; + do + { + cnt_skip = 0; + while ((col_pos < 256) && + (old_cmap[col_pos * 3 + 0] == cmap[col_pos * 3 + 0]) && + (old_cmap[col_pos * 3 + 1] == cmap[col_pos * 3 + 1]) && + (old_cmap[col_pos * 3 + 2] == cmap[col_pos * 3 + 2])) + { + cnt_skip++; + col_pos++; + } + col_start = col_pos * 3; + cnt_col = 0; + while ((col_pos < 256) && + !((old_cmap[col_pos * 3 + 0] == cmap[col_pos * 3 + 0]) && + (old_cmap[col_pos * 3 + 1] == cmap[col_pos * 3 + 1]) && + (old_cmap[col_pos * 3 + 2] == cmap[col_pos * 3 + 2]))) + { + cnt_col++; + col_pos++; + } + if (cnt_col > 0) + { + num_packets++; + + fli_write_char (f, cnt_skip & 255); + fli_write_char (f, cnt_col & 255); + while (cnt_col > 0) + { + fli_write_char (f, cmap[col_start++] >> 2); + fli_write_char (f, cmap[col_start++] >> 2); + fli_write_char (f, cmap[col_start++] >> 2); + cnt_col--; + } + } + } while (col_pos < 256); + } + + if (num_packets > 0) + { + chunk.size = ftell (f) - chunkpos; + chunk.magic = FLI_COLOR; + + fseek (f, chunkpos, SEEK_SET); + fli_write_long (f, chunk.size); + fli_write_short (f, chunk.magic); + fli_write_short (f, num_packets); + + if (chunk.size & 1) + chunk.size++; + + fseek (f, chunkpos + chunk.size, SEEK_SET); + return 1; + } + + fseek (f, chunkpos, SEEK_SET); + return 0; +} + +/* + * palette chunks from Autodesk Animator pro + */ +void +fli_read_color_2 (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap) +{ + unsigned short num_packets, cnt_packets, col_pos; + + num_packets = fli_read_short (f); + col_pos = 0; + for (cnt_packets = num_packets; cnt_packets > 0; cnt_packets--) + { + unsigned short skip_col, num_col, col_cnt; + + skip_col = fli_read_char (f); + num_col = fli_read_char (f); + if (num_col == 0) + { + for (col_pos = 0; col_pos < 768; col_pos++) + { + cmap[col_pos] = fli_read_char (f); + } + return; + } + for (col_cnt = skip_col; (col_cnt > 0) && (col_pos < 768); col_cnt--) + { + cmap[col_pos] = old_cmap[col_pos]; + col_pos++; + cmap[col_pos] = old_cmap[col_pos]; + col_pos++; + cmap[col_pos] = old_cmap[col_pos]; + col_pos++; + } + for (col_cnt = num_col; (col_cnt > 0) && (col_pos < 768); col_cnt--) + { + cmap[col_pos++] = fli_read_char (f); + cmap[col_pos++] = fli_read_char (f); + cmap[col_pos++] = fli_read_char (f); + } + } +} + +int +fli_write_color_2 (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap) +{ + unsigned long chunkpos; + unsigned short num_packets; + s_fli_chunk chunk; + + chunkpos = ftell (f); + fseek (f, chunkpos + 8, SEEK_SET); + num_packets = 0; + if (old_cmap == NULL) + { + unsigned short col_pos; + num_packets = 1; + fli_write_char (f, 0); /* skip no color */ + fli_write_char (f, 0); /* 256 color */ + for (col_pos = 0; col_pos < 768; col_pos++) + { + fli_write_char (f, cmap[col_pos]); + } + } + else + { + unsigned short cnt_skip, cnt_col, col_pos, col_start; + col_pos = 0; + do { + cnt_skip = 0; + while ((col_pos < 256) && + (old_cmap[col_pos * 3 + 0] == cmap[col_pos * 3 + 0]) && + (old_cmap[col_pos * 3 + 1] == cmap[col_pos * 3 + 1]) && + (old_cmap[col_pos * 3 + 2] == cmap[col_pos * 3 + 2])) + { + cnt_skip++; col_pos++; + } + col_start = col_pos * 3; + cnt_col = 0; + while ((col_pos < 256) && + !((old_cmap[col_pos * 3 + 0] == cmap[col_pos * 3 + 0]) && + (old_cmap[col_pos * 3 + 1] == cmap[col_pos * 3 + 1]) && + (old_cmap[col_pos * 3 + 2] == cmap[col_pos * 3 + 2]))) + { + cnt_col++; + col_pos++; + } + if (cnt_col > 0) + { + num_packets++; + fli_write_char (f, cnt_skip); + fli_write_char (f, cnt_col); + + while (cnt_col > 0) + { + fli_write_char (f, cmap[col_start++]); + fli_write_char (f, cmap[col_start++]); + fli_write_char (f, cmap[col_start++]); + cnt_col--; + } + } + } while (col_pos < 256); + } + + if (num_packets > 0) + { + chunk.size = ftell (f) - chunkpos; + chunk.magic = FLI_COLOR_2; + + fseek (f, chunkpos, SEEK_SET); + fli_write_long (f, chunk.size); + fli_write_short (f, chunk.magic); + fli_write_short (f, num_packets); + + if (chunk.size & 1) + chunk.size++; + fseek (f, chunkpos + chunk.size, SEEK_SET); + return 1; + } + fseek (f, chunkpos, SEEK_SET); + return 0; +} + +/* + * completely black frame + */ +void +fli_read_black (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf) +{ + memset (framebuf, 0, fli_header->width * fli_header->height); +} + +void +fli_write_black (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf) +{ + s_fli_chunk chunk; + + chunk.size = 6; + chunk.magic = FLI_BLACK; + + fli_write_long (f, chunk.size); + fli_write_short (f, chunk.magic); +} + +/* + * Uncompressed frame + */ +void +fli_read_copy (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf) +{ + fread (framebuf, fli_header->width, fli_header->height, f); +} + +void +fli_write_copy (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf) +{ + unsigned long chunkpos; + s_fli_chunk chunk; + + chunkpos = ftell (f); + fseek (f, chunkpos + 6, SEEK_SET); + fwrite (framebuf, fli_header->width, fli_header->height, f); + chunk.size = ftell (f) - chunkpos; + chunk.magic = FLI_COPY; + + fseek (f, chunkpos, SEEK_SET); + fli_write_long (f, chunk.size); + fli_write_short (f, chunk.magic); + + if (chunk.size & 1) + chunk.size++; + fseek (f, chunkpos + chunk.size, SEEK_SET); +} + +/* + * This is a RLE algorithm, used for the first image of an animation + */ +void +fli_read_brun (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf) +{ + unsigned short yc; + unsigned char *pos; + + for (yc = 0; yc < fli_header->height; yc++) + { + unsigned short pc, pcnt; + size_t n, xc; + + pc = fli_read_char (f); + xc = 0; + pos = framebuf + (fli_header->width * yc); + n = (size_t) fli_header->width * (fli_header->height - yc); + for (pcnt = pc; pcnt > 0; pcnt--) + { + unsigned short ps; + + ps = fli_read_char (f); + if (ps & 0x80) + { + unsigned short len; + + for (len = -(signed char) ps; len > 0 && xc < n; len--) + { + pos[xc++] = fli_read_char (f); + } + } + else + { + unsigned char val; + size_t len; + + len = MIN (n - xc, ps); + val = fli_read_char (f); + memset (&(pos[xc]), val, len); + xc+=len; + } + } + } +} + +void +fli_write_brun (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf) +{ + unsigned long chunkpos; + s_fli_chunk chunk; + unsigned short yc; + unsigned char *linebuf; + + chunkpos = ftell (f); + fseek (f, chunkpos + 6, SEEK_SET); + + for (yc = 0; yc < fli_header->height; yc++) + { + unsigned short xc, t1, pc, tc; + unsigned long linepos, lineend, bc; + + linepos = ftell (f); bc = 0; + fseek (f, 1, SEEK_CUR); + linebuf = framebuf + (yc * fli_header->width); + xc = 0; tc = 0; t1 = 0; + while (xc < fli_header->width) + { + pc = 1; + while ((pc < 120) && + ((xc + pc) < fli_header->width) && + (linebuf[xc + pc] == linebuf[xc])) + { + pc++; + } + if (pc > 2) + { + if (tc > 0) + { + bc++; + fli_write_char (f, (tc - 1)^0xFF); + fwrite (linebuf + t1, 1, tc, f); + tc = 0; + } + bc++; + fli_write_char (f, pc); + fli_write_char (f, linebuf[xc]); + t1 = xc + pc; + } + else + { + tc+=pc; + if (tc > 120) + { + bc++; + fli_write_char (f, (tc - 1)^0xFF); + fwrite (linebuf + t1, 1, tc, f); + tc = 0; + t1 = xc + pc; + } + } + xc+=pc; + } + if (tc > 0) + { + bc++; + fli_write_char (f, (tc - 1)^0xFF); + fwrite (linebuf + t1, 1, tc, f); + tc = 0; + } + lineend = ftell (f); + fseek (f, linepos, SEEK_SET); + fli_write_char (f, bc); + fseek (f, lineend, SEEK_SET); + } + + chunk.size = ftell (f) - chunkpos; + chunk.magic = FLI_BRUN; + + fseek (f, chunkpos, SEEK_SET); + fli_write_long (f, chunk.size); + fli_write_short (f, chunk.magic); + + if (chunk.size & 1) + chunk.size++; + fseek (f, chunkpos + chunk.size, SEEK_SET); +} + +/* + * This is the delta-compression method from the classic Autodesk + * Animator. It's basically the RLE method from above, but it + * supports skipping unchanged lines at the beginning and end of an + * image, and unchanged pixels in a line. This chunk is used in FLI + * files. + */ +void +fli_read_lc (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *framebuf) +{ + unsigned short yc, firstline, numline; + unsigned char *pos; + + memcpy (framebuf, old_framebuf, fli_header->width * fli_header->height); + firstline = fli_read_short (f); + numline = fli_read_short (f); + if (numline > fli_header->height || fli_header->height - numline < firstline) + return; + + for (yc = 0; yc < numline; yc++) + { + unsigned short pc, pcnt; + size_t n, xc; + + pc = fli_read_char (f); + xc = 0; + pos = framebuf + (fli_header->width * (firstline + yc)); + n = (size_t) fli_header->width * (fli_header->height - firstline - yc); + for (pcnt = pc; pcnt > 0; pcnt--) + { + unsigned short ps, skip; + + skip = fli_read_char (f); + ps = fli_read_char (f); + xc+=MIN (n - xc, skip); + if (ps & 0x80) + { + unsigned char val; + size_t len; + ps = -(signed char) ps; + val = fli_read_char (f); + len = MIN (n - xc, ps); + memset (&(pos[xc]), val, len); + xc+=len; + } + else + { + size_t len; + len = MIN (n - xc, ps); + fread (&(pos[xc]), len, 1, f); + xc+=len; + } + } + } +} + +void +fli_write_lc (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *framebuf) +{ + unsigned long chunkpos; + s_fli_chunk chunk; + unsigned short yc, firstline, numline, lastline; + unsigned char *linebuf, *old_linebuf; + + chunkpos = ftell (f); + fseek (f, chunkpos + 6, SEEK_SET); + + /* first check, how many lines are unchanged at the beginning */ + firstline = 0; + while ((memcmp (old_framebuf + (firstline * fli_header->width), + framebuf + (firstline * fli_header->width), + fli_header->width) == 0) && + (firstline < fli_header->height)) + firstline++; + + /* then check from the end, how many lines are unchanged */ + if (firstline < fli_header->height) + { + lastline = fli_header->height - 1; + while ((memcmp (old_framebuf + (lastline * fli_header->width), + framebuf + (lastline * fli_header->width), + fli_header->width) == 0) && + (lastline > firstline)) + lastline--; + numline = (lastline - firstline) + 1; + } + else + { + numline = 0; + } + if (numline == 0) + firstline = 0; + + fli_write_short (f, firstline); + fli_write_short (f, numline); + + for (yc = 0; yc < numline; yc++) + { + unsigned short xc, sc, cc, tc; + unsigned long linepos, lineend, bc; + + linepos = ftell (f); bc = 0; + fseek (f, 1, SEEK_CUR); + + linebuf = framebuf + ((firstline + yc)*fli_header->width); + old_linebuf = old_framebuf + ((firstline + yc)*fli_header->width); + xc = 0; + while (xc < fli_header->width) + { + sc = 0; + while ((linebuf[xc] == old_linebuf[xc]) && + (xc < fli_header->width) && + (sc < 255)) + { + xc++; + sc++; + } + fli_write_char (f, sc); + cc = 1; + while ((linebuf[xc] == linebuf[xc + cc]) && + ((xc + cc)<fli_header->width) && + (cc < 120)) + { + cc++; + } + if (cc > 2) + { + bc++; + fli_write_char (f, (cc - 1)^0xFF); + fli_write_char (f, linebuf[xc]); + xc+=cc; + } + else + { + tc = 0; + do { + sc = 0; + while ((linebuf[tc + xc + sc] == old_linebuf[tc + xc + sc]) && + ((tc + xc + sc)<fli_header->width) && + (sc < 5)) + { + sc++; + } + cc = 1; + while ((linebuf[tc + xc] == linebuf[tc + xc + cc]) && + ((tc + xc + cc)<fli_header->width) && + (cc < 10)) + { + cc++; + } + tc++; + } while ((tc < 120) && + (cc < 9) && + (sc < 4) && + ((xc + tc) < fli_header->width)); + bc++; + fli_write_char (f, tc); + fwrite (linebuf + xc, tc, 1, f); + xc+=tc; + } + } + lineend = ftell (f); + fseek (f, linepos, SEEK_SET); + fli_write_char (f, bc); + fseek (f, lineend, SEEK_SET); + } + + chunk.size = ftell (f) - chunkpos; + chunk.magic = FLI_LC; + + fseek (f, chunkpos, SEEK_SET); + fli_write_long (f, chunk.size); + fli_write_short (f, chunk.magic); + + if (chunk.size & 1) + chunk.size++; + fseek (f, chunkpos + chunk.size, SEEK_SET); +} + + +/* + * This is an enhanced version of the old delta-compression used by + * the autodesk animator pro. It's word-oriented, and supports + * skipping larger parts of the image. This chunk is used in FLC + * files. + */ +void +fli_read_lc_2 (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *framebuf) +{ + unsigned short yc, lc, numline; + unsigned char *pos; + + memcpy (framebuf, old_framebuf, fli_header->width * fli_header->height); + yc = 0; + numline = fli_read_short (f); + for (lc = 0; lc < numline; lc++) + { + unsigned short pc, pcnt, lpf, lpn; + size_t n, xc; + + pc = fli_read_short (f); + lpf = 0; lpn = 0; + while (pc & 0x8000) + { + if (pc & 0x4000) + { + yc += -(signed short) pc; + } + else + { + lpf = 1; + lpn = pc & 0xFF; + } + pc = fli_read_short (f); + } + yc = MIN (yc, fli_header->height); + xc = 0; + pos = framebuf + (fli_header->width * yc); + n = (size_t) fli_header->width * (fli_header->height - yc); + for (pcnt = pc; pcnt > 0; pcnt--) + { + unsigned short ps, skip; + + skip = fli_read_char (f); + ps = fli_read_char (f); + xc += MIN (n - xc, skip); + if (ps & 0x80) + { + unsigned char v1, v2; + + ps = -(signed char) ps; + v1 = fli_read_char (f); + v2 = fli_read_char (f); + while (ps > 0 && xc + 1 < n) + { + pos[xc++] = v1; + pos[xc++] = v2; + ps--; + } + } + else + { + size_t len; + + len = MIN ((n - xc)/2, ps); + fread (&(pos[xc]), len, 2, f); + xc += len << 1; + } + } + if (lpf) + pos[xc] = lpn; + yc++; + } +} diff --git a/plug-ins/file-fli/fli.h b/plug-ins/file-fli/fli.h new file mode 100644 index 0000000..40f0f76 --- /dev/null +++ b/plug-ins/file-fli/fli.h @@ -0,0 +1,153 @@ +/* + * Written 1998 Jens Ch. Restemeier <jchrr@hrz.uni-bielefeld.de> + * + * 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 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ +#ifndef _FLI_H +#define _FLI_H + +/** structures */ + +typedef struct _fli_header +{ + unsigned long filesize; + unsigned short magic; + unsigned short frames; + unsigned short width; + unsigned short height; + unsigned short depth; + unsigned short flags; + unsigned long speed; + unsigned long created; + unsigned long creator; + unsigned long updated; + unsigned short aspect_x, aspect_y; + unsigned long oframe1, oframe2; +} s_fli_header; + +typedef struct _fli_frame +{ + unsigned long size; + unsigned short magic; + unsigned short chunks; +} s_fli_frame; + +typedef struct _fli_chunk +{ + unsigned long size; + unsigned short magic; + unsigned char *data; +} s_fli_chunk; + +/** chunk magics */ +#define NO_HEADER 0 +#define HEADER_FLI 0xAF11 +#define HEADER_FLC 0xAF12 +#define FRAME 0xF1FA + +/** codec magics */ +#define FLI_COLOR 11 +#define FLI_BLACK 13 +#define FLI_BRUN 15 +#define FLI_COPY 16 +#define FLI_LC 12 +#define FLI_LC_2 7 +#define FLI_COLOR_2 4 +#define FLI_MINI 18 + +/** codec masks */ +#define W_COLOR 0x0001 +#define W_BLACK 0x0002 +#define W_BRUN 0x0004 +#define W_COPY 0x0008 +#define W_LC 0x0010 +#define W_LC_2 0x0020 +#define W_COLOR_2 0x0040 +#define W_MINI 0x0080 +#define W_ALL 0xFFFF + +/** functions */ +void fli_read_header (FILE *f, + s_fli_header *fli_header); +void fli_read_frame (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *old_cmap, + unsigned char *framebuf, + unsigned char *cmap); + +void fli_read_color (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap); +void fli_read_color_2 (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap); +void fli_read_black (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf); +void fli_read_brun (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf); +void fli_read_copy (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf); +void fli_read_lc (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *framebuf); +void fli_read_lc_2 (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *framebuf); + +void fli_write_header (FILE *f, + s_fli_header *fli_header); +void fli_write_frame (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *old_cmap, + unsigned char *framebuf, + unsigned char *cmap, + unsigned short codec_mask); + +int fli_write_color (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap); +int fli_write_color_2 (FILE *f, + s_fli_header *fli_header, + unsigned char *old_cmap, + unsigned char *cmap); +void fli_write_black (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf); +void fli_write_brun (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf); +void fli_write_copy (FILE *f, + s_fli_header *fli_header, + unsigned char *framebuf); +void fli_write_lc (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *framebuf); +void fli_write_lc_2 (FILE *f, + s_fli_header *fli_header, + unsigned char *old_framebuf, + unsigned char *framebuf); + +#endif |