Commit 9932e05c authored by Michael Natterer's avatar Michael Natterer 😴

plug-ins: remove file-xjt

It will never hold high bit depths using JPEG compression, and nobody
is going to port it to layer groups and whatever either.  Wolfgang
says it's obsolete, whoever needs to convert old files can use 2.8.
parent c54169c9
......@@ -1079,8 +1079,7 @@ jpeg_ok=no
if test "x$with_libjpeg" != xno && test -z "$JPEG_LIBS"; then
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
jpeg_ok=yes,
[jpeg_ok="no (JPEG library not found)"
AC_MSG_WARN(*** XJT plug-in will not be built (JPEG library not found) ***)])
[jpeg_ok="no (JPEG library not found)"])
if test "$jpeg_ok" = yes; then
AC_MSG_CHECKING([for jpeglib.h])
AC_PREPROC_IFELSE(
......@@ -1118,18 +1117,6 @@ AM_CONDITIONAL(BUILD_JPEG, test "x$jpeg_ok" = xyes)
AC_SUBST(JPEG_LIBS)
## xjt does build, but it is more confusing than useful on Win32,
## as it wants to run tar, mv and bzip2, which seldom are available
AM_CONDITIONAL(BUILD_XJT, test "x$jpeg_ok" = xyes && test "x$os_win32" = xno)
if test "x$jpeg_ok" != xyes; then
have_xjt="no (no JPEG library)"
elif test "x$os_win32" = xyes; then
have_xjt="no (not built on Windows)"
else
have_xjt=yes
fi
################
# Check for libz
################
......@@ -2227,7 +2214,6 @@ plug-ins/file-jpeg/Makefile
plug-ins/file-psd/Makefile
plug-ins/file-sgi/Makefile
plug-ins/file-uri/Makefile
plug-ins/file-xjt/Makefile
plug-ins/flame/Makefile
plug-ins/fractal-explorer/Makefile
plug-ins/fractal-explorer/examples/Makefile
......@@ -2387,7 +2373,6 @@ Optional Plug-Ins:
Webpage: $have_webkit
Windows ICO: $have_libpng
WMF: $have_libwmf
XJT: $have_xjt
X11 Mouse Cursor: $have_xmc
XPM: $have_libxpm
......
......@@ -47,10 +47,6 @@ else
file_uri = file-uri
endif
if BUILD_XJT
file_xjt = file-xjt
endif
if HAVE_LIBEXIF
metadata = metadata
endif
......@@ -70,7 +66,6 @@ SUBDIRS = \
$(file_psd) \
file-sgi \
$(file_uri) \
$(file_xjt) \
flame \
fractal-explorer \
gfig \
......
/Makefile.in
/Makefile
/.deps
/_libs
/.libs
/file-xjt
/file-xjt.exe
## 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 HAVE_WINDRES
include $(top_srcdir)/build/windows/gimprc-plug-ins.rule
file_xjt_RC = file-xjt.rc.o
endif
libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = file-xjt
EXTRA_DIST = \
README \
README_xjt_fileformat.txt
file_xjt_SOURCES = \
xjt.c \
xjpeg.c \
xjpeg.h
INCLUDES = \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
-I$(includedir)
LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpconfig) \
$(libgimpmath) \
$(libgimp) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(JPEG_LIBS) \
$(INTLLIBS) \
$(file_xjt_RC)
xjt is a file plug-in to load and save GIMP RGB and GRAY Images with
all its layers, channels, parasites and guides.
(see README_xjt_fileformat.txt for more Information about XJT)
The XJT Load/Save Plugin requires:
- GIMP 1.1.5 (or better)
- libjpeg
- Unix tar
- Unix gzip (optional)
- Unix bzip2 (optional)
Installation:
-------------
The XJT Plugin is Part of GIMP (since 1.1.x development release)
and should be built and installed by the gimp installation.
Change Log: (see also revision history in the source files)
-----------
(XJT 1.1.15, 2000.01.23)
- impementation of parasites
- string prpoerties now can contain \" and \n characters.
Images saved with the new XJT 1.1.15 Plugin
cannot be loaded by the older XJT 1.1 Plugin
if those characters are used in layer or channel names.
- The gimp internal representation of Guide orientation has changed
since the first xjt release (more than one time).
XJT 1.1.15 defines XJT_ORIENTATION_HORIZONTAL 0
for orientation values in the xjt guide property.
and is now independent from the gimp internal representation.
(Gimp's ORIENTATION_HORIZONTAL is translated to XJT_ORIENTATION_HORIZONTAL
Expect Guide orientation swap problems if
you load xjt 1.1 if they were saved with
older gimp 1.1.x development version prior to gimp 1.1.15
(XJT 1.1, 1998.10.31 - 1999.03.16)
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
------------------------------
XJT Fileformat specification:
------------------------------
(XJT 1.1.16b, 2000.02.05) unit
(XJT 1.1.15b, 2000.01.30) paths
(XJT 1.1.15a, 2000.01.23)
(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_GIMP_VERSION
PROP_DIMENSION
PROP_RESOLUTION
PROP_UNIT
PROP_TYPE
PROP_GUIDES (can occure more than 1 time)
PROP_PARASITES (can occure more than 1 time)
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 (can occure more than 1 time)
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 (can occure more than 1 time)
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 Parasite properties seperated by Blank:
(properties for the default values are not written)
PROP_NAME
PROP_PARASITE_FLAGS
Path Properties:
====================
The line starts with
PATH Path identstring.
the parasite data is stored 1:1 in a
file named p<nr>.pte
followed by a List of Path properties seperated by Blank:
(properties for the default values are not written)
PROP_NAME
PROP_PATH_TYPE
PROP_PATH_CURRENT
PROP_PATH_LOCKED
PROP_TATTOO
PROP_PATH_POINT
--------------------------
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_FLIST
mnemonic:float_value[,float_value ...]
xjt uses max 5 digits behind the comma.
precision of max 5 digits
17.00000999 is truncated to 17
2.00001999 is truncated to 2.00001
PTYP_STRING
mnemonic:"string_value"
If a String contains DoublleQuote Backslash
or newline Characters, they are escaped by
a preceeding Backslash character.
Example:
the text:
hello "quotes" and \backslash
is encoded as:
n:"hello \"quotes\" and \\backslash"
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.
/* property 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_UNIT, "unt", PTYP_INT, 0, /* XJT_UNIT_PIXEL */
PROP_TATTOO, "tto", PTYP_INT, 0,
PROP_PARASITES, "pte", PTYP_INT, 0,
PROP_PARASITE_FLAGS, "ptf", PTYP_INT, 1, /* PARASITE_PERSISTENT */
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_GIMP_VERSION, "gimp", PTYP_3xINT, 0,
PROP_PATH_POINT, "php", PTYP_FLIST, 0.0, 0.0, 0.0
PROP_PATH_TYPE, "pht", PTYP_INT, 1, /* XJT_BEZIER_PATH */
PROP_PATH_CURRENT, "pha", PTYP_BOOLEAN, FALSE,
PROP_PATH_LOCKED, "phl", PTYP_BOOLEAN, FALSE,
Property Values (Valid Ranges)
------------------------------
PROP_OPACITY valid values are
0.0 (full transparent)
upto
100.0 (full opaque)
PROP_TYPE valid values are:
0 ... XJT_RGB
1 ... XJT_GRAY
PROP_MODE valid values are:
0 ... XJT_NORMAL_MODE
1 ... XJT_DISSOLVE_MODE
2 ... XJT_BEHIND_MODE
3 ... XJT_MULTIPLY_MODE
4 ... XJT_SCREEN_MODE
5 ... XJT_OVERLAY_MODE
6 ... XJT_DIFFERENCE_MODE
7 ... XJT_ADDITION_MODE
8 ... XJT_SUBTRACT_MODE
9 ... XJT_DARKEN_ONLY_MODE
10 ... XJT_LIGHTEN_ONLY_MODE
11 ... XJT_HUE_MODE
12 ... XJT_SATURATION_MODE
13 ... XJT_COLOR_MODE
14 ... XJT_VALUE_MODE
15 ... XJT_DIVIDE_MODE
PROP_GUIDES
valid values for the 1.st integer are
positve integers, representing x or y
position (depends on the 2.nd value)
valid values for the 2.nd integer are:
0 ... XJT_ORIENTATION_HORIZONTAL
1 ... XJT_ORIENTATION_VERTICAL
Note:
in older xjt files (older than xjt version 1.1.15)
there was no exact specification and the gimp internal
representation of the guide orientation was written
to the xjt guide orientation property.
Unforunately this gimp internal representation has changed
PROP_PATH_TYPE valid values are:
1 ... XJT_BEZIER_PATH
PROP_PATH_POINT
This property is a list of float values.
For Paths of the type XJT_BEZIER_PATH
each point is represented by a float value triplet
x,y,type
where type can be 1 (BEZIER_ANCHOR point)
or 2 (BEZIER_CONTROL point)
PROP_UNIT valid values are:
0 ... XJT_UNIT_PIXEL
1 ... XJT_UNIT_INCH
2 ... XJT_UNIT_MM
3 ... XJT_UNIT_POINT
4 ... XJT_UNIT_PICA
-------------------------------
Extended Example of PRP file:
-------------------------------
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.
Example of PRP file with resolution, parasites and paths:
-------------------------------------------------------------
GIMP_XJ_IMAGE ver:"1.1" w/h:256,256 res:72.0,100.5 pte:1
PATH n:"Path 1" php:103,65,1,103,65,2,176,15,2,177,15,1,178,15,2,198,229,2,198,229,1,198,229,2
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
/* GIMP - The GNU 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 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 <http://www.gnu.org/licenses/>.
*/
/* JPEG loading and saving routines adapted for the GIMP XJT fileformat
* -Wolfgang Hofer
*
* This filter is heavily based upon the "example.c" file in libjpeg.
* In fact most of the loading and saving code was simply cut-and-pasted
* from that file. The filter, therefore, also uses libjpeg.
*/
/* revision history:
* version 1.1.15a; 2000/01/25 hof: use g_malloc, g_free
* version 1.00.00; 1998/10/26 hof: 1.st (pre) release
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <glib/gstdio.h>
/* Include for External Libraries */
#include <jpeglib.h>
/* GIMP includes */
#include "libgimp/gimp.h"
#include "xjpeg.h"
extern int xjt_debug;
/* Declare local functions.
*/
typedef struct my_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
} *my_error_ptr;
/*
* Here's the routine that will replace the standard error_exit method:
*/
static void
my_error_exit (j_common_ptr cinfo)
{
/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
my_error_ptr myerr = (my_error_ptr) cinfo->err;
/* Always display the message. */
/* We could postpone this until after returning, if we chose. */
(*cinfo->err->output_message) (cinfo);
/* Return control to the setjmp point */
longjmp (myerr->setjmp_buffer, 1);
}
/* ============================================================================
* xjpg_load_layer
* load layer from jpeg file
* ============================================================================
*/
gint32
xjpg_load_layer (const char *filename,
gint32 image_id,
int image_type,
char *layer_name,
gdouble layer_opacity,
GimpLayerModeEffects layer_mode
)
{
GimpPixelRgn l_pixel_rgn;
GimpDrawable *l_drawable;
gint32 l_layer_id;
GimpImageType l_layer_type;
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
FILE *infile;
guchar *l_buf;
guchar **l_rowbuf;
int l_tile_height;
int l_scanlines;
int l_idx, l_start, l_end;
/* We set up the normal JPEG error routines. */
cinfo.err = jpeg_std_error (&jerr.pub);
jerr.pub.error_exit = my_error_exit;
if ((infile = g_fopen (filename, "rb")) == NULL)
{
g_warning ("can't open \"%s\"\n", filename);
return -1;
}
/* Establish the setjmp return context for my_error_exit to use. */
if (setjmp (jerr.setjmp_buffer))
{
/* If we get here, the JPEG code has signaled an error.
* We need to clean up the JPEG object, close the input file, and return.
*/
jpeg_destroy_decompress (&cinfo);
if (infile)
fclose (infile);
g_printerr ("XJT: JPEG load error\n");
return -1;
}
/* Now we can initialize the JPEG decompression object. */
jpeg_create_decompress (&cinfo);
/* Step 2: specify data source (eg, a file) */
jpeg_stdio_src (&cinfo, infile);
/* Step 3: read file parameters with jpeg_read_header() */
(void) jpeg_read_header (&cinfo, TRUE);
/* We can ignore the return value from jpeg_read_header since
* (a) suspension is not possible with the stdio data source, and
* (b) we passed TRUE to reject a tables-only JPEG file as an error.
* See libjpeg.doc for more info.
*/
/* Step 4: set parameters for decompression */
/* In this example, we don't need to change any of the defaults set by
* jpeg_read_header(), so we do nothing here.
*/
/* Step 5: Start decompressor */
jpeg_start_decompress (&cinfo);
/* We may need to do some setup of our own at this point before reading
* the data. After jpeg_start_decompress() we have the correct scaled
* output image dimensions available, as well as the output colormap
* if we asked for color quantization.
* In this example, we need to make an output work buffer of the right size.
*/
/* temporary buffer */
l_tile_height = gimp_tile_height ();
l_buf = g_new (guchar, l_tile_height * cinfo.output_width * cinfo.output_components);
l_rowbuf = g_new (guchar*, l_tile_height);
for (l_idx = 0; l_idx < l_tile_height; l_idx++)
{
l_rowbuf[l_idx] = l_buf + cinfo.output_width * cinfo.output_components * l_idx;
}
/* Check jpeg file for layer type */
switch (cinfo.output_components)
{
case 1:
l_layer_type = GIMP_GRAY_IMAGE;
break;
case 3:
l_layer_type = GIMP_RGB_IMAGE;
break;
default:
g_printerr ("XJT: cant load layer %s (type is not GRAY and not RGB)\n", filename);