Merge branch 'goi-merge'

Conflicts:
	TODO
This commit is contained in:
John Cupitt 2012-01-01 12:07:16 +00:00
commit 0ce08a2aa3
176 changed files with 1219 additions and 899 deletions

2
.gitignore vendored
View File

@ -4,6 +4,8 @@ Makefile.in
TAGS
tags
*.o
Vips-8.0.gir
Vips-8.0.typelib
.*.swp
*.lo
*.bak

View File

@ -56,4 +56,6 @@ uninstall-hook:
-chmod -R u+w ${DESTDIR}$(datadir)/doc/vips
-rm -rf ${DESTDIR}$(datadir)/doc/vips
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
ACLOCAL_AMFLAGS = -I m4
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-introspection

12
TODO
View File

@ -1,3 +1,9 @@
- revisit gio test prog and try to make a nice binding
- try:
$ vips im_affinei original.png vipsnohalo.png nohalo 4 0 0 4 1.5 1.5 0 0 1600 1200
@ -7,10 +13,10 @@
- python/* is too old, keep for reference, but we need to use the
introspection stuff to get current gobject bindings
look at that brancg again
- look at libpeas for plugin support
http://live.gnome.org/Libpeas

View File

@ -26,6 +26,7 @@ cp $ACDIR/iconv.m4 m4
cp $ACDIR/isc-posix.m4 m4
cp $ACDIR/lcmessage.m4 m4
cp $ACDIR/progtest.m4 m4
cp $ACDIR/introspection.m4 m4
gtkdocize --copy --docdir doc/reference --flavour no-tmpl || exit 1

View File

@ -1,5 +1,14 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(libvips/include/vips/colour.h)
# also update the version number in the m4 macros below
AC_INIT(vips, 7.25.0, vipsip@jiscmail.ac.uk)
# required for gobject-introspection
AC_PREREQ(2.62)
# gobject-introspection recommends this
AM_INIT_AUTOMAKE([-Wno-portability])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR(m4)
@ -10,14 +19,48 @@ m4_define([vips_micro_version], [0])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
VIPS_MAJOR_VERSION=vips_major_version
VIPS_MINOR_VERSION=vips_minor_version
VIPS_MICRO_VERSION=vips_micro_version
VIPS_MAJOR_VERSION=vips_major_version()
VIPS_MINOR_VERSION=vips_minor_version()
VIPS_MICRO_VERSION=vips_micro_version()
VIPS_VERSION=vips_version()
VIPS_VERSION_STRING=$VIPS_VERSION-`date`
VERSION=$VIPS_VERSION
PACKAGE=vips
# init introspection support
GOBJECT_INTROSPECTION_CHECK([0.6.7])
# gir needs a list of source files to scan for introspection
# build with a glob and a list of files to exclude from scanning
# see also IGNORE_HFILES in doc/reference/Makefile.am
# the only header we include is the main vips.h one, it'll pull in everything
# else in the public API
introspection_sources=`cd libvips ; find . -name "*.c"`
filter_list="deprecated im_video_v4l1.c"
introspection_sources2=
for name in $introspection_sources; do
found=0
for filter in $filter_list; do
# FIXME .. argh a bash-ism :( not sure of a nice, portable way to do
# regexp matching
if [[[ $name == *${filter}* ]]]; then
found=1
fi
done
if [[ $found -eq 0 ]]; then
introspection_sources2="$introspection_sources2 $name"
fi
done
vips_introspection_sources="$introspection_sources2"
# add headers that form the public vips8 API .. don't do a find and exclude,
# we end up excluding almost everything argh
headers="basic.h vips.h object.h image.h error.h foreign.h interpolate.h header.h operation.h enumtypes.h arithmetic.h conversion.h type.h"
for name in $headers; do
vips_introspection_sources="$vips_introspection_sources include/vips/$name"
done
AC_SUBST(vips_introspection_sources)
# libtool library versioning ... not user-visible (except as part of the
# library file name) and does not correspond to major/minor/micro above
@ -32,8 +75,6 @@ LIBRARY_CURRENT=30
LIBRARY_REVISION=5
LIBRARY_AGE=15
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
# patched into include/vips/version.h
AC_SUBST(VIPS_VERSION)
AC_SUBST(VIPS_VERSION_STRING)
@ -388,12 +429,6 @@ if test x"$with_magick" != "xno"; then
LIBS=$save_LIBS
fi
if test x"$with_magick" = x"yes"; then
AM_CONDITIONAL(HAVE_MAGICK, true)
else
AM_CONDITIONAL(HAVE_MAGICK, false)
fi
# orc
AC_ARG_WITH([orc],
AS_HELP_STRING([--without-orc], [build without orc (default: test)]))
@ -444,17 +479,11 @@ if test x"$with_OpenEXR" != "xno"; then
])
fi
if test x"$with_OpenEXR" = x"yes"; then
AM_CONDITIONAL(HAVE_OPENEXR, true)
else
AM_CONDITIONAL(HAVE_OPENEXR, false)
fi
# OpenSlide
AC_ARG_WITH([openslide],
AS_HELP_STRING([--without-openslide], [build without OpenSlide (default: test)]))
if test x"$with_openslide" != "xno"; then
if test x"$with_openslide" != x"no"; then
PKG_CHECK_MODULES(OPENSLIDE, openslide >= 3.2.0,
[AC_DEFINE(HAVE_OPENSLIDE,1,[define if you have OpenSlide >= 3.2.0 installed.])
with_openslide=yes
@ -464,12 +493,6 @@ if test x"$with_openslide" != "xno"; then
])
fi
if test x"$with_openslide" = x"yes"; then
AM_CONDITIONAL(HAVE_OPENSLIDE, true)
else
AM_CONDITIONAL(HAVE_OPENSLIDE, false)
fi
# matio
AC_ARG_WITH([matio],
AS_HELP_STRING([--without-matio], [build without matio (default: test)]))
@ -484,12 +507,6 @@ if test x"$with_matio" != "xno"; then
])
fi
if test x"$with_openslide" = x"yes"; then
AM_CONDITIONAL(HAVE_MATIO, true)
else
AM_CONDITIONAL(HAVE_MATIO, false)
fi
# cfitsio
AC_ARG_WITH([cfitsio],
AS_HELP_STRING([--without-cfitsio], [build without cfitsio (default: test)]))
@ -504,12 +521,6 @@ if test x"$with_cfitsio" != "xno"; then
])
fi
if test x"$with_cfitsio" = x"yes"; then
AM_CONDITIONAL(HAVE_CFITSIO, true)
else
AM_CONDITIONAL(HAVE_CFITSIO, false)
fi
# pangoft2
AC_ARG_WITH([pangoft2],
AS_HELP_STRING([--without-pangoft2],
@ -532,12 +543,6 @@ FIND_TIFF(
with_tiff=no
])
if test x"$with_tiff" = x"yes"; then
AM_CONDITIONAL(HAVE_TIFF, true)
else
AM_CONDITIONAL(HAVE_TIFF, false)
fi
FIND_ZIP(
[with_zip=yes],
[AC_MSG_WARN([libz not found; disabling ZIP support])
@ -560,24 +565,12 @@ if test x"$with_png" != "xno"; then
])
fi
if test x"$with_png" = x"yes"; then
AM_CONDITIONAL(HAVE_PNG, true)
else
AM_CONDITIONAL(HAVE_PNG, false)
fi
FIND_JPEG(
[with_jpeg=yes],
[AC_MSG_WARN([libjpeg not found; disabling JPEG support])
with_jpeg=no
])
if test x"$with_jpeg" = x"yes"; then
AM_CONDITIONAL(HAVE_JPEG, true)
else
AM_CONDITIONAL(HAVE_JPEG, false)
fi
# libexif
AC_ARG_WITH([libexif],
AS_HELP_STRING([--without-libexif], [build without libexif (default: test)]))
@ -733,9 +726,10 @@ native win32: $vips_os_win32
native OS X: $vips_os_darwin
open files in binary mode: $vips_binary_open
enable debug: $enable_debug
build C++ components: $enable_cxx
evaluate with threads: $enable_threads
build docs with gtkdoc $enable_gtk_doc
build C++ components: $enable_cxx
build docs with gtkdoc: $enable_gtk_doc
gobject introspection: $found_introspection
* optional packages and modules
use fftw3 for FFT: $with_fftw3

View File

@ -72,3 +72,41 @@ libvips_la_LDFLAGS = \
EXTRA_DIST = \
$(C_DIST_DIR)
CLEANFILES =
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
# we can't get the _SOURCES lists from the subdirs directly, we get passed it
# by configure instead
introspection_sources = @vips_introspection_sources@
# we make the vips8 API
Vips-8.0.gir: libvips.la
Vips_8_0_gir_INCLUDES = GObject-2.0
Vips_8_0_gir_CFLAGS = $(INCLUDES) -I${top_srcdir}/libvips/include
Vips_8_0_gir_LIBS = libvips.la
Vips_8_0_gir_FILES = $(introspection_sources)
Vips_8_0_gir_SCANNERFLAGS = \
--warn-all \
--verbose \
--namespace=Vips \
--identifier-prefix=Vips \
--identifier-prefix=vips \
--symbol-prefix=vips \
--symbol-prefix=im \
--symbol-prefix=im_
INTROSPECTION_GIRS += Vips-8.0.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif

View File

@ -164,7 +164,8 @@ vips_abs_build( VipsObject *object )
#endif /*HAVE_HYPOT*/
static void
vips_abs_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_abs_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsUnary *unary = VIPS_UNARY( arithmetic );
const int bands = vips_image_get_bands( unary->in );

View File

@ -96,7 +96,7 @@ G_DEFINE_TYPE( VipsAdd, vips_add, VIPS_TYPE_BINARY );
}
static void
add_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
add_buffer( VipsArithmetic *arithmetic, VipsPel *out, VipsPel **in, int width )
{
VipsArithmeticClass *class = VIPS_ARITHMETIC_GET_CLASS( arithmetic );
VipsImage *im = arithmetic->ready[0];

View File

@ -270,7 +270,7 @@ vips_arithmetic_gen( VipsRegion *or,
VipsArithmeticClass *class = VIPS_ARITHMETIC_GET_CLASS( arithmetic );
Rect *r = &or->valid;
PEL *p[MAX_INPUT_IMAGES], *q;
VipsPel *p[MAX_INPUT_IMAGES], *q;
int i, y;
/* Prepare all input regions and make buffer pointers.
@ -278,10 +278,10 @@ vips_arithmetic_gen( VipsRegion *or,
for( i = 0; ir[i]; i++ ) {
if( vips_region_prepare( ir[i], r ) )
return( -1 );
p[i] = (PEL *) VIPS_REGION_ADDR( ir[i], r->left, r->top );
p[i] = (VipsPel *) VIPS_REGION_ADDR( ir[i], r->left, r->top );
}
p[i] = NULL;
q = (PEL *) VIPS_REGION_ADDR( or, r->left, r->top );
q = (VipsPel *) VIPS_REGION_ADDR( or, r->left, r->top );
for( y = 0; y < r->height; y++ ) {
class->process_line( arithmetic, q, p, r->width );

View File

@ -38,6 +38,7 @@
extern "C" {
#endif /*__cplusplus*/
#include <vips/vips.h>
#include <vips/vector.h>
#define VIPS_TYPE_ARITHMETIC (vips_arithmetic_get_type())
@ -57,7 +58,7 @@ extern "C" {
struct _VipsArithmetic;
typedef void (*VipsArithmeticProcessFn)( struct _VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width );
VipsPel *out, VipsPel **in, int width );
typedef struct _VipsArithmetic {
VipsOperation parent_instance;

View File

@ -30,6 +30,10 @@
#ifndef VIPS_BINARY_H
#define VIPS_BINARY_H
#include <vips/vips.h>
#include "arithmetic.h"
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/

View File

@ -140,7 +140,7 @@ vips_boolean_build( VipsObject *object )
static void
vips_boolean_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsBoolean *boolean = (VipsBoolean *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -462,7 +462,7 @@ vips_boolean_const_build( VipsObject *object )
static void
vips_boolean_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsBooleanConst *bconst = (VipsBooleanConst *) arithmetic;

View File

@ -163,7 +163,8 @@ G_DEFINE_TYPE( VipsComplex, vips_complex, VIPS_TYPE_UNARY );
}
static void
vips_complex_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_complex_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsComplex *cmplx = (VipsComplex *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -418,7 +419,7 @@ vips_complexget_build( VipsObject *object )
static void
vips_complexget_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsComplexget *complexget = (VipsComplexget *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -608,7 +609,7 @@ vips_complexform_build( VipsObject *object )
static void
vips_complexform_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );

View File

@ -152,7 +152,7 @@ G_DEFINE_TYPE( VipsDivide, vips_divide, VIPS_TYPE_BINARY );
static void
vips_divide_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );

View File

@ -186,7 +186,7 @@ maxposavg_scan( REGION *reg, void *seq, void *a, void *b, gboolean *stop )
occurences = maxposavg->occurences;
for( y = 0; y < r->height; y++ ) {
PEL *in = (PEL *) IM_REGION_ADDR( reg, r->left, r->top + y );
VipsPel *in = VIPS_REGION_ADDR( reg, r->left, r->top + y );
switch( reg->im->BandFmt ) {
case IM_BANDFMT_UCHAR: LOOP( unsigned char ); break;

View File

@ -82,7 +82,8 @@ G_DEFINE_TYPE( VipsInvert, vips_invert, VIPS_TYPE_UNARY );
}
static void
vips_invert_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_invert_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];

View File

@ -187,7 +187,8 @@ vips_linear_build( VipsObject *object )
/* Lintra a buffer, n set of scale/offset.
*/
static void
vips_linear_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_linear_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
VipsLinear *linear = (VipsLinear *) arithmetic;

View File

@ -139,7 +139,8 @@ vips_math_build( VipsObject *object )
#define EXP10( X ) (pow( 10.0, (X) ))
static void
vips_math_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_math_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsMath *math = (VipsMath *) arithmetic;
VipsImage *im = arithmetic->ready[0];

View File

@ -145,7 +145,7 @@ vips_math2_build( VipsObject *object )
static void
vips_math2_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsMath2 *math2 = (VipsMath2 *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -361,7 +361,7 @@ vips_math2_const_build( VipsObject *object )
static void
vips_math2_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsMath2Const *math2 = (VipsMath2Const *) arithmetic;

View File

@ -324,9 +324,12 @@ vips_max_init( VipsMax *max )
* vips_max:
* @in: input #VipsImage
* @out: output pixel maximum
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @x: horizontal position of maximum
* @y: vertical position of maximum
* @...: %NULL-terminated list of optional named arguments
*
* This operation finds the maximum value in an image.
*

View File

@ -259,11 +259,14 @@ vips_measure_init( VipsMeasure *measure )
* @out: array of measurements
* @h: patches across chart
* @v: patches down chart
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @left: area of image containing chart
* @top: area of image containing chart
* @width: area of image containing chart
* @height: area of image containing chart
* @...: %NULL-terminated list of optional named arguments
*
* Analyse a grid of colour patches, producing an array of patch averages.
* The mask has a row for each measured patch and a column for each image

View File

@ -325,9 +325,12 @@ vips_min_init( VipsMin *min )
* vips_min:
* @in: input #VipsImage
* @out: output pixel maximum
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @x: horizontal position of minimum
* @y: vertical position of minimum
* @...: %NULL-terminated list of optional named arguments
*
* This operation finds the minimum value in an image.
*

View File

@ -113,7 +113,7 @@ G_DEFINE_TYPE( VipsMultiply, vips_multiply, VIPS_TYPE_BINARY );
static void
vips_multiply_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );
@ -183,11 +183,11 @@ vips_multiply_init( VipsMultiply *multiply )
/**
* vips_multiply:
* @in1: input #VipsImage 1
* @in2: input #VipsImage 2
* @out: output #VipsImage
* @left: left-hand image
* @right: right-hand image
* @out: output image
*
* This operation calculates @in1 * @in2 and writes the result to @out.
* This operation calculates @left * @right and writes the result to @out.
*
* If the images differ in size, the smaller image is enlarged to match the
* larger by adding zero pixels along the bottom and right.

View File

@ -109,7 +109,7 @@ vips_relational_build( VipsObject *object )
#define RLOOP( TYPE, ROP ) { \
TYPE *left = (TYPE *) in[0]; \
TYPE *right = (TYPE *) in[1]; \
PEL *q = (PEL *) out; \
VipsPel *q = (VipsPel *) out; \
\
for( x = 0; x < sz; x++ ) \
q[x] = (left[x] ROP right[x]) ? 255 : 0; \
@ -118,7 +118,7 @@ vips_relational_build( VipsObject *object )
#define CLOOP( TYPE, COP ) { \
TYPE *left = (TYPE *) in[0]; \
TYPE *right = (TYPE *) in[1]; \
PEL *q = (PEL *) out; \
VipsPel *q = (VipsPel *) out; \
\
for( x = 0; x < sz; x++ ) { \
q[x] = COP( left[0], left[1], right[0], right[1]) ? 255 : 0; \
@ -154,7 +154,7 @@ vips_relational_build( VipsObject *object )
static void
vips_relational_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsRelational *relational = (VipsRelational *) arithmetic;
VipsImage *im = arithmetic->ready[0];
@ -496,7 +496,7 @@ vips_relational_const_build( VipsObject *object )
static void
vips_relational_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsRelationalConst *rconst = (VipsRelationalConst *) arithmetic;

View File

@ -121,7 +121,7 @@ vips_remainder_build( VipsObject *object )
static void
vips_remainder_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];
const int sz = width * vips_image_get_bands( im );
@ -289,7 +289,7 @@ vips_remainder_const_build( VipsObject *object )
static void
vips_remainder_const_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsUnaryConst *uconst = (VipsUnaryConst *) arithmetic;
VipsImage *im = arithmetic->ready[0];

View File

@ -105,7 +105,8 @@ vips_round_build( VipsObject *object )
}
static void
vips_round_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_round_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsRound *round = (VipsRound *) arithmetic;
VipsImage *im = arithmetic->ready[0];

View File

@ -99,7 +99,8 @@ G_DEFINE_TYPE( VipsSign, vips_sign, VIPS_TYPE_UNARY );
}
static void
vips_sign_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
vips_sign_buffer( VipsArithmetic *arithmetic,
VipsPel *out, VipsPel **in, int width )
{
VipsUnary *unary = VIPS_UNARY( arithmetic );
const int bands = vips_image_get_bands( unary->in );

View File

@ -74,12 +74,12 @@ vips_statistic_scan( VipsRegion *region,
int lsk = IM_REGION_LSKIP( region );
int y;
PEL *p;
VipsPel *p;
VIPS_DEBUG_MSG( "vips_statistic_scan: %d x %d @ %d x %d\n",
r->width, r->height, r->left, r->top );
p = (PEL *) IM_REGION_ADDR( region, r->left, r->top );
p = VIPS_REGION_ADDR( region, r->left, r->top );
for( y = 0; y < r->height; y++ ) {
if( class->scan( statistic,
seq, r->left, r->top + y, p, r->width ) )

View File

@ -92,7 +92,7 @@ G_DEFINE_TYPE( VipsSubtract, vips_subtract, VIPS_TYPE_BINARY );
static void
vips_subtract_buffer( VipsArithmetic *arithmetic,
PEL *out, PEL **in, int width )
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = arithmetic->ready[0];

View File

@ -84,14 +84,14 @@ G_DEFINE_ABSTRACT_TYPE( VipsUnaryConst, vips_unary_const, VIPS_TYPE_UNARY );
/* Cast a n-band vector of double to a m-band vector in another format.
*/
static PEL *
static VipsPel *
make_pixel( VipsObject *obj, int m, VipsBandFmt fmt, int n, double *p )
{
PEL *q;
VipsPel *q;
int i;
if( !(q = VIPS_ARRAY( obj,
m * vips__image_sizeof_bandformat[fmt], PEL )) )
m * vips__image_sizeof_bandformat[fmt], VipsPel )) )
return( NULL );
switch( fmt ) {

View File

@ -67,7 +67,7 @@ typedef struct _VipsUnaryConst {
* const_format in type.
*/
int n;
PEL *c_ready;
VipsPel *c_ready;
} VipsUnaryConst;

View File

@ -55,13 +55,13 @@
/* imb_LabQ2Lab: CONVERT n pels from packed 32bit Lab to float values
* in a buffer
* ARGS: PEL *inp pointer to first byte of Lab32 buffer
* ARGS: VipsPel *inp pointer to first byte of Lab32 buffer
* float *outbuf destination buffer
* int n number of pels to process
* (C) K.Martinez 2/5/93
*/
void
imb_LabQ2Lab( PEL *inp, float *outbuf, int n )
imb_LabQ2Lab( VipsPel *inp, float *outbuf, int n )
{
signed char *b; /* to read input bytes */
int l;

View File

@ -51,9 +51,9 @@
*/
typedef struct {
struct im_col_display *disp;
PEL red[ 64 * 64 * 64 ];
PEL green[ 64 * 64 * 64 ];
PEL blue[ 64 * 64 * 64 ];
VipsPel red[ 64 * 64 * 64 ];
VipsPel green[ 64 * 64 * 64 ];
VipsPel blue[ 64 * 64 * 64 ];
} CalibrateInfo;
/* Do our own indexing of the arrays, to make sure we get efficient mults.
@ -63,7 +63,7 @@ typedef struct {
/* Process a buffer of data.
*/
static void
imb_LabQ2disp( PEL *p, PEL *q, int n, CalibrateInfo *cal )
imb_LabQ2disp( VipsPel *p, VipsPel *q, int n, CalibrateInfo *cal )
{
int x, t;

View File

@ -65,7 +65,7 @@
/* Process a buffer of data.
*/
void
imb_XYZ2disp( float *p, PEL *q, int n, struct im_col_display *d )
imb_XYZ2disp( float *p, VipsPel *q, int n, struct im_col_display *d )
{
struct im_col_tab_disp *table = im_col_display_get_table( d );
float rstep = (d->d_YCR - d->d_Y0R) / 1500.0;

View File

@ -41,7 +41,7 @@
#include <vips/vips.h>
static void
argb2rgba( guint32 *in, PEL *out, int n, void *_bg )
argb2rgba( guint32 *in, VipsPel *out, int n, void *_bg )
{
guint32 bg = GPOINTER_TO_UINT( _bg );

View File

@ -55,7 +55,7 @@
/* Convert a buffer.
*/
void
imb_disp2XYZ( PEL *p, float *q, int n, struct im_col_display *d )
imb_disp2XYZ( VipsPel *p, float *q, int n, struct im_col_display *d )
{
int x;

View File

@ -299,7 +299,7 @@ decode_lab( WORD *fixed, float *lab, int n )
}
static void
transform_buf( PEL *in, PEL *out, int n, Icc *icc )
transform_buf( VipsPel *in, VipsPel *out, int n, Icc *icc )
{
g_mutex_lock( icc->lock );
cmsDoTransform( icc->trans, in, out, n );
@ -462,7 +462,7 @@ im_icc_transform( IMAGE *in, IMAGE *out,
}
static void
import_buf( PEL *in, float *out, int n, Icc *icc )
import_buf( VipsPel *in, float *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we write to.
*/
@ -644,7 +644,7 @@ im_icc_import_embedded( IMAGE *in, IMAGE *out, VipsIntent intent )
}
static void
export_buf( float *in, PEL *out, int n, Icc *icc )
export_buf( float *in, VipsPel *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we transform.
*/
@ -1103,7 +1103,7 @@ decode_lab( guint16 *fixed, float *lab, int n )
}
static void
transform_buf( PEL *in, PEL *out, int n, Icc *icc )
transform_buf( VipsPel *in, VipsPel *out, int n, Icc *icc )
{
g_mutex_lock( icc->lock );
cmsDoTransform( icc->trans, in, out, n );
@ -1273,7 +1273,7 @@ im_icc_transform( IMAGE *in, IMAGE *out,
}
static void
import_buf( PEL *in, float *out, int n, Icc *icc )
import_buf( VipsPel *in, float *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we write to.
*/
@ -1437,7 +1437,7 @@ im_icc_import_embedded( IMAGE *in, IMAGE *out, VipsIntent intent )
}
static void
export_buf( float *in, PEL *out, int n, Icc *icc )
export_buf( float *in, VipsPel *out, int n, Icc *icc )
{
/* Buffer of encoded 16-bit pixels we transform.
*/

View File

@ -88,16 +88,16 @@ vips_bandary_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
VipsBandaryClass *class = VIPS_BANDARY_GET_CLASS( bandary );
Rect *r = &or->valid;
PEL *p[MAX_INPUT_IMAGES], *q;
VipsPel *p[MAX_INPUT_IMAGES], *q;
int y, i;
for( i = 0; i < bandary->n; i++ ) {
if( vips_region_prepare( ir[i], r ) )
return( -1 );
p[i] = (PEL *) VIPS_REGION_ADDR( ir[i], r->left, r->top );
p[i] = VIPS_REGION_ADDR( ir[i], r->left, r->top );
}
p[i] = NULL;
q = (PEL *) VIPS_REGION_ADDR( or, r->left, r->top );
q = VIPS_REGION_ADDR( or, r->left, r->top );
for( y = 0; y < r->height; y++ ) {
class->process_line( bandary, q, p, r->width );

View File

@ -53,7 +53,7 @@ extern "C" {
struct _VipsBandary;
typedef void (*VipsBandaryProcessFn)( struct _VipsBandary *bandary,
PEL *out, PEL **in, int width );
VipsPel *out, VipsPel **in, int width );
typedef struct _VipsBandary {
VipsConversion parent_instance;

View File

@ -85,7 +85,7 @@ typedef VipsBandaryClass VipsBandjoinClass;
G_DEFINE_TYPE( VipsBandjoin, vips_bandjoin, VIPS_TYPE_BANDARY );
static void
vips_bandjoin_buffer( VipsBandary *bandary, PEL *q, PEL **p, int width )
vips_bandjoin_buffer( VipsBandary *bandary, VipsPel *q, VipsPel **p, int width )
{
VipsConversion *conversion = (VipsConversion *) bandary;
VipsImage **in = bandary->ready;
@ -104,7 +104,7 @@ vips_bandjoin_buffer( VipsBandary *bandary, PEL *q, PEL **p, int width )
*/
int ips = VIPS_IMAGE_SIZEOF_PEL( in[i] );
PEL *p1, *q1;
VipsPel *p1, *q1;
int x, z;
q1 = q;

View File

@ -119,7 +119,8 @@ G_DEFINE_TYPE( VipsBandmean, vips_bandmean, VIPS_TYPE_BANDARY );
}
static void
vips_bandmean_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
vips_bandmean_buffer( VipsBandary *bandary,
VipsPel *out, VipsPel **in, int width )
{
VipsImage *im = bandary->ready[0];
const int bands = im->Bands;

View File

@ -157,9 +157,12 @@ vips_black_init( VipsBlack *black )
* @out: output image
* @width: output width
* @height: output height
* @bands: output bands
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @bands: output bands
*
* Make a black unsigned char image of a specified size.
*
* See also: im_make_xy(), im_text(), im_gaussnoise().

View File

@ -335,8 +335,8 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b,
return( -1 );
for( y = to; y < bo; y++ ) {
PEL *in = (PEL *) VIPS_REGION_ADDR( ir, le, y );
PEL *out = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *in = VIPS_REGION_ADDR( ir, le, y );
VipsPel *out = VIPS_REGION_ADDR( or, le, y );
switch( cast->in->BandFmt ) {
case VIPS_FORMAT_UCHAR:

View File

@ -127,7 +127,7 @@ G_DEFINE_TYPE( VipsCopy, vips_copy, VIPS_TYPE_CONVERSION );
/* Swap pairs of bytes.
*/
static void
vips_copy_swap2( PEL *in, PEL *out, int width, VipsImage *im )
vips_copy_swap2( VipsPel *in, VipsPel *out, int width, VipsImage *im )
{
guint16 *p = (guint16 *) in;
guint16 *q = (guint16 *) out;
@ -142,7 +142,7 @@ vips_copy_swap2( PEL *in, PEL *out, int width, VipsImage *im )
/* Swap 4- of bytes.
*/
static void
vips_copy_swap4( PEL *in, PEL *out, int width, VipsImage *im )
vips_copy_swap4( VipsPel *in, VipsPel *out, int width, VipsImage *im )
{
guint32 *p = (guint32 *) in;
guint32 *q = (guint32 *) out;
@ -157,7 +157,7 @@ vips_copy_swap4( PEL *in, PEL *out, int width, VipsImage *im )
/* Swap 8- of bytes.
*/
static void
vips_copy_swap8( PEL *in, PEL *out, int width, VipsImage *im )
vips_copy_swap8( VipsPel *in, VipsPel *out, int width, VipsImage *im )
{
guint64 *p = (guint64 *) in;
guint64 *q = (guint64 *) out;
@ -169,7 +169,7 @@ vips_copy_swap8( PEL *in, PEL *out, int width, VipsImage *im )
q[x] = GUINT64_SWAP_LE_BE( p[x] );
}
typedef void (*SwapFn)( PEL *in, PEL *out, int width, VipsImage *im );
typedef void (*SwapFn)( VipsPel *in, VipsPel *out, int width, VipsImage *im );
static SwapFn vips_copy_swap_fn[] = {
NULL, /* VIPS_FORMAT_UCHAR = 0, */
@ -203,9 +203,9 @@ vips_copy_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
int y;
for( y = 0; y < r->height; y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
r->left, r->top + y );
PEL *q = (PEL *) VIPS_REGION_ADDR( or,
VipsPel *q = VIPS_REGION_ADDR( or,
r->left, r->top + y );
swap( p, q, r->width, copy->in );
@ -401,6 +401,10 @@ vips_copy_init( VipsCopy *copy )
* vips_copy:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @width: set image width
* @height: set image height
* @bands: set image bands
@ -412,7 +416,6 @@ vips_copy_init( VipsCopy *copy )
* @xoffset: set image xoffset
* @yoffset: set image yoffset
* @swap: swap byte order
* @...: %NULL-terminated list of optional named arguments
*
* Copy an image, optionally modifying the header. VIPS copies images by
* copying pointers, so this operation is instant, even for very large images.

View File

@ -143,7 +143,7 @@ vips_embed_find_edge( VipsEmbed *embed, VipsRect *r, int i, VipsRect *out )
/* Copy a single pixel sideways into a line of pixels.
*/
static void
vips_embed_copy_pixel( VipsEmbed *embed, PEL *q, PEL *p, int n )
vips_embed_copy_pixel( VipsEmbed *embed, VipsPel *q, VipsPel *p, int n )
{
const int bs = VIPS_IMAGE_SIZEOF_PEL( embed->in );
@ -160,12 +160,12 @@ vips_embed_copy_pixel( VipsEmbed *embed, PEL *q, PEL *p, int n )
*/
static void
vips_embed_paint_edge( VipsEmbed *embed,
VipsRegion *or, int i, VipsRect *r, PEL *p, int plsk )
VipsRegion *or, int i, VipsRect *r, VipsPel *p, int plsk )
{
const int bs = VIPS_IMAGE_SIZEOF_PEL( embed->in );
VipsRect todo;
PEL *q;
VipsPel *q;
int y;
/* Pixels left to paint.
@ -176,7 +176,7 @@ vips_embed_paint_edge( VipsEmbed *embed,
* todo, then use the line copier below to paint the rest of it.
*/
if( i > 3 ) {
q = (PEL *) VIPS_REGION_ADDR( or, todo.left, todo.top );
q = VIPS_REGION_ADDR( or, todo.left, todo.top );
vips_embed_copy_pixel( embed, q, p, todo.width );
p = q;
@ -188,8 +188,7 @@ vips_embed_paint_edge( VipsEmbed *embed,
/* Vertical line of pixels to copy.
*/
for( y = 0; y < todo.height; y++ ) {
q = (PEL *) VIPS_REGION_ADDR( or,
todo.left, todo.top + y );
q = VIPS_REGION_ADDR( or, todo.left, todo.top + y );
vips_embed_copy_pixel( embed, q, p, todo.width );
p += plsk;
}
@ -198,8 +197,7 @@ vips_embed_paint_edge( VipsEmbed *embed,
/* Horizontal line of pixels to copy.
*/
for( y = 0; y < todo.height; y++ ) {
q = (PEL *) VIPS_REGION_ADDR( or,
todo.left, todo.top + y );
q = VIPS_REGION_ADDR( or, todo.left, todo.top + y );
memcpy( q, p, bs * todo.width );
}
}
@ -214,7 +212,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
Rect ovl;
int i;
PEL *p;
VipsPel *p;
int plsk;
/* Entirely within the input image? Generate the subimage and copy
@ -275,7 +273,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
* that.
*/
if( !vips_rect_isempty( &ovl ) ) {
p = (PEL *) VIPS_REGION_ADDR( or,
p = VIPS_REGION_ADDR( or,
edge.left, edge.top );
plsk = VIPS_REGION_LSKIP( or );
}
@ -287,7 +285,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
edge.top -= embed->y;
if( vips_region_prepare( ir, &edge ) )
return( -1 );
p = (PEL *) VIPS_REGION_ADDR( ir,
p = VIPS_REGION_ADDR( ir,
edge.left, edge.top );
plsk = VIPS_REGION_LSKIP( ir );
}
@ -567,13 +565,16 @@ vips_embed_init( VipsEmbed *embed )
* vips_embed:
* @in: input image
* @out: output image
* @width: @out should be this many pixels across
* @height: @out should be this many pixels down
* @x: place @in at this x position in @out
* @y: place @in at this y position in @out
* @extend: how to generate the edge pixels
* @width: @out should be this many pixels across
* @height: @out should be this many pixels down
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @extend: how to generate the edge pixels
*
* The opposite of vips_extract_area(): embed @in within an image of size
* @width by @height at position @x, @y. @extend
* controls what appears in the new pels, see #VipsExtend.

View File

@ -278,7 +278,8 @@ typedef VipsBandaryClass VipsExtractBandClass;
G_DEFINE_TYPE( VipsExtractBand, vips_extract_band, VIPS_TYPE_BANDARY );
static void
vips_extract_band_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
vips_extract_band_buffer( VipsBandary *bandary,
VipsPel *out, VipsPel **in, int width )
{
VipsConversion *conversion = (VipsConversion *) bandary;
VipsExtractBand *extract = (VipsExtractBand *) bandary;
@ -287,7 +288,7 @@ vips_extract_band_buffer( VipsBandary *bandary, PEL *out, PEL **in, int width )
int ips = VIPS_IMAGE_SIZEOF_PEL( im );
const int ops = VIPS_IMAGE_SIZEOF_PEL( conversion->out );
PEL *p, *q;
VipsPel *p, *q;
int x, z;
p = in[0] + extract->band * es;
@ -381,9 +382,12 @@ vips_extract_band_init( VipsExtractBand *extract )
* @in: input image
* @out: output image
* @band: band to extract
* @n: number of bands to extract
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @n: number of bands to extract
*
* Extract a band or bands from an image. Extracting out of range is an error.
*
* See also: vips_extract_area().

View File

@ -88,7 +88,7 @@ vips_flip_vertical_gen( VipsRegion *or, void *seq, void *a, void *b,
VipsRegion *ir = (VipsRegion *) seq;
VipsRect *r = &or->valid;
VipsRect in;
PEL *p, *q;
VipsPel *p, *q;
int y;
int le = r->left;
@ -110,8 +110,8 @@ vips_flip_vertical_gen( VipsRegion *or, void *seq, void *a, void *b,
/* Loop, copying and reversing lines.
*/
p = (PEL *) VIPS_REGION_ADDR( ir, le, in.top + in.height - 1 );
q = (PEL *) VIPS_REGION_ADDR( or, le, to );
p = VIPS_REGION_ADDR( ir, le, in.top + in.height - 1 );
q = VIPS_REGION_ADDR( or, le, to );
psk = VIPS_REGION_LSKIP( ir );
qsk = VIPS_REGION_LSKIP( or );
ls = VIPS_REGION_SIZEOF_LINE( or );
@ -133,7 +133,7 @@ vips_flip_horizontal_gen( VipsRegion *or, void *seq, void *a, void *b,
VipsRegion *ir = (VipsRegion *) seq;
VipsRect *r = &or->valid;
VipsRect in;
PEL *p, *q;
VipsPel *p, *q;
int x, y, z;
int le = r->left;

View File

@ -172,7 +172,8 @@ G_DEFINE_TYPE( VipsIfthenelse, vips_ifthenelse, VIPS_TYPE_CONVERSION );
/* Blend with a 1-band conditional image.
*/
static void
vips_blend1_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width,
vips_blend1_buffer( VipsPel *qp,
VipsPel *c, VipsPel *ap, VipsPel *bp, int width,
VipsImage *im )
{
int i, x, z;
@ -199,7 +200,8 @@ vips_blend1_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width,
/* Blend with a many band conditional image.
*/
static void
vips_blendn_buffer( PEL *qp, PEL *c, PEL *ap, PEL *bp, int width,
vips_blendn_buffer( VipsPel *qp,
VipsPel *c, VipsPel *ap, VipsPel *bp, int width,
VipsImage *im )
{
int x, z;
@ -261,10 +263,10 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2,
/* Is the conditional all zero or all non-zero? We can avoid asking
* for one of the inputs to be calculated.
*/
all0 = *((PEL *) VIPS_REGION_ADDR( ir[2], le, to )) == 0;
alln0 = *((PEL *) VIPS_REGION_ADDR( ir[2], le, to )) != 0;
all0 = *VIPS_REGION_ADDR( ir[2], le, to ) == 0;
alln0 = *VIPS_REGION_ADDR( ir[2], le, to ) != 0;
for( y = to; y < bo; y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( ir[2], le, y );
VipsPel *p = VIPS_REGION_ADDR( ir[2], le, y );
for( x = 0; x < width; x++ ) {
all0 &= p[x] == 0;
@ -298,10 +300,10 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2,
return( -1 );
for( y = to; y < bo; y++ ) {
PEL *ap = (PEL *) VIPS_REGION_ADDR( ir[0], le, y );
PEL *bp = (PEL *) VIPS_REGION_ADDR( ir[1], le, y );
PEL *cp = (PEL *) VIPS_REGION_ADDR( ir[2], le, y );
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *ap = VIPS_REGION_ADDR( ir[0], le, y );
VipsPel *bp = VIPS_REGION_ADDR( ir[1], le, y );
VipsPel *cp = VIPS_REGION_ADDR( ir[2], le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
if( ifthenelse->blend ) {
if( c->Bands == 1 )

View File

@ -341,7 +341,7 @@ im_falsecolour( IMAGE *in, IMAGE *out )
return( -1 );
in = t[1];
if( !(lut = im_image( (PEL *) PET_colour,
if( !(lut = im_image( (VipsPel *) PET_colour,
1, 256, 3, IM_BANDFMT_UCHAR )) )
return( -1 );
if( im_maplut( in, out, lut ) ) {

View File

@ -85,8 +85,8 @@ line_shrink_gen( REGION *or, void *seq, void *a, void *b )
/* Loop down the region.
*/
for( y = to; y < bo; y++ ) {
PEL *q = IM_REGION_ADDR( or, le, y );
PEL *p;
VipsPel *q = IM_REGION_ADDR( or, le, y );
VipsPel *p;
/* Loop across the region, in owidth sized pieces.
*/
@ -149,8 +149,8 @@ point_shrink_gen( REGION *or, void *seq, void *a, void *b )
/* Loop down the region.
*/
for( y = to; y < bo; y++ ) {
PEL *q = IM_REGION_ADDR( or, le, y );
PEL *p;
VipsPel *q = IM_REGION_ADDR( or, le, y );
VipsPel *p;
/* Loop across the region, in owidth sized pieces.
*/

View File

@ -126,7 +126,7 @@ system_image( IMAGE *im,
*
* See also: im_system().
*
* Returns: an image on success, NULL on error
* Returns: (transfer full): an image on success, NULL on error
*/
IMAGE *
im_system_image( IMAGE *im,

View File

@ -94,7 +94,7 @@ text_ft_to_vips( FT_Bitmap *bitmap, IMAGE *out )
for( y = 0; y < bitmap->rows; y++ )
if( im_writeline( y, out,
(PEL *) bitmap->buffer + y * bitmap->pitch ) )
(VipsPel *) bitmap->buffer + y * bitmap->pitch ) )
return( -1 );
return( 0 );

View File

@ -122,9 +122,9 @@ paint_whole( REGION *or, REGION *ir, ZoomInfo *zm,
/* Loop over input, as we know we are all whole.
*/
for( y = itop; y < ibottom; y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( ir, ileft, y );
PEL *q = (PEL *) IM_REGION_ADDR( or, left, y * zm->yfac );
PEL *r;
VipsPel *p = IM_REGION_ADDR( ir, ileft, y );
VipsPel *q = IM_REGION_ADDR( or, left, y * zm->yfac );
VipsPel *r;
/* Expand the first line of pels.
*/
@ -184,9 +184,9 @@ paint_part( REGION *or, REGION *ir, const ZoomInfo *zm,
/* Have to loop over output.
*/
for( y = top; y < bottom; ) {
PEL *p = (PEL *) IM_REGION_ADDR( ir, ix, y / zm->yfac );
PEL *q = (PEL *) IM_REGION_ADDR( or, left, y );
PEL *r;
VipsPel *p = IM_REGION_ADDR( ir, ix, y / zm->yfac );
VipsPel *q = IM_REGION_ADDR( or, left, y );
VipsPel *r;
/* Output pels until we jump the input pointer.
*/

View File

@ -89,7 +89,7 @@ typedef struct _VipsInsert {
/* Pixel we paint calculated from background.
*/
PEL *ink;
VipsPel *ink;
/* Inputs cast and banded up.
*/
@ -209,7 +209,7 @@ vips_insert_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
/* Calculate a pixel for an image from a vec of double. Valid while im is
* valid.
*/
PEL *
VipsPel *
vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n )
{
VipsImage **t;
@ -237,14 +237,14 @@ vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n )
#ifdef VIPS_DEBUG
{
PEL *p = (PEL *) (t[3]->data);
VipsPel *p = (VipsPel *) (t[3]->data);
printf( "vips__vector_to_ink: ink = %p (%d %d %d)\n",
p, p[0], p[1], p[2] );
}
#endif /*VIPS_DEBUG*/
return( (PEL *) t[3]->data );
return( (VipsPel *) t[3]->data );
}
static int
@ -407,9 +407,12 @@ vips_insert_init( VipsInsert *insert )
* @out: output image
* @x: left position of @sub
* @y: top position of @sub
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @expand: expand output to hold whole of both images
* @background: colour for new pixels
* @...: %NULL-terminated list of optional named arguments
*
* Insert one image into another. @sub is inserted into image @main at
* position @x, @y relative to the top LH corner of @main.

View File

@ -274,11 +274,14 @@ vips_join_init( VipsJoin *join )
* @in2: second input image
* @out: output image
* @direction: join horizontally or vertically
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @expand: %TRUE to expand the output image to hold all of the input pixels
* @shim: space between images, in pixels
* @background: background ink colour
* @align: low, centre or high alignment
* @...: %NULL-terminated list of optional named arguments
*
* Join @in1 and @in2 together, left-right or up-down depending on the value
* of @direction.

View File

@ -113,9 +113,9 @@ vips_recomb_gen( VipsRegion *or,
return( -1 );
for( y = 0; y < or->valid.height; y++ ) {
PEL *in = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *in = VIPS_REGION_ADDR( ir,
or->valid.left, or->valid.top + y );
PEL *out = (PEL *) VIPS_REGION_ADDR( or,
VipsPel *out = VIPS_REGION_ADDR( or,
or->valid.left, or->valid.top + y );
switch( vips_image_get_format( im ) ) {

View File

@ -132,11 +132,11 @@ vips_rot90_gen( VipsRegion *or, void *seq, void *a, void *b,
for( y = to; y < bo; y++ ) {
/* Start of this output line.
*/
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
/* Corresponding position in ir.
*/
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
need.left + y - to,
need.top + need.height - 1 );
@ -193,11 +193,11 @@ vips_rot180_gen( VipsRegion *or, void *seq, void *a, void *b,
for( y = to; y < bo; y++ ) {
/* Start of this output line.
*/
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
/* Corresponding position in ir.
*/
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
need.left + need.width - 1,
need.top + need.height - (y - to) - 1 );
@ -255,11 +255,11 @@ vips_rot270_gen( VipsRegion *or, void *seq, void *a, void *b,
for( y = to; y < bo; y++ ) {
/* Start of this output line.
*/
PEL *q = (PEL *) VIPS_REGION_ADDR( or, le, y );
VipsPel *q = VIPS_REGION_ADDR( or, le, y );
/* Corresponding position in ir.
*/
PEL *p = (PEL *) VIPS_REGION_ADDR( ir,
VipsPel *p = VIPS_REGION_ADDR( ir,
need.left + need.width - (y - to) - 1,
need.top );

View File

@ -292,8 +292,8 @@ copy_region( VipsRegion *from, VipsRegion *to, VipsRect *area )
/* Loop down common area, copying.
*/
for( y = area->top; y < VIPS_RECT_BOTTOM( area ); y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( from, area->left, y );
PEL *q = (PEL *) VIPS_REGION_ADDR( to, area->left, y );
VipsPel *p = VIPS_REGION_ADDR( from, area->left, y );
VipsPel *q = VIPS_REGION_ADDR( to, area->left, y );
memcpy( q, p, VIPS_IMAGE_SIZEOF_PEL( from->im ) * area->width );
}
@ -438,10 +438,13 @@ vips_tile_cache_init( VipsTileCache *cache )
* vips_tilecache:
* @in: input image
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @tile_width: width of tiles in cache
* @tile_height: height of tiles in cache
* @max_tiles: maximum number of tiles to cache
* @...: %NULL-terminated list of optional named arguments
*
* This operation behaves rather like vips_copy() between images
* @in and @out, except that it keeps a cache of computed pixels.

View File

@ -540,7 +540,7 @@ typedef struct {
REGION *ir; /* Input region */
int *offsets; /* Offsets for each non-zero matrix element */
PEL **pts; /* Per-non-zero mask element pointers */
VipsPel **pts; /* Per-non-zero mask element pointers */
int underflow; /* Underflow/overflow counts */
int overflow;
@ -602,7 +602,7 @@ conv_start( IMAGE *out, void *a, void *b )
*/
seq->ir = im_region_create( in );
seq->offsets = IM_ARRAY( out, conv->nnz, int );
seq->pts = IM_ARRAY( out, conv->nnz, PEL * );
seq->pts = IM_ARRAY( out, conv->nnz, VipsPel * );
if( !seq->ir || !seq->offsets || !seq->pts ) {
conv_stop( seq, in, conv );
return( NULL );
@ -726,7 +726,7 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
*/
for( z = 0; z < conv->nnz; z++ )
seq->pts[z] = seq->offsets[z] +
(PEL *) IM_REGION_ADDR( ir, le, y );
IM_REGION_ADDR( ir, le, y );
switch( in->BandFmt ) {
case IM_BANDFMT_UCHAR:
@ -965,8 +965,8 @@ convvec_gen( REGION *or, void *vseq, void *a, void *b )
printf( "before convolve: %d, %d\n", r->left, r->top + y );
for( v = 0; v < mask->ysize; v++ ) {
for( h = 0; h < mask->xsize; h++ )
printf( "%3d ", *((PEL *) IM_REGION_ADDR( ir,
r->left + h, r->top + y + v )) );
printf( "%3d ", *IM_REGION_ADDR( ir,
r->left + h, r->top + y + v ) );
printf( "\n" );
}
}
@ -996,7 +996,7 @@ convvec_gen( REGION *or, void *vseq, void *a, void *b )
#ifdef DEBUG_PIXELS
printf( "after clip: %d\n",
*((PEL *) IM_REGION_ADDR( or, r->left, r->top + y )) );
*IM_REGION_ADDR( or, r->left, r->top + y ) );
#endif /*DEBUG_PIXELS*/
}

View File

@ -154,7 +154,7 @@ typedef struct {
REGION *ir; /* Input region */
int *offsets; /* Offsets for each non-zero matrix element */
PEL **pts; /* Per-non-zero mask element image pointers */
VipsPel **pts; /* Per-non-zero mask element image pointers */
int last_bpl; /* Avoid recalcing offsets, if we can */
} ConvSequence;
@ -194,7 +194,7 @@ conv_start( IMAGE *out, void *a, void *b )
*/
seq->ir = im_region_create( in );
seq->offsets = IM_ARRAY( out, conv->nnz, int );
seq->pts = IM_ARRAY( out, conv->nnz, PEL * );
seq->pts = IM_ARRAY( out, conv->nnz, VipsPel * );
if( !seq->ir || !seq->offsets || !seq->pts ) {
conv_stop( seq, in, conv );
return( NULL );
@ -278,8 +278,8 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
/* Init pts for this line of PELs.
*/
for( z = 0; z < conv->nnz; z++ )
seq->pts[z] = seq->offsets[z] +
(PEL *) IM_REGION_ADDR( ir, le, y );
seq->pts[z] = seq->offsets[z] +
IM_REGION_ADDR( ir, le, y );
switch( in->BandFmt ) {
case IM_BANDFMT_UCHAR:

View File

@ -91,8 +91,8 @@ fastcor_gen( REGION *or, void *seq, void *a, void *b )
IM_REGION_ADDR( or, r->left, r->top + y );
for( x = 0; x < r->width; x++ ) {
PEL *b = (PEL *) ref->data;
PEL *a = (PEL *)
VipsPel *b = ref->data;
VipsPel *a =
IM_REGION_ADDR( ir, r->left + x, r->top + y );
int sum;

View File

@ -171,7 +171,7 @@ spcor_gen( REGION *or, void *vseq, void *a, void *b )
float *q = (float *) IM_REGION_ADDR( or, le, y );
for( x = le; x < ri; x++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( ir, x, y );
VipsPel *p = IM_REGION_ADDR( ir, x, y );
/* Find sums for this position.
*/
@ -203,7 +203,7 @@ spcor_new( IMAGE *out, IMAGE *ref )
{
Spcor *spcor;
size_t sz = ref->Xsize * ref->Ysize;
PEL *p = (PEL *) ref->data;
VipsPel *p = ref->data;
double s;
size_t i;

View File

@ -81,7 +81,7 @@ IMAGE *im, *m;
int xpos, ypos, xsize, ysize; /* location of the box within im */
int dx, dy; /* displacements */
{
PEL *input, *cpinput;
VipsPel *input, *cpinput;
int *buf, *pnt, *cpnt;
double *line, *cpline;
int x, y;
@ -113,7 +113,7 @@ int dx, dy; /* displacements */
if ( (buf == NULL) || (line == NULL) ) {
im_error( "im_cooc_sym", "%s", _( "calloc failed") );
return(-1); }
input = (PEL*)im->data;
input = im->data;
input += ( ypos * im->Xsize + xpos );
offset = dy * im->Xsize + dx;
for ( y=0; y<ysize; y++ )
@ -141,7 +141,7 @@ int dx, dy; /* displacements */
cpline = line;
for (x=0; x<m->Xsize; x++)
*cpline++ = (double)(*cpnt++)/(double)norm;
if (im_writeline( y, m, (PEL *) line ) == -1)
if (im_writeline( y, m, (VipsPel *) line ) == -1)
{
im_error( "im_cooc_sym", "%s", _( "unable to im_writeline") );
return(-1);
@ -158,7 +158,7 @@ IMAGE *im, *m;
int xpos, ypos, xsize, ysize; /* location of the box within im */
int dx, dy; /* displacements */
{
PEL *input, *cpinput;
VipsPel *input, *cpinput;
int *buf, *pnt, *cpnt;
double *line, *cpline;
int x, y;
@ -190,7 +190,7 @@ int dx, dy; /* displacements */
if ( (buf == NULL) || (line == NULL) ) {
im_error( "im_cooc_ord", "%s", _( "calloc failed") );
return(-1); }
input = (PEL*)im->data;
input = im->data;
input += ( ypos * im->Xsize + xpos );
offset = dy * im->Xsize + dx;
for ( y=0; y<ysize; y++ )

View File

@ -722,9 +722,8 @@ im__dmsprint( im_object obj )
/* Print statistics band stats eg: 2 bands:b 0,1
*/
printf( "\
band minimum maximum sum sum^2 mean deviation\
\n" );
printf( "band minimum maximum sum "
"sum^2 mean deviation\n" );
for( j = 0; j < mask->ysize; j++ ) {
row = mask->coeff + j * mask->xsize;
if( j == 0 )

View File

@ -241,7 +241,7 @@ format_compare( VipsFormatClass *a, VipsFormatClass *b )
}
/**
* vips_format_map:
* vips_format_map: (skip)
* @fn: function to apply to each #VipsFormatClass
* @a: user data
* @b: user data

View File

@ -20,117 +20,39 @@ libforeign_la_SOURCES = \
analyzeload.c \
analyze2vips.c \
analyze2vips.h \
foreign.c
foreign.c \
matlab.h \
matlab.c \
matload.c \
magick.h \
magick2vips.c \
magickload.c \
pngload.c \
pngsave.c \
vipspng.h \
vipspng.c \
openexr2vips.h \
openexr2vips.c \
openexrload.c \
fits.h \
fits.c \
fitsload.c \
fitssave.c \
tiff.h \
vips2tiff.c \
tiff2vips.c \
tiffload.c \
tiffsave.c \
openslide2vips.h \
openslide2vips.c \
openslideload.c \
vips2jpeg.c \
jpeg2vips.c \
jpeg.h \
jpegload.c \
jpegsave.c
EXTRA_DIST =
if HAVE_MATIO
libforeign_la_SOURCES += \
matlab.h \
matlab.c \
matload.c
else
EXTRA_DIST += \
matlab.h \
matlab.c \
matload.c
endif
if HAVE_MAGICK
libforeign_la_SOURCES += \
magick.h \
magick2vips.c \
magickload.c
else
EXTRA_DIST += \
magick.h \
magick2vips.c \
magickload.c
endif
if HAVE_PNG
libforeign_la_SOURCES += \
pngload.c \
pngsave.c \
vipspng.h \
vipspng.c
else
EXTRA_DIST += \
pngload.c \
pngsave.c \
vipspng.h \
vipspng.c
endif
if HAVE_OPENEXR
libforeign_la_SOURCES += \
openexr2vips.h \
openexr2vips.c \
openexrload.c
else
EXTRA_DIST += \
openexr2vips.h \
openexr2vips.c \
openexrload.c
endif
if HAVE_CFITSIO
libforeign_la_SOURCES += \
fits.h \
fits.c \
fitsload.c \
fitssave.c
else
EXTRA_DIST += \
fits.h \
fits.c \
fitsload.c \
fitssave.c
endif
if HAVE_TIFF
libforeign_la_SOURCES += \
tiff.h \
vips2tiff.c \
tiff2vips.c \
tiffload.c \
tiffsave.c
else
EXTRA_DIST += \
tiff.h \
vips2tiff.c \
tiff2vips.c \
tiffload.c \
tiffsave.c
endif
if HAVE_OPENSLIDE
libforeign_la_SOURCES += \
openslide2vips.h \
openslide2vips.c \
openslideload.c
else
EXTRA_DIST += \
openslide2vips.h \
openslide2vips.c \
openslideload.c
endif
if HAVE_JPEG
libforeign_la_SOURCES += \
vips2jpeg.c \
jpeg2vips.c \
jpeg.h \
jpegload.c \
jpegsave.c
else
EXTRA_DIST += \
vips2jpeg.c \
jpeg2vips.c \
jpeg.h \
jpegload.c \
jpegsave.c
endif
INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@

View File

@ -309,7 +309,7 @@ read_csv( FILE *fp, VipsImage *out,
buf[x] = d;
}
if( vips_image_write_line( out, y, (PEL *) buf ) )
if( vips_image_write_line( out, y, (VipsPel *) buf ) )
return( -1 );
/* Skip over the '\n' to the next line.
@ -368,9 +368,9 @@ vips2csv( VipsImage *in, FILE *fp, const char *sep )
int es = VIPS_IMAGE_SIZEOF_ELEMENT( in );
int x, y;
PEL *p;
VipsPel *p;
p = (PEL *) in->data;
p = in->data;
for( y = 0; y < in->Ysize; y++ ) {
for( x = 0; x < w; x++ ) {
if( x > 0 )

View File

@ -176,11 +176,14 @@ vips_foreign_load_csv_init( VipsForeignLoadCsv *csv )
* vips_csvload:
* @filename: file to load
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @skip: skip this many lines at start of file
* @lines: read this many lines from file
* @whitespace: set of whitespace characters
* @separator: set of separator characters
* @...: %NULL-terminated list of optional named arguments
*
* Load a CSV (comma-separated values) file. The output image is always 1
* band (monochrome), #VIPS_FORMAT_DOUBLE.

View File

@ -142,9 +142,12 @@ vips_foreign_save_csv_init( VipsForeignSaveCsv *csv )
* vips_csvsave:
* @in: image to save
* @filename: file to write to
* @separator: separator string
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @separator: separator string
*
* Writes the pixels in @in to the @filename as CSV (comma-separated values).
* The image is written
* one line of text per scanline. Complex numbers are written as

View File

@ -58,6 +58,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_CFITSIO
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -111,7 +113,7 @@ typedef struct {
/* We split bands up for write into this buffer.
*/
PEL *buffer;
VipsPel *buffer;
} VipsFits;
const char *vips__fits_suffs[] = { ".fits", NULL };
@ -347,7 +349,7 @@ fits2vips_generate( VipsRegion *out,
VipsFits *fits = (VipsFits *) a;
Rect *r = &out->valid;
PEL *q;
VipsPel *q;
int z;
int status;
@ -382,7 +384,7 @@ fits2vips_generate( VipsRegion *out,
for( z = 0; z < MAX_DIMENSIONS; z++ )
inc[z] = 1;
q = (PEL *) VIPS_REGION_ADDR( out, r->left, r->top );
q = VIPS_REGION_ADDR( out, r->left, r->top );
/* Break on ffgsv() for this call.
*/
@ -415,7 +417,7 @@ fits2vips_generate( VipsRegion *out,
for( z = 0; z < MAX_DIMENSIONS; z++ )
inc[z] = 1;
q = (PEL *) VIPS_REGION_ADDR( out, r->left, y );
q = VIPS_REGION_ADDR( out, r->left, y );
/* Break on ffgsv() for this call.
*/
@ -560,7 +562,7 @@ vips_fits_new_write( VipsImage *in, const char *filename )
/* We need to be able to hold one scanline of one band.
*/
if( !(fits->buffer = VIPS_ARRAY( NULL,
VIPS_IMAGE_SIZEOF_ELEMENT( in ) * in->Xsize, PEL )) )
VIPS_IMAGE_SIZEOF_ELEMENT( in ) * in->Xsize, VipsPel )) )
return( NULL );
/* fits_create_file() will fail if there's a file of thet name, unless
@ -680,11 +682,11 @@ vips_fits_write( VipsRegion *region, VipsRect *area, void *a )
*/
for( y = 0; y < area->height; y++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( region,
VipsPel *p = VIPS_REGION_ADDR( region,
area->left, area->top + y );
for( b = 0; b < image->Bands; b++ ) {
PEL *p1, *q;
VipsPel *p1, *q;
long fpixel[3];
p1 = p + b * es;
@ -736,3 +738,5 @@ vips__fits_write( VipsImage *in, const char *filename )
return( 0 );
}
#endif /*HAVE_CFITSIO*/

View File

@ -39,6 +39,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_CFITSIO
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -122,3 +124,5 @@ static void
vips_foreign_load_fits_init( VipsForeignLoadFits *fits )
{
}
#endif /*HAVE_CFITSIO*/

View File

@ -40,6 +40,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_CFITSIO
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -134,3 +136,5 @@ static void
vips_foreign_save_fits_init( VipsForeignSaveFits *fits )
{
}
#endif /*HAVE_CFITSIO*/

View File

@ -383,7 +383,7 @@ file_compare( VipsForeignClass *a, VipsForeignClass *b )
/**
* vips_foreign_map:
* @base: base class to search below (eg. "VipsForeignLoad")
* @fn: function to apply to each #VipsForeignClass
* @fn: (scope call): function to apply to each #VipsForeignClass
* @a: user data
* @b: user data
*
@ -396,7 +396,7 @@ file_compare( VipsForeignClass *a, VipsForeignClass *b )
*
* See also: vips_slist_map().
*
* Returns: the result of iteration
* Returns: (transfer none): the result of iteration
*/
void *
vips_foreign_map( const char *base, VipsSListMap2Fn fn, void *a, void *b )
@ -1450,9 +1450,12 @@ vips_magickload( const char *filename, VipsImage **out, ... )
* vips_tiffload:
* @filename: file to load
* @out: decompressed image
* @page: load this page
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @page: load this page
*
* Read a TIFF file into a VIPS image. It is a full baseline TIFF 6 reader,
* with extensions for tiled images, multipage images, LAB colour space,
* pyramidal images and JPEG compression. including CMYK and YCbCr.
@ -1483,6 +1486,10 @@ vips_tiffload( const char *filename, VipsImage **out, ... )
* vips_tiffsave:
* @in: image to save
* @filename: file to write to
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @compression; use this compression scheme
* @Q: quality factor
* @predictor; compress with this prediction
@ -1496,7 +1503,6 @@ vips_tiffload( const char *filename, VipsImage **out, ... )
* @xres; horizontal resolution
* @yres; vertical resolution
* @bigtiff; write a BigTiff file
* @...: %NULL-terminated list of optional named arguments
*
* Write a VIPS image to a file as TIFF.
*
@ -1611,10 +1617,12 @@ vips_jpegload_buffer( void *buf, size_t len, VipsImage **out, ... )
* vips_jpegload:
* @filename: file to load
* @out: decompressed image
* @flags: image flags
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @shrink: shrink by this much on load
* @fail: fail on warnings
* @...: %NULL-terminated list of optional named arguments
*
* Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images,
* including CMYK and YCbCr.
@ -1673,9 +1681,12 @@ vips_jpegload( const char *filename, VipsImage **out, ... )
/**
* vips_jpegsave_mime:
* @in: image to save
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @Q: JPEG quality factor
* @profile: attach this ICC profile
* @...: %NULL-terminated list of optional named arguments
*
* As vips_jpegsave(), but save as a mime jpeg on stdout.
*
@ -1701,9 +1712,12 @@ vips_jpegsave_mime( VipsImage *in, ... )
* @in: image to save
* @buf: return output buffer here
* @len: return output length here
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @Q: JPEG quality factor
* @profile: attach this ICC profile
* @...: %NULL-terminated list of optional named arguments
*
* As vips_jpegsave(), but save to a memory buffer.
*
@ -1742,9 +1756,12 @@ vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... )
* vips_jpegsave:
* @in: image to save
* @filename: file to write to
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @Q: quality factor
* @profile: attach this ICC profile
* @...: %NULL-terminated list of optional named arguments
*
* Write a VIPS image to a file as JPEG.
*
@ -1815,9 +1832,12 @@ vips_openexrload( const char *filename, VipsImage **out, ... )
* vips_openslideload:
* @filename: file to load
* @out: decompressed image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @layer: load this layer
* @associated: load this associated image
* @...: %NULL-terminated list of optional named arguments
*
* Read a virtual slide supported by the OpenSlide library into a VIPS image.
* OpenSlide supports images in Aperio, Hamamatsu VMS, Hamamatsu VMU, MIRAX,
@ -1938,9 +1958,12 @@ vips_pngload( const char *filename, VipsImage **out, ... )
* vips_pngsave:
* @in: image to save
* @filename: file to write to
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @compression: compression level
* @interlace: interlace image
* @...: %NULL-terminated list of optional named arguments
*
* Write a VIPS image to a file as PNG.
*
@ -1979,9 +2002,12 @@ vips_pngsave( VipsImage *in, const char *filename, ... )
* @in: image to save
* @buf: return output buffer here
* @len: return output length here
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @compression: compression level
* @interlace: interlace image
* @...: %NULL-terminated list of optional named arguments
*
* As vips_pngsave(), but save to a memory buffer.
*

View File

@ -79,6 +79,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_JPEG
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -1010,3 +1012,4 @@ vips__isjpeg( const char *filename )
return( 0 );
}
#endif /*HAVE_JPEG*/

View File

@ -42,6 +42,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_JPEG
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -301,3 +303,4 @@ vips_foreign_load_jpeg_buffer_init( VipsForeignLoadJpegBuffer *buffer )
{
}
#endif /*HAVE_JPEG*/

View File

@ -40,6 +40,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_JPEG
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -323,3 +325,5 @@ static void
vips_foreign_save_jpeg_mime_init( VipsForeignSaveJpegMime *mime )
{
}
#endif /*HAVE_JPEG*/

View File

@ -75,6 +75,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_MAGICK
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -475,7 +477,7 @@ parse_header( Read *read )
}
static void
unpack_pixels( VipsImage *im, PEL *q8, PixelPacket *pixels, int n )
unpack_pixels( VipsImage *im, VipsPel *q8, PixelPacket *pixels, int n )
{
int x;
@ -706,3 +708,5 @@ vips__magick_read_header( const char *filename, VipsImage *im )
return( 0 );
}
#endif /*HAVE_MAGICK*/

View File

@ -39,6 +39,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_MAGICK
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -153,3 +155,5 @@ static void
vips_foreign_load_magick_init( VipsForeignLoadMagick *magick )
{
}
#endif /*HAVE_MAGICK*/

View File

@ -56,6 +56,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_MATIO
#include <stdio.h>
#include <stdlib.h>
@ -221,7 +223,7 @@ static int
mat2vips_get_data( mat_t *mat, matvar_t *var, VipsImage *im )
{
int y;
PEL *buffer;
VipsPel *buffer;
const int es = VIPS_IMAGE_SIZEOF_ELEMENT( im );
/* Matlab images are plane-separate, so we have to assemble bands in
@ -238,20 +240,21 @@ mat2vips_get_data( mat_t *mat, matvar_t *var, VipsImage *im )
/* Matlab images are in columns, so we have to transpose into
* scanlines with this buffer.
*/
if( !(buffer = VIPS_ARRAY( im, VIPS_IMAGE_SIZEOF_LINE( im ), PEL )) )
if( !(buffer = VIPS_ARRAY( im,
VIPS_IMAGE_SIZEOF_LINE( im ), VipsPel )) )
return( -1 );
for( y = 0; y < im->Ysize; y++ ) {
const PEL *p = var->data + y * es;
const VipsPel *p = var->data + y * es;
int x;
PEL *q;
VipsPel *q;
q = buffer;
for( x = 0; x < im->Xsize; x++ ) {
int b;
for( b = 0; b < im->Bands; b++ ) {
const PEL *p2 = p + b * is;
const VipsPel *p2 = p + b * is;
int z;
for( z = 0; z < es; z++ )
@ -304,3 +307,5 @@ vips__mat_ismat( const char *filename )
}
const char *vips__mat_suffs[] = { ".mat", NULL };
#endif /*HAVE_MATIO*/

View File

@ -39,6 +39,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_MATIO
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -134,3 +136,5 @@ static void
vips_foreign_load_mat_init( VipsForeignLoadMat *mat )
{
}
#endif /*HAVE_MATIO*/

View File

@ -67,6 +67,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_OPENEXR
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
@ -397,10 +399,12 @@ vips__openexr_read( const char *filename, VipsImage *out )
(ImfHalf *) imf_buffer, vips_buffer );
if( vips_image_write_line( out, y,
(PEL *) vips_buffer ) )
(VipsPel *) vips_buffer ) )
return( -1 );
}
}
return( 0 );
}
#endif /*HAVE_OPENEXR*/

View File

@ -39,6 +39,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_OPENEXR
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -143,3 +145,5 @@ static void
vips_foreign_load_openexr_init( VipsForeignLoadOpenexr *openexr )
{
}
#endif /*HAVE_OPENEXR*/

View File

@ -55,6 +55,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_OPENSLIDE
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
@ -351,3 +353,4 @@ vips__openslide_read_associated( const char *filename, VipsImage *out,
return( 0 );
}
#endif /*HAVE_OPENSLIDE*/

View File

@ -39,6 +39,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_OPENSLIDE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -201,3 +203,5 @@ static void
vips_foreign_load_openslide_init( VipsForeignLoadOpenslide *openslide )
{
}
#endif /*HAVE_OPENSLIDE*/

View File

@ -47,6 +47,8 @@
#include <vips/buf.h>
#include <vips/internal.h>
#ifdef HAVE_PNG
#include "vipspng.h"
typedef struct _VipsForeignLoadPng {
@ -134,3 +136,5 @@ static void
vips_foreign_load_png_init( VipsForeignLoadPng *png )
{
}
#endif /*HAVE_PNG*/

View File

@ -40,6 +40,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_PNG
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -234,3 +236,5 @@ static void
vips_foreign_save_png_buffer_init( VipsForeignSavePngBuffer *buffer )
{
}
#endif /*HAVE_PNG*/

View File

@ -305,9 +305,9 @@ static int
read_ascii( FILE *fp, VipsImage *out )
{
int x, y;
PEL *buf;
VipsPel *buf;
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) )
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
for( y = 0; y < out->Ysize; y++ ) {
@ -349,9 +349,9 @@ static int
read_1bit_ascii( FILE *fp, VipsImage *out )
{
int x, y;
PEL *buf;
VipsPel *buf;
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) )
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
for( y = 0; y < out->Ysize; y++ ) {
@ -381,9 +381,9 @@ read_1bit_binary( FILE *fp, VipsImage *out )
{
int x, y, i;
int bits;
PEL *buf;
VipsPel *buf;
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) )
if( !(buf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
bits = fgetc( fp );
@ -493,7 +493,7 @@ vips__ppm_load( const char *filename, VipsImage *out )
int
vips__ppm_isppm( const char *filename )
{
PEL buf[3];
VipsPel buf[3];
if( vips__get_bytes( filename, buf, 2 ) ) {
int i;
@ -523,7 +523,7 @@ vips__ppm_flags( const char *filename )
const char *vips__ppm_suffs[] = { ".ppm", ".pgm", ".pbm", ".pfm", NULL };
typedef int (*write_fn)( VipsImage *in, FILE *fp, PEL *p );
typedef int (*write_fn)( VipsImage *in, FILE *fp, VipsPel *p );
/* What we track during a PPM write.
*/
@ -564,7 +564,7 @@ write_new( VipsImage *in, const char *name )
}
static int
write_ppm_line_ascii( VipsImage *in, FILE *fp, PEL *p )
write_ppm_line_ascii( VipsImage *in, FILE *fp, VipsPel *p )
{
const int sk = VIPS_IMAGE_SIZEOF_PEL( in );
int x, k;
@ -604,7 +604,7 @@ write_ppm_line_ascii( VipsImage *in, FILE *fp, PEL *p )
}
static int
write_ppm_line_binary( VipsImage *in, FILE *fp, PEL *p )
write_ppm_line_binary( VipsImage *in, FILE *fp, VipsPel *p )
{
if( !fwrite( p, VIPS_IMAGE_SIZEOF_LINE( in ), 1, fp ) ) {
vips_error( "vips2ppm",
@ -622,7 +622,7 @@ write_ppm_block( REGION *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( region, 0, area->top + i );
VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + i );
if( write->fn( write->in, write->fp, p ) )
return( -1 );

View File

@ -138,9 +138,12 @@ vips_foreign_save_ppm_init( VipsForeignSavePpm *ppm )
* vips_ppmsave:
* @in: image to save
* @filename: file to write to
* @ascii: save as ASCII rather than binary
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @ascii: save as ASCII rather than binary
*
* Write a VIPS image to a file as PPM. It can write 8, 16 or
* 32 bit unsigned integer images, float images, colour or monochrome,
* stored as binary or ASCII.

View File

@ -1098,7 +1098,7 @@ vips2rad_put_data_block( VipsRegion *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = (PEL *) VIPS_REGION_ADDR( region, 0, area->top + i );
VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + i );
if( fwritecolrs( p, area->width, write->fout ) )
return( -1 );

View File

@ -157,11 +157,14 @@ vips_foreign_load_raw_init( VipsForeignLoadRaw *raw )
* vips_rawload:
* @filename: file to load
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @width: width of image in pixels
* @height: height of image in pixels
* @bands: number of image bands
* @offset: offset in bytes from start of file
* @...: %NULL-terminated list of optional named arguments
*
* This operation mmaps the file, setting @out so that access to that
* image will read from the file.

View File

@ -94,7 +94,8 @@ vips_foreign_save_raw_write( VipsRegion *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = VIPS_REGION_ADDR( region, area->left, area->top + i );
VipsPel *p =
VIPS_REGION_ADDR( region, area->left, area->top + i );
if( vips__write( raw->fd, p,
VIPS_IMAGE_SIZEOF_PEL( save->in ) * area->width ) )
@ -222,7 +223,8 @@ vips_foreign_save_raw_fd_write( VipsRegion *region, Rect *area, void *a )
int i;
for( i = 0; i < area->height; i++ ) {
PEL *p = VIPS_REGION_ADDR( region, area->left, area->top + i );
VipsPel *p =
VIPS_REGION_ADDR( region, area->left, area->top + i );
if( vips__write( fd->fd, p,
VIPS_IMAGE_SIZEOF_PEL( save->in ) * area->width ) )

View File

@ -162,6 +162,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_TIFF
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -176,7 +178,8 @@
/* Scanline-type process function.
*/
typedef void (*scanline_process_fn)( PEL *q, PEL *p, int n, void *client );
typedef void (*scanline_process_fn)( VipsPel *q, VipsPel *p, int n,
void *client );
/* Stuff we track during a read.
*/
@ -324,7 +327,7 @@ tfget16( TIFF *tif, ttag_t tag, int *out )
/* Per-scanline process function for VIPS_CODING_LABQ.
*/
static void
labpack_line( PEL *q, PEL *p, int n, void *dummy )
labpack_line( VipsPel *q, VipsPel *p, int n, void *dummy )
{
int x;
@ -361,7 +364,7 @@ parse_labpack( ReadTiff *rtiff, VipsImage *out )
/* Per-scanline process function for VIPS_CODING_LABQ.
*/
static void
labs_line( PEL *q, PEL *p, int n, void *dummy )
labs_line( VipsPel *q, VipsPel *p, int n, void *dummy )
{
int x;
unsigned short *p1 = (unsigned short *) p;
@ -399,13 +402,13 @@ parse_labs( ReadTiff *rtiff, VipsImage *out )
/* Per-scanline process function for 1 bit images.
*/
static void
onebit_line( PEL *q, PEL *p, int n, void *flg )
onebit_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
/* Extract PHOTOMETRIC_INTERPRETATION.
*/
int pm = *((int *) flg);
int x, i, z;
PEL bits;
VipsPel bits;
int black = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 255;
int white = black ^ -1;
@ -413,7 +416,7 @@ onebit_line( PEL *q, PEL *p, int n, void *flg )
/* (sigh) how many times have I written this?
*/
for( x = 0, i = 0; i < (n >> 3); i++ ) {
bits = (PEL) p[i];
bits = (VipsPel) p[i];
for( z = 0; z < 8; z++, x++ ) {
q[x] = (bits & 128) ? white : black;
@ -463,11 +466,11 @@ parse_onebit( ReadTiff *rtiff, int pm, VipsImage *out )
/* Per-scanline process function for 8-bit greyscale images.
*/
static void
greyscale8_line( PEL *q, PEL *p, int n, void *flg )
greyscale8_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
/* Extract swap mask.
*/
PEL mask = *((PEL *) flg);
VipsPel mask = *((VipsPel *) flg);
int x;
/* Read bytes, swapping sense if necessary.
@ -481,7 +484,7 @@ greyscale8_line( PEL *q, PEL *p, int n, void *flg )
static int
parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out )
{
PEL *mask;
VipsPel *mask;
if( !tfequals( rtiff->tiff, TIFFTAG_SAMPLESPERPIXEL, 1 ) ||
!tfequals( rtiff->tiff, TIFFTAG_BITSPERSAMPLE, 8 ) )
@ -489,7 +492,7 @@ parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out )
/* Eor each pel with this later.
*/
if( !(mask = VIPS_ARRAY( out, 1, PEL )) )
if( !(mask = VIPS_ARRAY( out, 1, VipsPel )) )
return( -1 );
*mask = (pm == PHOTOMETRIC_MINISBLACK) ? 0 : 255;
@ -507,7 +510,7 @@ parse_greyscale8( ReadTiff *rtiff, int pm, VipsImage *out )
/* Per-scanline process function for 16-bit greyscale images.
*/
static void
greyscale16_line( PEL *q, PEL *p, int n, void *flg )
greyscale16_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
/* Extract swap mask.
*/
@ -553,7 +556,7 @@ parse_greyscale16( ReadTiff *rtiff, int pm, VipsImage *out )
/* Per-scanline process function when we just need to copy.
*/
static void
memcpy_line( PEL *q, PEL *p, int n, void *client )
memcpy_line( VipsPel *q, VipsPel *p, int n, void *client )
{
VipsImage *im = (VipsImage *) client;
@ -585,9 +588,9 @@ parse_greyscale32f( ReadTiff *rtiff, int pm, VipsImage *out )
typedef struct {
/* LUTs mapping image indexes to RGB.
*/
PEL *red;
PEL *green;
PEL *blue;
VipsPel *red;
VipsPel *green;
VipsPel *blue;
/* Bits per sample.
*/
@ -601,12 +604,12 @@ typedef struct {
/* Per-scanline process function for palette images.
*/
static void
palette_line( PEL *q, PEL *p, int n, void *flg )
palette_line( VipsPel *q, VipsPel *p, int n, void *flg )
{
PaletteRead *read = (PaletteRead *) flg;
int bit;
PEL data;
VipsPel data;
int x;
bit = 0;
@ -646,9 +649,9 @@ parse_palette( ReadTiff *rtiff, VipsImage *out )
int i;
if( !(read = VIPS_NEW( out, PaletteRead )) ||
!(read->red = VIPS_ARRAY( out, 256, PEL )) ||
!(read->green = VIPS_ARRAY( out, 256, PEL )) ||
!(read->blue = VIPS_ARRAY( out, 256, PEL )) )
!(read->red = VIPS_ARRAY( out, 256, VipsPel )) ||
!(read->green = VIPS_ARRAY( out, 256, VipsPel )) ||
!(read->blue = VIPS_ARRAY( out, 256, VipsPel )) )
return( -1 );
if( !tfequals( rtiff->tiff, TIFFTAG_SAMPLESPERPIXEL, 1 ) ||
@ -1223,10 +1226,10 @@ tiff_fill_region( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop )
* Just unpack the section of the tile we need.
*/
for( z = 0; z < hit.height; z++ ) {
PEL *p = (PEL *) buf +
VipsPel *p = (VipsPel *) buf +
(hit.left - tile.left) * tps +
(hit.top - tile.top + z) * tls;
PEL *q = (PEL *) VIPS_REGION_ADDR( out,
VipsPel *q = VIPS_REGION_ADDR( out,
hit.left, hit.top + z );
rtiff->sfn( q, p, hit.width, rtiff->client );
@ -1310,13 +1313,13 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out )
tsize_t strip_size;
int number_of_strips;
PEL *vbuf;
VipsPel *vbuf;
tdata_t tbuf;
tstrip_t strip;
tsize_t length;
int y;
int i;
PEL *p;
VipsPel *p;
#ifdef DEBUG
printf( "tiff2vips: read_stripwise\n" );
@ -1340,7 +1343,8 @@ read_stripwise( ReadTiff *rtiff, VipsImage *out )
/* Make buffers.
*/
if( !(vbuf = VIPS_ARRAY( out, VIPS_IMAGE_SIZEOF_LINE( out ), PEL )) ||
if( !(vbuf = VIPS_ARRAY( out,
VIPS_IMAGE_SIZEOF_LINE( out ), VipsPel )) ||
!(tbuf = vips_malloc( VIPS_OBJECT( out ), strip_size )) )
return( -1 );
@ -1554,3 +1558,5 @@ vips__istiff( const char *filename )
return( FALSE );
}
#endif /*HAVE_TIFF*/

View File

@ -39,6 +39,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_TIFF
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -153,3 +155,5 @@ static void
vips_foreign_load_tiff_init( VipsForeignLoadTiff *tiff )
{
}
#endif /*HAVE_TIFF*/

View File

@ -40,6 +40,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_TIFF
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -276,3 +278,5 @@ vips_foreign_save_tiff_init( VipsForeignSaveTiff *tiff )
tiff->xres = 1.0;
tiff->yres = 1.0;
}
#endif /*HAVE_TIFF*/

View File

@ -85,6 +85,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_JPEG
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -1112,3 +1114,5 @@ vips__jpeg_write_buffer( VipsImage *in,
}
const char *vips__jpeg_suffs[] = { ".jpg", ".jpeg", ".jpe", NULL };
#endif /*HAVE_JPEG*/

View File

@ -163,6 +163,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_TIFF
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
@ -180,7 +182,7 @@
/* Max no of tiles we buffer in a layer. Enough to buffer a line of 64x64
* tiles on a 100k pixel across image.
*/
#define IM_MAX_LAYER_BUFFER (1000)
#define MAX_LAYER_BUFFER (1000)
/* Bits we OR together for quadrants in a tile.
*/
@ -196,7 +198,7 @@ typedef enum pyramid_bits {
/* A tile in our pyramid.
*/
typedef struct pyramid_tile {
REGION *tile;
VipsRegion *tile;
PyramidBits bits;
} PyramidTile;
@ -211,8 +213,8 @@ typedef struct pyramid_layer {
char *lname; /* Name of this TIFF file */
TIFF *tif; /* TIFF file we write this layer to */
PEL *tbuf; /* TIFF output buffer */
PyramidTile tiles[IM_MAX_LAYER_BUFFER];
VipsPel *tbuf; /* TIFF output buffer */
PyramidTile tiles[MAX_LAYER_BUFFER];
struct pyramid_layer *below; /* Tiles go to here */
struct pyramid_layer *above; /* Tiles come from here */
@ -221,18 +223,18 @@ typedef struct pyramid_layer {
/* A TIFF image in the process of being written.
*/
typedef struct tiff_write {
IMAGE *im; /* Original input image */
VipsImage *im; /* Original input image */
char *name; /* Final name we write to */
/* Read from im with these.
*/
REGION *reg;
VipsRegion *reg;
char *bname; /* Name for base layer */
TIFF *tif; /* Image we write to */
PyramidLayer *layer; /* Top of pyramid, if in use */
PEL *tbuf; /* TIFF output buffer */
VipsPel *tbuf; /* TIFF output buffer */
int tls; /* Tile line size */
int compression; /* Compression type */
@ -264,7 +266,7 @@ tiff_openout( TiffWrite *tw, const char *name )
#endif /*DEBUG*/
if( !(tif = TIFFOpen( name, mode )) ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
_( "unable to open \"%s\" for output" ), name );
return( NULL );
}
@ -280,7 +282,7 @@ tiff_openin( const char *name )
TIFF *tif;
if( !(tif = TIFFOpen( name, "r" )) ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
_( "unable to open \"%s\" for input" ), name );
return( NULL );
}
@ -291,7 +293,7 @@ tiff_openin( const char *name )
/* Convert VIPS LabQ to TIFF LAB. Just take the first three bands.
*/
static void
LabQ2LabC( PEL *q, PEL *p, int n )
LabQ2LabC( VipsPel *q, VipsPel *p, int n )
{
int x;
@ -310,10 +312,10 @@ LabQ2LabC( PEL *q, PEL *p, int n )
/* Pack 8 bit VIPS to 1 bit TIFF.
*/
static void
eightbit2onebit( PEL *q, PEL *p, int n )
eightbit2onebit( VipsPel *q, VipsPel *p, int n )
{
int x;
PEL bits;
VipsPel bits;
bits = 0;
for( x = 0; x < n; x++ ) {
@ -336,7 +338,7 @@ eightbit2onebit( PEL *q, PEL *p, int n )
/* Convert VIPS LABS to TIFF 16 bit LAB.
*/
static void
LabS2Lab16( PEL *q, PEL *p, int n )
LabS2Lab16( VipsPel *q, VipsPel *p, int n )
{
int x;
short *p1 = (short *) p;
@ -357,23 +359,23 @@ LabS2Lab16( PEL *q, PEL *p, int n )
/* Pack a VIPS region into a TIFF tile buffer.
*/
static void
pack2tiff( TiffWrite *tw, REGION *in, PEL *q, Rect *area )
pack2tiff( TiffWrite *tw, VipsRegion *in, VipsPel *q, VipsRect *area )
{
int y;
for( y = area->top; y < IM_RECT_BOTTOM( area ); y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( in, area->left, y );
for( y = area->top; y < VIPS_RECT_BOTTOM( area ); y++ ) {
VipsPel *p = (VipsPel *) VIPS_REGION_ADDR( in, area->left, y );
if( in->im->Coding == IM_CODING_LABQ )
if( in->im->Coding == VIPS_CODING_LABQ )
LabQ2LabC( q, p, area->width );
else if( tw->onebit )
eightbit2onebit( q, p, area->width );
else if( in->im->BandFmt == IM_BANDFMT_SHORT &&
in->im->Type == IM_TYPE_LABS )
else if( in->im->BandFmt == VIPS_FORMAT_SHORT &&
in->im->Type == VIPS_INTERPRETATION_LABS )
LabS2Lab16( q, p, area->width );
else
memcpy( q, p,
area->width * IM_IMAGE_SIZEOF_PEL( in->im ) );
area->width * VIPS_IMAGE_SIZEOF_PEL( in->im ) );
q += tw->tls;
}
@ -387,10 +389,10 @@ embed_profile_file( TIFF *tif, const char *profile )
char *buffer;
unsigned int length;
if( !(buffer = im__file_read_name( profile, VIPS_ICC_DIR, &length )) )
if( !(buffer = vips__file_read_name( profile, VIPS_ICC_DIR, &length )) )
return( -1 );
TIFFSetField( tif, TIFFTAG_ICCPROFILE, length, buffer );
im_free( buffer );
vips_free( buffer );
#ifdef DEBUG
printf( "vips2tiff: attached profile \"%s\"\n", profile );
@ -399,15 +401,15 @@ embed_profile_file( TIFF *tif, const char *profile )
return( 0 );
}
/* Embed an ICC profile from IMAGE metadata.
/* Embed an ICC profile from VipsImage metadata.
*/
static int
embed_profile_meta( TIFF *tif, IMAGE *im )
embed_profile_meta( TIFF *tif, VipsImage *im )
{
void *data;
size_t data_length;
if( im_meta_get_blob( im, IM_META_ICC_NAME, &data, &data_length ) )
if( vips_image_get_blob( im, VIPS_META_ICC_NAME, &data, &data_length ) )
return( -1 );
TIFFSetField( tif, TIFFTAG_ICCPROFILE, data_length, data );
@ -427,14 +429,14 @@ embed_profile( TiffWrite *tw, TIFF *tif )
return( -1 );
if( !tw->icc_profile &&
im_header_get_typeof( tw->im, IM_META_ICC_NAME ) &&
vips_image_get_typeof( tw->im, VIPS_META_ICC_NAME ) &&
embed_profile_meta( tif, tw->im ) )
return( -1 );
return( 0 );
}
/* Write a TIFF header. width and height are the size of the IMAGE we are
/* Write a TIFF header. width and height are the size of the VipsImage we are
* writing (may have been shrunk!).
*/
static int
@ -466,9 +468,9 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
*/
TIFFSetField( tif, TIFFTAG_RESOLUTIONUNIT, tw->resunit );
TIFFSetField( tif, TIFFTAG_XRESOLUTION,
IM_CLIP( 0.01, tw->xres, 10000 ) );
VIPS_CLIP( 0.01, tw->xres, 10000 ) );
TIFFSetField( tif, TIFFTAG_YRESOLUTION,
IM_CLIP( 0.01, tw->yres, 10000 ) );
VIPS_CLIP( 0.01, tw->yres, 10000 ) );
/* Attach ICC profile.
*/
@ -477,7 +479,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
/* And colour fields.
*/
if( tw->im->Coding == IM_CODING_LABQ ) {
if( tw->im->Coding == VIPS_CODING_LABQ ) {
TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, 3 );
TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE, 8 );
TIFFSetField( tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_CIELAB );
@ -493,7 +495,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, tw->im->Bands );
TIFFSetField( tif, TIFFTAG_BITSPERSAMPLE,
im_bits_of_fmt( tw->im->BandFmt ) );
vips_format_sizeof( tw->im->BandFmt ) << 3 );
switch( tw->im->Bands ) {
case 1:
@ -507,10 +509,10 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
case 3:
case 4:
if( tw->im->Type == IM_TYPE_LAB ||
tw->im->Type == IM_TYPE_LABS )
if( tw->im->Type == VIPS_INTERPRETATION_LAB ||
tw->im->Type == VIPS_INTERPRETATION_LABS )
photometric = PHOTOMETRIC_CIELAB;
else if( tw->im->Type == IM_TYPE_CMYK ) {
else if( tw->im->Type == VIPS_INTERPRETATION_CMYK ) {
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField( tif,
TIFFTAG_INKSET, INKSET_CMYK );
@ -525,7 +527,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
else
photometric = PHOTOMETRIC_RGB;
if( tw->im->Type != IM_TYPE_CMYK &&
if( tw->im->Type != VIPS_INTERPRETATION_CMYK &&
tw->im->Bands == 4 ) {
v[0] = EXTRASAMPLE_ASSOCALPHA;
TIFFSetField( tif, TIFFTAG_EXTRASAMPLES, 1, v );
@ -533,7 +535,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
break;
case 5:
if( tw->im->Type == IM_TYPE_CMYK ) {
if( tw->im->Type == VIPS_INTERPRETATION_CMYK ) {
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField( tif,
TIFFTAG_INKSET, INKSET_CMYK );
@ -563,7 +565,7 @@ write_tiff_header( TiffWrite *tw, TIFF *tif, int width, int height )
/* Sample format ... for float, we write IEEE.
*/
if( tw->im->BandFmt == IM_BANDFMT_FLOAT )
if( tw->im->BandFmt == VIPS_FORMAT_FLOAT )
TIFFSetField( tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP );
return( 0 );
@ -576,16 +578,13 @@ free_layer( PyramidLayer *layer )
{
int i;
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ )
if( layer->tiles[i].tile ) {
im_region_free( layer->tiles[i].tile );
layer->tiles[i].tile = NULL;
}
for( i = 0; i < MAX_LAYER_BUFFER; i++ )
VIPS_FREEF( g_object_unref, layer->tiles[i].tile );
/* And close the TIFF file we are writing to.
*/
IM_FREEF( im_free, layer->tbuf );
IM_FREEF( TIFFClose, layer->tif );
VIPS_FREEF( vips_free, layer->tbuf );
VIPS_FREEF( TIFFClose, layer->tif );
}
/* Free an entire pyramid.
@ -606,7 +605,7 @@ static int
build_pyramid( TiffWrite *tw, PyramidLayer *above,
PyramidLayer **zap, int w, int h )
{
PyramidLayer *layer = IM_NEW( tw->im, PyramidLayer );
PyramidLayer *layer = VIPS_NEW( tw->im, PyramidLayer );
int i;
if( !layer )
@ -626,7 +625,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above,
layer->tif = NULL;
layer->tbuf = NULL;
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) {
for( i = 0; i < MAX_LAYER_BUFFER; i++ ) {
layer->tiles[i].tile = NULL;
layer->tiles[i].bits = PYR_NONE;
}
@ -643,7 +642,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above,
&layer->below, layer->width, layer->height ) )
return( -1 );
if( !(layer->lname = im__temp_name( "%s.tif" )) )
if( !(layer->lname = vips__temp_name( "%s.tif" )) )
return( -1 );
/* Make output image.
@ -656,7 +655,7 @@ build_pyramid( TiffWrite *tw, PyramidLayer *above,
if( write_tiff_header( tw, layer->tif, layer->width, layer->height ) )
return( -1 );
if( !(layer->tbuf = im_malloc( NULL, TIFFTileSize( layer->tif ) )) )
if( !(layer->tbuf = vips_malloc( NULL, TIFFTileSize( layer->tif ) )) )
return( -1 );
return( 0 );
@ -672,24 +671,24 @@ find_new_tile( PyramidLayer *layer )
/* Exisiting buffer we have finished with?
*/
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ )
for( i = 0; i < MAX_LAYER_BUFFER; i++ )
if( layer->tiles[i].bits == PYR_ALL )
return( i );
/* Have to make a new one.
*/
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ )
for( i = 0; i < MAX_LAYER_BUFFER; i++ )
if( !layer->tiles[i].tile ) {
if( !(layer->tiles[i].tile =
im_region_create( layer->tw->im )) )
vips_region_new( layer->tw->im )) )
return( -1 );
im__region_no_ownership( layer->tiles[i].tile );
vips__region_no_ownership( layer->tiles[i].tile );
return( i );
}
/* Out of space!
*/
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "layer buffer exhausted -- "
"try making TIFF output tiles smaller" ) );
@ -699,17 +698,17 @@ find_new_tile( PyramidLayer *layer )
/* Find a tile in the layer buffer - if it's not there, make a new one.
*/
static int
find_tile( PyramidLayer *layer, Rect *pos )
find_tile( PyramidLayer *layer, VipsRect *pos )
{
int i;
Rect quad;
Rect image;
Rect inter;
VipsRect quad;
VipsRect image;
VipsRect inter;
/* Do we have a REGION for this position?
/* Do we have a VipsRegion for this position?
*/
for( i = 0; i < IM_MAX_LAYER_BUFFER; i++ ) {
REGION *reg = layer->tiles[i].tile;
for( i = 0; i < MAX_LAYER_BUFFER; i++ ) {
VipsRegion *reg = layer->tiles[i].tile;
if( reg && reg->valid.left == pos->left &&
reg->valid.top == pos->top )
@ -720,7 +719,7 @@ find_tile( PyramidLayer *layer, Rect *pos )
*/
if( (i = find_new_tile( layer )) < 0 )
return( -1 );
if( im_region_buffer( layer->tiles[i].tile, pos ) )
if( vips_region_buffer( layer->tiles[i].tile, pos ) )
return( -1 );
layer->tiles[i].bits = PYR_NONE;
@ -736,43 +735,43 @@ find_tile( PyramidLayer *layer, Rect *pos )
quad.left = pos->left;
quad.top = pos->top;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_TL;
quad.left = pos->left + quad.width;
quad.top = pos->top;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_TR;
quad.left = pos->left;
quad.top = pos->top + quad.height;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_BL;
quad.left = pos->left + quad.width;
quad.top = pos->top + quad.height;
im_rect_intersectrect( &quad, &image, &inter );
if( im_rect_isempty( &inter ) )
vips_rect_intersectrect( &quad, &image, &inter );
if( vips_rect_isempty( &inter ) )
layer->tiles[i].bits |= PYR_BR;
return( i );
}
/* Shrink a region by a factor of two, writing the result to a specified
* offset in another region. IM_CODING_LABQ only.
* offset in another region. VIPS_CODING_LABQ only.
*/
static void
shrink_region_labpack( REGION *from, Rect *area,
REGION *to, int xoff, int yoff )
shrink_region_labpack( VipsRegion *from, VipsRect *area,
VipsRegion *to, int xoff, int yoff )
{
int ls = IM_REGION_LSKIP( from );
Rect *t = &to->valid;
int ls = VIPS_REGION_LSKIP( from );
VipsRect *t = &to->valid;
int x, y;
Rect out;
VipsRect out;
/* Calculate output size and position.
*/
@ -784,10 +783,9 @@ shrink_region_labpack( REGION *from, Rect *area,
/* Shrink ... ignore the extension byte for speed.
*/
for( y = 0; y < out.height; y++ ) {
PEL *p = (PEL *)
IM_REGION_ADDR( from, area->left, area->top + y * 2 );
PEL *q = (PEL *)
IM_REGION_ADDR( to, out.left, out.top + y );
VipsPel *p = VIPS_REGION_ADDR( from,
area->left, area->top + y * 2 );
VipsPel *q = VIPS_REGION_ADDR( to, out.left, out.top + y );
for( x = 0; x < out.width; x++ ) {
signed char *sp = (signed char *) p;
@ -853,16 +851,16 @@ shrink_region_labpack( REGION *from, Rect *area,
* offset in another region. n-band, non-complex.
*/
static void
shrink_region( REGION *from, Rect *area,
REGION *to, int xoff, int yoff )
shrink_region( VipsRegion *from, VipsRect *area,
VipsRegion *to, int xoff, int yoff )
{
int ls = IM_REGION_LSKIP( from );
int ps = IM_IMAGE_SIZEOF_PEL( from->im );
int ls = VIPS_REGION_LSKIP( from );
int ps = VIPS_IMAGE_SIZEOF_PEL( from->im );
int nb = from->im->Bands;
Rect *t = &to->valid;
VipsRect *t = &to->valid;
int x, y, z;
Rect out;
VipsRect out;
/* Calculate output size and position.
*/
@ -872,29 +870,29 @@ shrink_region( REGION *from, Rect *area,
out.height = area->height / 2;
for( y = 0; y < out.height; y++ ) {
PEL *p = (PEL *)
IM_REGION_ADDR( from, area->left, area->top + y * 2 );
PEL *q = (PEL *)
IM_REGION_ADDR( to, out.left, out.top + y );
VipsPel *p = VIPS_REGION_ADDR( from,
area->left, area->top + y * 2 );
VipsPel *q = VIPS_REGION_ADDR( to,
out.left, out.top + y );
/* Process this line of pels.
*/
switch( from->im->BandFmt ) {
case IM_BANDFMT_UCHAR:
case VIPS_FORMAT_UCHAR:
SHRINK_TYPE_INT( unsigned char ); break;
case IM_BANDFMT_CHAR:
case VIPS_FORMAT_CHAR:
SHRINK_TYPE_INT( signed char ); break;
case IM_BANDFMT_USHORT:
case VIPS_FORMAT_USHORT:
SHRINK_TYPE_INT( unsigned short ); break;
case IM_BANDFMT_SHORT:
case VIPS_FORMAT_SHORT:
SHRINK_TYPE_INT( signed short ); break;
case IM_BANDFMT_UINT:
case VIPS_FORMAT_UINT:
SHRINK_TYPE_INT( unsigned int ); break;
case IM_BANDFMT_INT:
case VIPS_FORMAT_INT:
SHRINK_TYPE_INT( signed int ); break;
case IM_BANDFMT_FLOAT:
case VIPS_FORMAT_FLOAT:
SHRINK_TYPE_FLOAT( float ); break;
case IM_BANDFMT_DOUBLE:
case VIPS_FORMAT_DOUBLE:
SHRINK_TYPE_FLOAT( double ); break;
default:
@ -906,7 +904,7 @@ shrink_region( REGION *from, Rect *area,
/* Write a tile from a layer.
*/
static int
save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area )
save_tile( TiffWrite *tw, TIFF *tif, VipsPel *tbuf, VipsRegion *reg, VipsRect *area )
{
/* Have to repack pixels.
*/
@ -921,7 +919,7 @@ save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area )
/* Write to TIFF! easy.
*/
if( TIFFWriteTile( tif, tbuf, area->left, area->top, 0, 0 ) < 0 ) {
im_error( "vips2tiff", "%s", _( "TIFF write tile failed" ) );
vips_error( "vips2tiff", "%s", _( "TIFF write tile failed" ) );
return( -1 );
}
@ -932,13 +930,13 @@ save_tile( TiffWrite *tw, TIFF *tif, PEL *tbuf, REGION *reg, Rect *area )
* it and recurse.
*/
static int
new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
new_tile( PyramidLayer *layer, VipsRegion *tile, VipsRect *area )
{
TiffWrite *tw = layer->tw;
int xoff, yoff;
int t, ri, bo;
Rect out, new;
VipsRect out, new;
PyramidBits bit;
/* Calculate pos and size of new pixels we make inside this layer.
@ -951,7 +949,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
/* Has size fallen to zero? Can happen if this is a one-pixel-wide
* strip.
*/
if( im_rect_isempty( &new ) )
if( vips_rect_isempty( &new ) )
return( 0 );
/* Offset into this tile ... ie. which quadrant we are writing.
@ -966,8 +964,8 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
/* Clip against edge of image.
*/
ri = IM_MIN( layer->width, out.left + layer->tw->tilew );
bo = IM_MIN( layer->height, out.top + layer->tw->tileh );
ri = VIPS_MIN( layer->width, out.left + layer->tw->tilew );
bo = VIPS_MIN( layer->height, out.top + layer->tw->tileh );
out.width = ri - out.left;
out.height = bo - out.top;
@ -976,7 +974,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
/* Shrink into place.
*/
if( tw->im->Coding == IM_CODING_NONE )
if( tw->im->Coding == VIPS_CODING_NONE )
shrink_region( tile, area,
layer->tiles[t].tile, xoff, yoff );
else
@ -996,7 +994,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
else
bit = PYR_TL;
if( layer->tiles[t].bits & bit ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "internal error #9876345" ) );
return( -1 );
}
@ -1025,7 +1023,7 @@ new_tile( PyramidLayer *layer, REGION *tile, Rect *area )
* generated.
*/
static int
write_tif_tile( REGION *out, void *seq, void *a, void *b, gboolean *stop )
write_tif_tile( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop )
{
TiffWrite *tw = (TiffWrite *) a;
@ -1056,10 +1054,10 @@ write_tif_tile( REGION *out, void *seq, void *a, void *b, gboolean *stop )
static int
write_tif_tilewise( TiffWrite *tw )
{
IMAGE *im = tw->im;
VipsImage *im = tw->im;
g_assert( !tw->tbuf );
if( !(tw->tbuf = im_malloc( NULL, TIFFTileSize( tw->tif ) )) )
if( !(tw->tbuf = vips_malloc( NULL, TIFFTileSize( tw->tif ) )) )
return( -1 );
g_assert( !tw->write_lock );
@ -1080,24 +1078,24 @@ write_tif_tilewise( TiffWrite *tw )
}
static int
write_tif_block( REGION *region, Rect *area, void *a )
write_tif_block( VipsRegion *region, VipsRect *area, void *a )
{
TiffWrite *tw = (TiffWrite *) a;
IMAGE *im = tw->im;
VipsImage *im = tw->im;
int y;
for( y = 0; y < area->height; y++ ) {
PEL *p = (PEL *) IM_REGION_ADDR( region, 0, area->top + y );
VipsPel *p = VIPS_REGION_ADDR( region, 0, area->top + y );
/* Any repacking necessary.
*/
if( im->Coding == IM_CODING_LABQ ) {
if( im->Coding == VIPS_CODING_LABQ ) {
LabQ2LabC( tw->tbuf, p, im->Xsize );
p = tw->tbuf;
}
else if( im->BandFmt == IM_BANDFMT_SHORT &&
im->Type == IM_TYPE_LABS ) {
else if( im->BandFmt == VIPS_FORMAT_SHORT &&
im->Type == VIPS_INTERPRETATION_LABS ) {
LabS2Lab16( tw->tbuf, p, im->Xsize );
p = tw->tbuf;
}
@ -1120,7 +1118,7 @@ write_tif_stripwise( TiffWrite *tw )
{
g_assert( !tw->tbuf );
if( !(tw->tbuf = im_malloc( NULL, TIFFScanlineSize( tw->tif ) )) )
if( !(tw->tbuf = vips_malloc( NULL, TIFFScanlineSize( tw->tif ) )) )
return( -1 );
if( vips_sink_disc( tw->im, write_tif_block, tw ) )
@ -1157,11 +1155,11 @@ free_tiff_write( TiffWrite *tw )
delete_files( tw );
#endif /*DEBUG*/
IM_FREEF( TIFFClose, tw->tif );
IM_FREEF( im_free, tw->tbuf );
IM_FREEF( g_mutex_free, tw->write_lock );
IM_FREEF( free_pyramid, tw->layer );
IM_FREEF( im_free, tw->icc_profile );
VIPS_FREEF( TIFFClose, tw->tif );
VIPS_FREEF( vips_free, tw->tbuf );
VIPS_FREEF( g_mutex_free, tw->write_lock );
VIPS_FREEF( free_pyramid, tw->layer );
VIPS_FREEF( vips_free, tw->icc_profile );
}
/* Round N down to P boundary.
@ -1211,7 +1209,7 @@ get_resunit( VipsForeignTiffResunit resunit )
/* Make and init a TiffWrite.
*/
static TiffWrite *
make_tiff_write( IMAGE *im, const char *filename,
make_tiff_write( VipsImage *im, const char *filename,
VipsForeignTiffCompression compression, int Q,
VipsForeignTiffPredictor predictor,
char *profile,
@ -1223,10 +1221,10 @@ make_tiff_write( IMAGE *im, const char *filename,
{
TiffWrite *tw;
if( !(tw = IM_NEW( im, TiffWrite )) )
if( !(tw = VIPS_NEW( im, TiffWrite )) )
return( NULL );
tw->im = im;
tw->name = im_strdup( im, filename );
tw->name = vips_strdup( VIPS_OBJECT( im ), filename );
tw->bname = NULL;
tw->tif = NULL;
tw->layer = NULL;
@ -1249,13 +1247,13 @@ make_tiff_write( IMAGE *im, const char *filename,
if( (tw->tilew & 0xf) != 0 ||
(tw->tileh & 0xf) != 0 ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "tile size not a multiple of 16" ) );
return( NULL );
}
if( !tw->tile && tw->pyramid ) {
im_warn( "vips2tiff",
vips_warn( "vips2tiff",
"%s", _( "can't have strip pyramid -- "
"enabling tiling" ) );
tw->tile = 1;
@ -1264,9 +1262,9 @@ make_tiff_write( IMAGE *im, const char *filename,
/* We can only pyramid LABQ and non-complex images.
*/
if( tw->pyramid ) {
if( im->Coding == IM_CODING_NONE &&
if( im->Coding == VIPS_CODING_NONE &&
vips_bandfmt_iscomplex( im->BandFmt ) ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "can only pyramid LABQ and "
"non-complex images" ) );
return( NULL );
@ -1276,26 +1274,26 @@ make_tiff_write( IMAGE *im, const char *filename,
/* Only 1-bit-ize 8 bit mono images.
*/
if( tw->onebit ) {
if( im->Coding != IM_CODING_NONE ||
im->BandFmt != IM_BANDFMT_UCHAR ||
if( im->Coding != VIPS_CODING_NONE ||
im->BandFmt != VIPS_FORMAT_UCHAR ||
im->Bands != 1 )
tw->onebit = 0;
}
if( tw->onebit && tw->compression == COMPRESSION_JPEG ) {
im_warn( "vips2tiff",
vips_warn( "vips2tiff",
"%s", _( "can't have 1-bit JPEG -- disabling JPEG" ) );
tw->compression = COMPRESSION_NONE;
}
/* Sizeof a line of bytes in the TIFF tile.
*/
if( im->Coding == IM_CODING_LABQ )
if( im->Coding == VIPS_CODING_LABQ )
tw->tls = tw->tilew * 3;
else if( tw->onebit )
tw->tls = ROUND_UP( tw->tilew, 8 ) / 8;
else
tw->tls = IM_IMAGE_SIZEOF_PEL( im ) * tw->tilew;
tw->tls = VIPS_IMAGE_SIZEOF_PEL( im ) * tw->tilew;
return( tw );
}
@ -1350,7 +1348,7 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in )
if( embed_profile( tw, out ) )
return( -1 );
buf = im_malloc( NULL, TIFFTileSize( in ) );
buf = vips_malloc( NULL, TIFFTileSize( in ) );
n = TIFFNumberOfTiles( in );
for( tile = 0; tile < n; tile++ ) {
tsize_t len;
@ -1362,11 +1360,11 @@ tiff_copy( TiffWrite *tw, TIFF *out, TIFF *in )
len = TIFFReadEncodedTile( in, tile, buf, (tsize_t) -1 );
if( len < 0 ||
TIFFWriteEncodedTile( out, tile, buf, len ) < 0 ) {
im_free( buf );
vips_free( buf );
return( -1 );
}
}
im_free( buf );
vips_free( buf );
return( 0 );
}
@ -1444,7 +1442,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
int res;
#ifdef DEBUG
printf( "im_tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
#endif /*DEBUG*/
/* Override the default TIFF error handler.
@ -1454,22 +1452,21 @@ vips__tiff_write( VipsImage *in, const char *filename,
/* Check input image.
*/
if( im_pincheck( in ) ||
im_check_coding_known( "vips2tiff", in ) )
if( vips_check_coding_known( "vips2tiff", in ) )
return( -1 );
if( in->BandFmt != IM_BANDFMT_UCHAR &&
!(in->BandFmt == IM_BANDFMT_SHORT &&
in->Type == IM_TYPE_LABS) &&
in->BandFmt != IM_BANDFMT_USHORT &&
in->BandFmt != IM_BANDFMT_FLOAT ) {
im_error( "vips2tiff", "%s",
if( in->BandFmt != VIPS_FORMAT_UCHAR &&
!(in->BandFmt == VIPS_FORMAT_SHORT &&
in->Type == VIPS_INTERPRETATION_LABS) &&
in->BandFmt != VIPS_FORMAT_USHORT &&
in->BandFmt != VIPS_FORMAT_FLOAT ) {
vips_error( "vips2tiff", "%s",
_( "unsigned 8-bit int, 16-bit int, "
"and 32-bit float only" ) );
return( -1 );
}
if( in->Coding == IM_CODING_NONE ) {
if( in->Coding == VIPS_CODING_NONE ) {
if( in->Bands < 1 || in->Bands > 5 ) {
im_error( "vips2tiff",
vips_error( "vips2tiff",
"%s", _( "1 to 5 bands only" ) );
return( -1 );
}
@ -1484,7 +1481,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
resunit, xres, yres, bigtiff )) )
return( -1 );
if( tw->pyramid ) {
if( !(tw->bname = im__temp_name( "%s.tif" )) ||
if( !(tw->bname = vips__temp_name( "%s.tif" )) ||
!(tw->tif = tiff_openout( tw, tw->bname )) ) {
free_tiff_write( tw );
return( -1 );
@ -1538,3 +1535,4 @@ vips__tiff_write( VipsImage *in, const char *filename,
return( 0 );
}
#endif /*HAVE_TIFF*/

View File

@ -70,6 +70,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#ifdef HAVE_PNG
#include <stdio.h>
#include <stdlib.h>
@ -686,3 +688,4 @@ vips__png_write_buf( VipsImage *in,
return( 0 );
}
#endif /*HAVE_PNG*/

View File

@ -200,7 +200,7 @@ ideal_bpf( IMAGE *out, double fcx, double fcy, double r )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -270,7 +270,7 @@ ideal_brf( IMAGE *out, double fcx, double fcy, double r )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -363,7 +363,7 @@ butterworth_bpf( IMAGE *out,
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -447,7 +447,7 @@ butterworth_brf( IMAGE *out,
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -525,7 +525,7 @@ gaussian_bpf( IMAGE *out, double fcx, double fcy, double r, double ac )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -605,7 +605,7 @@ gaussian_brf( IMAGE *out, double fcx, double fcy, double r, double ac )
cpline++;
}
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}

View File

@ -73,7 +73,7 @@ copy_quarter( IMAGE *out, float *coeff_s )
*cpline++ = *cpcoeff++;
for( x = out->Xsize/2; x < out->Xsize; x++ )
*cpline++ = *cpcoeff--;
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}
@ -85,7 +85,7 @@ copy_quarter( IMAGE *out, float *coeff_s )
*cpline++ = *cpcoeff++;
for( x = out->Xsize/2; x < out->Xsize; x++ )
*cpline++ = *cpcoeff--;
if( im_writeline( y, out, (PEL *) line ) )
if( im_writeline( y, out, (VipsPel *) line ) )
return( -1 );
}

View File

@ -132,7 +132,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out and normalise. The right half is the up/down and
@ -158,7 +158,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( 0, out, (PEL *) buf ) )
if( im_writeline( 0, out, (VipsPel *) buf ) )
return( -1 );
for( y = 1; y < out->Ysize; y++ ) {
@ -185,7 +185,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -235,7 +235,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out, normalise.
@ -252,7 +252,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -329,7 +329,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out and normalise. The right half is the up/down and
@ -355,7 +355,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( 0, out, (PEL *) buf ) )
if( im_writeline( 0, out, (VipsPel *) buf ) )
return( -1 );
for( y = 1; y < out->Ysize; y++ ) {
@ -382,7 +382,7 @@ rfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -442,7 +442,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (double *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Copy to out, normalise.
@ -459,7 +459,7 @@ cfwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}
@ -540,7 +540,7 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
if( im_setupout( out ) )
return( -1 );
if( !(buf = (float *) IM_ARRAY( dummy,
IM_IMAGE_SIZEOF_LINE( out ), PEL )) )
IM_IMAGE_SIZEOF_LINE( out ), VipsPel )) )
return( -1 );
/* Gather together real and imag parts. We have to normalise output!
@ -555,7 +555,7 @@ fwfft1( IMAGE *dummy, IMAGE *in, IMAGE *out )
q += 2;
}
if( im_writeline( y, out, (PEL *) buf ) )
if( im_writeline( y, out, (VipsPel *) buf ) )
return( -1 );
}

Some files were not shown because too many files have changed in this diff Show More