Commit 1a3398f0 authored by Sven Neumann's avatar Sven Neumann
Browse files

Added xjt plug-in.


--Sven
parent 9c2d270a
Tue Mar 23 12:59:20 MET 1999 Sven Neumann <sven@gimp.org>
* configure.in
* plug-ins/Makefile
* plug-ins/xjt: added xjt plug-in created by Wolfgang Hofer.
Tue Mar 23 12:01:48 MET 1999 Sven Neumann <sven@gimp.org>
* configure.in
......
......@@ -219,7 +219,8 @@ dnl Test for libjpeg
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
jpeg_ok=yes,
jpeg_ok=no
AC_MSG_WARN(*** JPEG plug-in will not be built (JPEG library not found) ***))
AC_MSG_WARN(*** JPEG plug-in will not be built (JPEG library not found) ***)
AC_MSG_WARN(*** XJT plug-in will not be built (JPEG library not found) ***))
if test "$jpeg_ok" = yes; then
AC_MSG_CHECKING([for jpeglib.h])
AC_TRY_CPP(
......@@ -231,12 +232,13 @@ dnl Test for libjpeg
jpeg_ok=no)
AC_MSG_RESULT($jpeg_ok)
if test "$jpeg_ok" = yes; then
JPEG='jpeg'; LIBJPEG_LIB='-ljpeg'
JPEG='jpeg'; XJT='xjt'; LIBJPEG_LIB='-ljpeg'
AC_CHECK_LIB(jpeg, jpeg_simple_progression,
AC_DEFINE(HAVE_PROGRESSIVE_JPEG),
AC_MSG_WARN(JPEG library does not support progressive saving.))
else
AC_MSG_WARN(*** JPEG plug-in will not be built (JPEG header file not found) ***)
AC_MSG_WARN(*** XJT plug-in will not be built (JPEG header file not found) ***)
fi
fi
fi
......@@ -600,7 +602,7 @@ fi
GIMPDOCS=
if test -n "$DISTMAKE"; then
WEBBROWSER=webbrowser TIFF=tiff JPEG=jpeg PNG=png AA=aa MPEG=mpeg
XD=xd XPM=xpm GIMPDOCS=docs
XD=xd XJT=xjt XPM=xpm GIMPDOCS=docs
fi
AM_CONDITIONAL(STATICLIBS, test x$enable_static = xyes)
......@@ -631,6 +633,7 @@ AC_SUBST(LIBXMU_LIB)
AC_SUBST(TIFF)
AC_SUBST(LIBTIFF_LIB)
AC_SUBST(JPEG)
AC_SUBST(XJT)
AC_SUBST(LIBJPEG_LIB)
AC_SUBST(PNG)
AC_SUBST(LIBPNG_LIB)
......@@ -677,6 +680,7 @@ plug-ins/png/Makefile
plug-ins/tiff/Makefile
plug-ins/webbrowser/Makefile
plug-ins/xd/Makefile
plug-ins/xjt/Makefile
plug-ins/xpm/Makefile
plug-ins/AlienMap/Makefile
plug-ins/CEL/Makefile
......
......@@ -14,6 +14,7 @@ SUBDIRS = \
@TIFF@ \
@WEBBROWSER@ \
@XD@ \
@XJT@ \
@XPM@ \
AlienMap \
CEL \
......
Makefile.in
Makefile
.deps
_libs
.libs
xjt
## Process this file with automake to produce Makefile.in
pluginlibdir = $(gimpplugindir)/plug-ins
pluginlib_PROGRAMS = xjt
EXTRA_DIST = README README_xjt_fileformat.txt
xjt_SOURCES = \
xjt.c xjpeg.c xjpeg.h xpdb_calls.c xpdb_calls.h
INCLUDES = \
$(GTK_CFLAGS) \
-I$(top_srcdir) \
-I$(includedir)
LDADD = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la \
$(GTK_LIBS) \
@LIBJPEG_LIB@ \
-lc
DEPS = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la
xjt_DEPENDENCIES = $(DEPS)
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done
@for subdir in $(SUBDIRS); do \
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
for file in $$files; do \
echo $$subdir/$$file; \
done; \
done
xjt is a file plug-in to load and save GIMP RGB and GRAY Images with
all its layers, channels and guides.
Started implementation TATTOO, PARASITE RESOLUTION 1999.02.01
(see README_xjt_fileformat.txt for more Information about XJT)
The XJT Load/Save Plugin requires:
- GIMP 1.0.0 (or better)
- libjpeg
- Unix tar
- Unix gzip (optional)
- Unix bzip2 (optional)
- gap_patches (optional) **)
**) NO PATCHES are required if you have the latest development version of GIMP 1.1
Installation:
-------------
If You are using GIMP 1.0.2 (or older versions):
# (optional) install gap_patches
# they are available at the registry at:
# http://gimp.foebud.org/registry/detailview.phtml?plugin=gap_patches
# or at:
# http://gimp.foebud.org/registry/detailview.phtml?plugin=gap
cp Makefile.1.0 Makefile
If you are using GIMP 1.1.1
# GIMP 1.1.1 is an unstable prerelease.
cp Makefile.1.1 Makefile
# edit the Makefile to fit your setup
# then type
make # to compile and
make install # to install the plugin
Change Log:
-----------
1.02 1999.02.?? added load/save for resolution, tattoos, and parasites
(works only with gimp 1.1.1)
1.01 1998.11.24 added load/save for guides (works only with gimp 1.1)
added Makefiles to compile xjt under gimp 1.0.2 and 1.1
Restrictions of the XJT release 1.01:
-----------------------------------------
The 1.01 implementation of xjt is now able to save and load
the full Image Information (including guides) on RGB and GRAY Images.
when xjt is used with the latest development version of GIMP 1.1.
If xjt is used with GIMP 1.0.2 (or earlier versions)
there are some restrictions:
GUIDES are ignored at save and load.
(GIMP 1.0.2 has no Interface to access GUIDES from a plugin)
LINKED to load/save the linked state of a Layer
you must install the GAP_PATCHES to the gimp core.
(GIMP 1.0.2 has no Interface to access the Layers LINKED state from a plugin)
FLOATING_SELECTION
are supported by the XJT Fileformat, but you need to apply the GAP_PATCHES
to the gimp core.
Without the patches:
- XJT can not find out the drawable where the floating selection
is attached to. (the PROP_FLOATING_ATTACHED property information
is not saved to the PRP file in that case)
- XJT can not attach the floating selection to a layer or channel
at load. (even if you add the PROP_FLOATING_ATTACHED to the PRP file
with an editor)
The GAP_PATCHES provide some of the missing PDB-interfaces
(except those for guides, tattoos, parasites and resolution)
for GIMP-core versions from 1.0.0 upto 1.0.2.
XJT Fileformat specification:
------------------------------
(XJT 1.1, 1998.10.31 - 1999.03.16)
----------------------------------------------------------------
XJT Fileformat was designed to save compressed GIMP Images with
all the properties that are available in GIMP.
XJT uses JPEG compression foreach layer or channel and TAR to
collect all layers in one file. (Layers with alphachannels
are splitted into 2 jpeg files)
Additional property informations about offsets, opacity, layernames etc..
are stored in the readable textfile called "PRP" (Properties)
The resulting tar-file is optionaly compressed a 2.nd time
using GZIP or BZIP2.
(depends on the filename ending "gz" or "bz2")
Filename Extensions are:
image.xjt # plain tar file
image.xjtgz # gzip compressed tar file
image.xjbz2 # bzip2 compressed tar file
Restrictions:
-------------
** XJT does not support INDEXED Images. **
Why should anyone use the new XJT Fileformat ?
---------------------------------------------
XJT Advantages:
- The high JPEG compression rates (1:10 and more) helps
to save a lot of Diskspace.
(especially if you are using GIMP and GAP to
store many images as AnimFrames )
- Saved image keeps all layers channels and properties
- single Layers can be extracted using tar
and then be accessed by many other
jpeg-compatible programs.
XJT Disadvantages:
- JPEG is a lossy compression.
After save and load the bitmapdata
differs a little from the original,
depending on the used quality setting.
==> use GIMP's native xcf format
where you need exactly the original.
Example:
________
Example of PRP file:
--------------------
GIMP_XJ_IMAGE ver:"1.0" w/h:256,256
L0 acl fsl pt o:35,116 n:"Pasted Layer"
L1 ln pt aml eml o:0,7 n:"Pasted Layer"
m1 smc o:0,7 n:"Pasted Layer mask"
l2 fa n:"Background"
c0 op:33.725 iv smc c:255,0,0 n:"saved selection mask"
TAR Contents of the example file
--------------------------------
>tar -tvf example.xjt
-rw-r--r-- hof/users 228 Nov 1 11:19 1998 PRP
-rw-r--r-- hof/users 2352 Nov 1 11:19 1998 c0.jpg
-rw-r--r-- hof/users 3789 Nov 1 11:19 1998 l0.jpg
-rw-r--r-- hof/users 8569 Nov 1 11:19 1998 l1.jpg
-rw-r--r-- hof/users 9098 Nov 1 11:19 1998 l2.jpg
-rw-r--r-- hof/users 3926 Nov 1 11:19 1998 la0.jpg
-rw-r--r-- hof/users 6095 Nov 1 11:19 1998 la1.jpg
-rw-r--r-- hof/users 1623 Nov 1 11:19 1998 lm1.jpg
The example image has dimensions of 256x256 pixels.
The Image Type is RGB (default Property typ:0)
L0 The Image has a floating selection (stored as l0.jpg) at offset 35/116.
The floating selection has an alpha channel (stored in la0.jpg)
The floating selection is the active Layer.
There are 2 further Layers.
L1 at offset 077 is named "Pasted Layer" and is stored in l1.jpg.
This Layer has both an alpha channel (stored in la1.jpg)
and a LayerMask (stored in lm1.jpg)
(the Properties of the LayerMask are stored in an extra Line
of the PRP file beginning with m1)
l2 is the Background Layer without alpha channel. (stored in l2.jpg)
The Floating selection is attached to this layer ("fa" Property)
c0 The image has one extra channel named "saved selection mask"
This channel has full red color (c:255,0,0 property) and an opacity
value of 33.725 % but is invisible ("iv" property)
Syntax of the PRP -file
-----------------------
Image Properties (must be the 1. line in the PRP file)
================
The line starts with
GIMP_XJ_IMAGE Image-fileformat-Identifier
followed by a List of Image properties seperated by Blank:
PROP_VERSION
PROP_DIMENSION
PROP_RESOLUTION
PROP_TYPE 0 == RGB, 1 = GRAY
PROP_GUIDES position, orientation (can occure more than 1 time)
PROP_PARASITES
Layer Properties:
=================
The line starts with
l<nr> Layer description of layer <nr> without alpha channel.
the layers bitmapdata is stored in a jpeg encoded
file named l<nr>.jpg
L<nr> Layer description of layer <nr> with alpha channel.
the layers bitmapdata is stored in a jpeg encoded
file named l<nr>.jpg,
the alpha channel is stored in an additional jpeg encoded
file named la<nr>.jpg,
followed by a List of Layer properties seperated by Blank:
(properties for the default values are not written)
PROP_ACTIVE_LAYER
PROP_FLOATING_SELECTION
PROP_FLOATING_ATTACHED
PROP_OPACITY
PROP_MODE
PROP_VISIBLE
PROP_LINKED
PROP_PRESERVE_TRANSPARENCY
PROP_APPLY_MASK
PROP_EDIT_MASK
PROP_SHOW_MASK
PROP_OFFSETS
PROP_TATTOO
PROP_PARASITES
PROP_NAME
Channel Properties:
===================
The line starts with
c<nr> Channel description of channel <nr>.
the channels bitmapdata is stored in a jpeg encoded
file named c<nr>.jpg
m<nr> Layermask-channel of layer <nr>
the layermask-channels bitmapdata is tored in a jpeg encoded
file named c<nr>.jpg
followed by a List of Channel properties seperated by Blank:
(properties for the default values are not written)
PROP_ACTIVE_CHANNEL
PROP_SELECTION
PROP_FLOATING_ATTACHED
PROP_OPACITY
PROP_VISIBLE
PROP_SHOW_MASKED
PROP_COLOR
PROP_TATTOO
PROP_PARASITES
PROP_NAME
Parasite Properties:
====================
The line starts with
p<nr> Parasite description of parasite <nr>.
the parasite data is stored 1:1 in a
file named p<nr>.pte
followed by a List of Layer properties seperated by Blank:
(properties for the default values are not written)
PROP_NAME
--------------------------
Properties Summary
--------------------------
Property types:
PTYP_BOOLEAN
mnemonic
PTYP_INT
mnemonic:int_value
PTYP_2xINT
mnemonic:int_value,int_value
PTYP_3xINT
mnemonic:int_value,int_value,int_value
PTYP_FLT
mnemonic:float_value
PTYP_2xFLT
mnemonic:float_value,float_value
PTYP_STRING
mnemonic:"string_value"
Properties are written as short mnemonics (1 upto 3 characters) to identify the Property.
Non-boolean Property-mnemonics require a Value seperated by ':'.
For each property there is a defined Defaultvalue. (usually 0, or "" for strings)
The Defaultvalue is assumed when the Token is not specified,
Boolean tokens default always to FALSE and become TRUE when specified.
/* propery mnemonic type default values */
PROP_END, "*", PTYP_NOT_SUPPORTED, 0,
PROP_COLORMAP, "*", PTYP_NOT_SUPPORTED, 0,
PROP_ACTIVE_LAYER, "acl", PTYP_BOOLEAN, FALSE,
PROP_ACTIVE_CHANNEL, "acc", PTYP_BOOLEAN, FALSE,
PROP_SELECTION, "sel", PTYP_BOOLEAN, FALSE,
PROP_FLOATING_SELECTION, "fsl", PTYP_BOOLEAN, FALSE,
PROP_OPACITY, "op", PTYP_FLT, 100.0,
PROP_MODE, "md", PTYP_INT, 0,
PROP_VISIBLE, "iv", PTYP_BOOLEAN, FALSE,
PROP_LINKED, "ln", PTYP_BOOLEAN, FALSE,
PROP_PRESERVE_TRANSPARENCY, "pt", PTYP_BOOLEAN, FALSE,
PROP_APPLY_MASK, "aml", PTYP_BOOLEAN, FALSE,
PROP_EDIT_MASK, "eml", PTYP_BOOLEAN, FALSE,
PROP_SHOW_MASK, "sml", PTYP_BOOLEAN, FALSE,
PROP_SHOW_MASKED, "smc", PTYP_BOOLEAN, FALSE,
PROP_OFFSETS, "o", PTYP_2xINT, 0, 0,
PROP_COLOR, "c", PTYP_3xINT, 0, 0, 0,
PROP_COMPRESSION, "*", PTYP_NOT_SUPPORTED, 0,
PROP_GUIDES, "g", PTYP_2xINT, 0, 0,
PROP_RESOLUTION, "res", PTYP_2xFLT, 72.0, 72.0,
PROP_TATTOO, "tto", PTYP_INT, 0,
PROP_PARASITES, "pte", PTYP_INT, 0,
PROP_FLOATING_ATTACHED, "fa", PTYP_BOOLEAN, FALSE,
PROP_NAME, "n", PTYP_STRING, "",
PROP_DIMENSION, "w/h", PTYP_2xINT, 0, 0,
PROP_TYPE, "typ", PTYP_INT, 0,
PROP_VERSION, "ver", PTYP_STRING, 0,
PROP_OPACITY valid values are
0.0 ( full transparent)
upto
100.0 (full opaque)
PROP_TYPE valid values are:
0 ... RGB
1 ... GRAY
PROP_MODE valid values are:
0 ... NORMAL_MODE
1 ... DISSOLVE_MODE
3 ... MULTIPLY_MODE
4 ... SCREEN_MODE
5 ... OVERLAY_MODE
6 ... DIFFERENCE_MODE
7 ... ADDITION_MODE
8 ... SUBTRACT_MODE
9 ... DARKEN_ONLY_MODE
10 ... LIGHTEN_ONLY_MODE
11 ... HUE_MODE
12 ... SATURATION_MODE
13 ... COLOR_MODE
14 ... VALUE_MODE
-----------------------------------------------------------
changelog:
------------------------------------------------
- XJT Version 1.1
XJT Format 1.1 was extended for
RESOLUTION, TATTOO's, and PARASITES
Please note that TATTOO's and PARASITES are only defined
but not implemented.
(Gimp 1.1.3 has no PDB-Interfaces to enable Plug-Ins
to Load/Save TATTOO's and PARASITES)
PARASITES: The parasite data is stored in a seperate file for each
parasite. The file is named p<id>.pte, where
<id> is a unique integer parasite Id.
A Layer, Channel or Image can have 0 or more PROP_PARASITE
Properties (pte:1 pte:2 ...), where the integer parameter
refers to the unique parasite id.
Parasite entries can have a Name Property.
Extended Example of PRP file with resolution, and parasites:
-------------------------------------------------------------
GIMP_XJ_IMAGE ver:"1.1" w/h:256,256 res:72.0,100.5 pte:1
L0 acl fsl pt o:35,116 n:"Pasted Layer"
L1 ln pt aml eml o:0,7 n:"Pasted Layer" pte:2 pte:3
m1 smc o:0,7 n:"Pasted Layer mask"
l2 fa n:"Background"
c0 op:33.725 iv smc c:255,0,0 n:"saved selection mask" pte:4
p1 n:"image parasite"
p2 n:"layer parasite A"
p3 n:"layer parasite B"
p4 n:"channel parasite"
TAR Contents of the example file
--------------------------------
>tar -tvf example.xjt
-rw-r--r-- hof/users 228 Nov 1 11:19 1998 PRP
-rw-r--r-- hof/users 2352 Nov 1 11:19 1998 c0.jpg
-rw-r--r-- hof/users 3789 Nov 1 11:19 1998 l0.jpg
-rw-r--r-- hof/users 8569 Nov 1 11:19 1998 l1.jpg
-rw-r--r-- hof/users 9098 Nov 1 11:19 1998 l2.jpg
-rw-r--r-- hof/users 3926 Nov 1 11:19 1998 la0.jpg
-rw-r--r-- hof/users 6095 Nov 1 11:19 1998 la1.jpg
-rw-r--r-- hof/users 1623 Nov 1 11:19 1998 lm1.jpg
p1.pte
p2.pte
p3.pte
p4.pte
This diff is collapsed.
/* xjpeg.h
*
* This Module contains:
* jpeg load and save procedures for the use in XJT fileformat save
* (based on libjpeg)
*
*/
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* revision history:
* version 1.00.00; 1998/10/26 hof: 1.st (pre) release
*/
#ifndef _XJPEG_H
#define _XJPEG_H
#include "libgimp/gimp.h"
typedef enum {
JSVM_DRAWABLE, /* save the drawable as it is (ignore alpha channel) */
JSVM_ALPHA /* save the alpha channel */
} t_save_mode;
typedef struct
{
gdouble quality;
gdouble smoothing;
gint optimize;
gint clr_transparent; /* clear pixels where alpha is full transparent */
} t_JpegSaveVals;
gint
xjpg_save_drawable (char *filename,
gint32 image_ID,
gint32 drawable_ID,
gint save_mode,
t_JpegSaveVals *jsvals);
gint32
xjpg_load_layer (char *filename,
gint32 image_id,
int image_type,
char *layer_name,
gdouble layer_opacity,
GLayerMode layer_mode
);
gint
xjpg_load_layer_alpha (char *filename,
gint32 image_id,
gint32 layer_id
);
gint32
xjpg_load_channel (char *filename,
gint32 image_id,
gint32 drawable_id,
char *channel_name,
gdouble channel_opacity,
guchar red, guchar green, guchar blue
);
#endif
This diff is collapsed.
This diff is collapsed.
/* xpdb_calls.h
*
*/
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis