diff --git a/configure.ac b/configure.ac
index 76fdac52..eecf9c7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -715,7 +715,7 @@ AC_OUTPUT([
libvips/iofuncs/Makefile
libvips/morphology/Makefile
libvips/mosaicing/Makefile
- libvips/other/Makefile
+ libvips/create/Makefile
libvips/resample/Makefile
libvips/video/Makefile
libvipsCC/include/Makefile
diff --git a/doc/reference/libvips-docs.sgml.in b/doc/reference/libvips-docs.sgml.in
index 68812a36..fd528ebf 100644
--- a/doc/reference/libvips-docs.sgml.in
+++ b/doc/reference/libvips-docs.sgml.in
@@ -44,7 +44,7 @@
-
+
diff --git a/libvips/Makefile.am b/libvips/Makefile.am
index 94c00696..1a39c082 100644
--- a/libvips/Makefile.am
+++ b/libvips/Makefile.am
@@ -25,7 +25,7 @@ SUBDIRS = \
iofuncs \
morphology \
mosaicing \
- other \
+ create \
video \
.
@@ -58,7 +58,7 @@ libvips_la_LIBADD = \
iofuncs/libiofuncs.la \
morphology/libmorphology.la \
mosaicing/libmosaicing.la \
- other/libother.la \
+ create/libcreate.la \
video/libvideo.la \
@VIPS_LIBS@
diff --git a/libvips/conversion/Makefile.am b/libvips/conversion/Makefile.am
index 60636a37..a5dc4e81 100644
--- a/libvips/conversion/Makefile.am
+++ b/libvips/conversion/Makefile.am
@@ -16,13 +16,11 @@ libconversion_la_SOURCES = \
replicate.c \
cast.c \
bandjoin.c \
- black.c \
recomb.c \
bandmean.c \
bandbool.c \
bandary.h \
bandary.c \
- gaussnoise.c \
rot.c \
ifthenelse.c \
im_falsecolour.c \
@@ -31,8 +29,6 @@ libconversion_la_SOURCES = \
scale.c \
wrap.c \
subsample.c \
- text.c \
- xyz.c \
zoom.c
AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
diff --git a/libvips/conversion/conversion.c b/libvips/conversion/conversion.c
index 171352f1..56fcece7 100644
--- a/libvips/conversion/conversion.c
+++ b/libvips/conversion/conversion.c
@@ -1,10 +1,7 @@
/* base class for all conversion operations
*
* properties:
- * - unary, binary or binary with one arg a constant
- * - cast binary args to match
- * - not point-to-point
- * - format, bands etc. can all change
+ * - single output image
*/
/*
diff --git a/libvips/conversion/wrap.c b/libvips/conversion/wrap.c
index 67308403..dd41e7d3 100644
--- a/libvips/conversion/wrap.c
+++ b/libvips/conversion/wrap.c
@@ -112,7 +112,7 @@ vips_wrap_class_init( VipsWrapClass *class )
gobject_class->get_property = vips_object_get_property;
vobject_class->nickname = "wrap";
- vobject_class->description = _( "wrap an image to uchar" );
+ vobject_class->description = _( "wrap image origin" );
vobject_class->build = vips_wrap_build;
VIPS_ARG_IMAGE( class, "in", 1,
diff --git a/libvips/other/Makefile.am b/libvips/create/Makefile.am
similarity index 58%
rename from libvips/other/Makefile.am
rename to libvips/create/Makefile.am
index 8e02d11f..d0152552 100644
--- a/libvips/other/Makefile.am
+++ b/libvips/create/Makefile.am
@@ -1,6 +1,11 @@
-noinst_LTLIBRARIES = libother.la
+noinst_LTLIBRARIES = libcreate.la
-libother_la_SOURCES = \
+libcreate_la_SOURCES = \
+ create.c \
+ xyz.c \
+ black.c \
+ text.c \
+ gaussnoise.c \
im_benchmark.c \
im_eye.c \
im_grey.c \
diff --git a/libvips/conversion/black.c b/libvips/create/black.c
similarity index 91%
rename from libvips/conversion/black.c
rename to libvips/create/black.c
index ea73e2b2..438ea526 100644
--- a/libvips/conversion/black.c
+++ b/libvips/create/black.c
@@ -61,10 +61,10 @@
#include
#include
-#include "conversion.h"
+#include "create.h"
typedef struct _VipsBlack {
- VipsConversion parent_instance;
+ VipsCreate parent_instance;
int width;
int height;
@@ -72,9 +72,9 @@ typedef struct _VipsBlack {
} VipsBlack;
-typedef VipsConversionClass VipsBlackClass;
+typedef VipsCreateClass VipsBlackClass;
-G_DEFINE_TYPE( VipsBlack, vips_black, VIPS_TYPE_CONVERSION );
+G_DEFINE_TYPE( VipsBlack, vips_black, VIPS_TYPE_CREATE );
static int
vips_black_gen( VipsRegion *or, void *seq, void *a, void *b,
@@ -88,22 +88,22 @@ vips_black_gen( VipsRegion *or, void *seq, void *a, void *b,
static int
vips_black_build( VipsObject *object )
{
- VipsConversion *conversion = VIPS_CONVERSION( object );
+ VipsCreate *create = VIPS_CREATE( object );
VipsBlack *black = (VipsBlack *) object;
if( VIPS_OBJECT_CLASS( vips_black_parent_class )->build( object ) )
return( -1 );
- vips_image_init_fields( conversion->out,
+ vips_image_init_fields( create->out,
black->width, black->height, black->bands,
VIPS_FORMAT_UCHAR, VIPS_CODING_NONE,
black->bands == 1 ?
VIPS_INTERPRETATION_B_W : VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
- vips_demand_hint( conversion->out,
+ vips_demand_hint( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );
- if( vips_image_generate( conversion->out,
+ if( vips_image_generate( create->out,
NULL, vips_black_gen, NULL, NULL, NULL ) )
return( -1 );
diff --git a/libvips/create/create.c b/libvips/create/create.c
new file mode 100644
index 00000000..c9129aca
--- /dev/null
+++ b/libvips/create/create.c
@@ -0,0 +1,115 @@
+/* base class for all create operations
+ *
+ * properties:
+ * - single output image we build
+ */
+
+/*
+
+ Copyright (C) 1991-2005 The National Gallery
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA
+
+ */
+
+/*
+
+ These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
+
+ */
+
+/*
+#define DEBUG
+ */
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif /*HAVE_CONFIG_H*/
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+
+#include "create.h"
+
+G_DEFINE_ABSTRACT_TYPE( VipsCreate, vips_create, VIPS_TYPE_OPERATION );
+
+static int
+vips_create_build( VipsObject *object )
+{
+ VipsCreate *create = VIPS_CREATE( object );
+
+#ifdef DEBUG
+ printf( "vips_create_build: " );
+ vips_object_print_name( object );
+ printf( "\n" );
+#endif /*DEBUG*/
+
+ g_object_set( create, "out", vips_image_new(), NULL );
+
+ if( VIPS_OBJECT_CLASS( vips_create_parent_class )->build( object ) )
+ return( -1 );
+
+ return( 0 );
+}
+
+static void
+vips_create_class_init( VipsCreateClass *class )
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS( class );
+ VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
+
+ gobject_class->set_property = vips_object_set_property;
+ gobject_class->get_property = vips_object_get_property;
+
+ vobject_class->nickname = "create";
+ vobject_class->description = _( "create operations" );
+ vobject_class->build = vips_create_build;
+
+ VIPS_ARG_IMAGE( class, "out", 1,
+ _( "Output" ),
+ _( "Output image" ),
+ VIPS_ARGUMENT_REQUIRED_OUTPUT,
+ G_STRUCT_OFFSET( VipsCreate, out ) );
+}
+
+static void
+vips_create_init( VipsCreate *create )
+{
+}
+
+void
+vips_create_operation_init( void )
+{
+ extern GType vips_black_get_type( void );
+ extern GType vips_gaussnoise_get_type( void );
+#ifdef HAVE_PANGOFT2
+ extern GType vips_text_get_type( void );
+#endif /*HAVE_PANGOFT2*/
+ extern GType vips_xyz_get_type( void );
+
+ vips_black_get_type();
+ vips_gaussnoise_get_type();
+#ifdef HAVE_PANGOFT2
+ vips_text_get_type();
+#endif /*HAVE_PANGOFT2*/
+ vips_xyz_get_type();
+}
+
diff --git a/libvips/create/create.h b/libvips/create/create.h
new file mode 100644
index 00000000..aab62414
--- /dev/null
+++ b/libvips/create/create.h
@@ -0,0 +1,79 @@
+/* base class for all create operations
+ */
+
+/*
+
+ Copyright (C) 1991-2005 The National Gallery
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA
+
+ */
+
+/*
+
+ These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
+
+ */
+
+/* We don't want to get confused with the create.h in include, put an
+ * extra _ in there.
+ */
+
+#ifndef VIPS__CREATE_H
+#define VIPS__CREATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /*__cplusplus*/
+
+#define VIPS_TYPE_CREATE (vips_create_get_type())
+#define VIPS_CREATE( obj ) \
+ (G_TYPE_CHECK_INSTANCE_CAST( (obj), \
+ VIPS_TYPE_CREATE, VipsCreate ))
+#define VIPS_CREATE_CLASS( klass ) \
+ (G_TYPE_CHECK_CLASS_CAST( (klass), \
+ VIPS_TYPE_CREATE, VipsCreateClass))
+#define VIPS_IS_CREATE( obj ) \
+ (G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_CREATE ))
+#define VIPS_IS_CREATE_CLASS( klass ) \
+ (G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_CREATE ))
+#define VIPS_CREATE_GET_CLASS( obj ) \
+ (G_TYPE_INSTANCE_GET_CLASS( (obj), \
+ VIPS_TYPE_CREATE, VipsCreateClass ))
+
+typedef struct _VipsCreate {
+ VipsOperation parent_instance;
+
+ /* All have an output image.
+ */
+ VipsImage *out;
+
+} VipsCreate;
+
+typedef struct _VipsCreateClass {
+ VipsOperationClass parent_class;
+
+} VipsCreateClass;
+
+GType vips_create_get_type( void );
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus*/
+
+#endif /*VIPS__CREATE_H*/
+
+
diff --git a/libvips/conversion/gaussnoise.c b/libvips/create/gaussnoise.c
similarity index 93%
rename from libvips/conversion/gaussnoise.c
rename to libvips/create/gaussnoise.c
index 7100d175..2811055d 100644
--- a/libvips/conversion/gaussnoise.c
+++ b/libvips/create/gaussnoise.c
@@ -59,10 +59,10 @@
#include
-#include "conversion.h"
+#include "create.h"
typedef struct _VipsGaussnoise {
- VipsConversion parent_instance;
+ VipsCreate parent_instance;
int width;
int height;
@@ -71,9 +71,9 @@ typedef struct _VipsGaussnoise {
} VipsGaussnoise;
-typedef VipsConversionClass VipsGaussnoiseClass;
+typedef VipsCreateClass VipsGaussnoiseClass;
-G_DEFINE_TYPE( VipsGaussnoise, vips_gaussnoise, VIPS_TYPE_CONVERSION );
+G_DEFINE_TYPE( VipsGaussnoise, vips_gaussnoise, VIPS_TYPE_CREATE );
/* Make a random number in 0 - 1. Prefer random().
*/
@@ -121,20 +121,20 @@ vips_gaussnoise_gen( VipsRegion *or, void *seq, void *a, void *b,
static int
vips_gaussnoise_build( VipsObject *object )
{
- VipsConversion *conversion = VIPS_CONVERSION( object );
+ VipsCreate *create = VIPS_CREATE( object );
VipsGaussnoise *gaussnoise = (VipsGaussnoise *) object;
if( VIPS_OBJECT_CLASS( vips_gaussnoise_parent_class )->build( object ) )
return( -1 );
- vips_image_init_fields( conversion->out,
+ vips_image_init_fields( create->out,
gaussnoise->width, gaussnoise->height, 1,
VIPS_FORMAT_FLOAT, VIPS_CODING_NONE,
VIPS_INTERPRETATION_B_W, 1.0, 1.0 );
- vips_demand_hint( conversion->out,
+ vips_demand_hint( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );
- if( vips_image_generate( conversion->out,
+ if( vips_image_generate( create->out,
NULL, vips_gaussnoise_gen, NULL, gaussnoise, NULL ) )
return( -1 );
diff --git a/libvips/other/im_benchmark.c b/libvips/create/im_benchmark.c
similarity index 100%
rename from libvips/other/im_benchmark.c
rename to libvips/create/im_benchmark.c
diff --git a/libvips/other/im_eye.c b/libvips/create/im_eye.c
similarity index 100%
rename from libvips/other/im_eye.c
rename to libvips/create/im_eye.c
diff --git a/libvips/other/im_grey.c b/libvips/create/im_grey.c
similarity index 100%
rename from libvips/other/im_grey.c
rename to libvips/create/im_grey.c
diff --git a/libvips/other/im_sines.c b/libvips/create/im_sines.c
similarity index 100%
rename from libvips/other/im_sines.c
rename to libvips/create/im_sines.c
diff --git a/libvips/other/im_zone.c b/libvips/create/im_zone.c
similarity index 100%
rename from libvips/other/im_zone.c
rename to libvips/create/im_zone.c
diff --git a/libvips/other/other_dispatch.c b/libvips/create/other_dispatch.c
similarity index 100%
rename from libvips/other/other_dispatch.c
rename to libvips/create/other_dispatch.c
diff --git a/libvips/conversion/text.c b/libvips/create/text.c
similarity index 96%
rename from libvips/conversion/text.c
rename to libvips/create/text.c
index 8dc1cb83..7352c808 100644
--- a/libvips/conversion/text.c
+++ b/libvips/create/text.c
@@ -56,10 +56,10 @@
#include
#include
-#include "conversion.h"
+#include "create.h"
typedef struct _VipsText {
- VipsConversion parent_instance;
+ VipsCreate parent_instance;
char *text;
char *font;
@@ -73,9 +73,9 @@ typedef struct _VipsText {
} VipsText;
-typedef VipsConversionClass VipsTextClass;
+typedef VipsCreateClass VipsTextClass;
-G_DEFINE_TYPE( VipsText, vips_text, VIPS_TYPE_CONVERSION );
+G_DEFINE_TYPE( VipsText, vips_text, VIPS_TYPE_CREATE );
/* Just have one of these and reuse it.
*
@@ -146,7 +146,7 @@ static int
vips_text_build( VipsObject *object )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
- VipsConversion *conversion = VIPS_CONVERSION( object );
+ VipsCreate *create = VIPS_CREATE( object );
VipsText *text = (VipsText *) object;
PangoRectangle logical_rect;
@@ -229,15 +229,15 @@ vips_text_build( VipsObject *object )
g_mutex_unlock( vips_text_lock );
- vips_image_init_fields( conversion->out,
+ vips_image_init_fields( create->out,
text->bitmap.width, text->bitmap.rows, 1,
VIPS_FORMAT_UCHAR, VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
1.0, 1.0 );
- vips_demand_hint( conversion->out,
+ vips_demand_hint( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );
for( y = 0; y < text->bitmap.rows; y++ )
- if( vips_image_write_line( conversion->out, y,
+ if( vips_image_write_line( create->out, y,
(VipsPel *) text->bitmap.buffer +
y * text->bitmap.pitch ) )
return( -1 );
diff --git a/libvips/conversion/xyz.c b/libvips/create/xyz.c
similarity index 94%
rename from libvips/conversion/xyz.c
rename to libvips/create/xyz.c
index fef1b4ec..e8924f15 100644
--- a/libvips/conversion/xyz.c
+++ b/libvips/create/xyz.c
@@ -52,10 +52,10 @@
#include
#include
-#include "conversion.h"
+#include "create.h"
typedef struct _VipsXyz {
- VipsConversion parent_instance;
+ VipsCreate parent_instance;
int width;
int height;
@@ -67,9 +67,9 @@ typedef struct _VipsXyz {
} VipsXyz;
-typedef VipsConversionClass VipsXyzClass;
+typedef VipsCreateClass VipsXyzClass;
-G_DEFINE_TYPE( VipsXyz, vips_xyz, VIPS_TYPE_CONVERSION );
+G_DEFINE_TYPE( VipsXyz, vips_xyz, VIPS_TYPE_CREATE );
static int
vips_xyz_gen( VipsRegion *or, void *seq, void *a, void *b,
@@ -122,7 +122,7 @@ static int
vips_xyz_build( VipsObject *object )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
- VipsConversion *conversion = VIPS_CONVERSION( object );
+ VipsCreate *create = VIPS_CREATE( object );
VipsXyz *xyz = (VipsXyz *) object;
double d;
@@ -158,15 +158,15 @@ vips_xyz_build( VipsObject *object )
}
ysize = d;
- vips_image_init_fields( conversion->out,
+ vips_image_init_fields( create->out,
xyz->width, ysize, xyz->dimensions,
VIPS_FORMAT_UINT, VIPS_CODING_NONE,
VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
- vips_demand_hint( conversion->out,
+ vips_demand_hint( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );
- if( vips_image_generate( conversion->out,
+ if( vips_image_generate( create->out,
NULL, vips_xyz_gen, NULL, xyz, NULL ) )
return( -1 );
diff --git a/libvips/include/vips/Makefile.am b/libvips/include/vips/Makefile.am
index 8d318fee..837cefff 100644
--- a/libvips/include/vips/Makefile.am
+++ b/libvips/include/vips/Makefile.am
@@ -27,7 +27,7 @@ pkginclude_HEADERS = \
memory.h \
morphology.h \
mosaicing.h \
- other.h \
+ create.h \
video.h \
cimg_funcs.h \
object.h \
diff --git a/libvips/include/vips/conversion.h b/libvips/include/vips/conversion.h
index a4e20009..8dd65a5d 100644
--- a/libvips/include/vips/conversion.h
+++ b/libvips/include/vips/conversion.h
@@ -250,15 +250,6 @@ int vips_bandeor( VipsImage *in, VipsImage **out, ... )
int vips_recomb( VipsImage *in, VipsImage **out, VipsImage *m, ... )
__attribute__((sentinel));
-int vips_black( VipsImage **out, int width, int height, ... )
- __attribute__((sentinel));
-int vips_xyz( VipsImage **out, int width, int height, ... )
- __attribute__((sentinel));
-int vips_text( VipsImage **out, const char *text, ... )
- __attribute__((sentinel));
-int vips_gaussnoise( VipsImage **out, int width, int height, ... )
- __attribute__((sentinel));
-
int vips_ifthenelse( VipsImage *cond, VipsImage *in1, VipsImage *in2,
VipsImage **out, ... )
__attribute__((sentinel));
diff --git a/libvips/include/vips/other.h b/libvips/include/vips/create.h
similarity index 76%
rename from libvips/include/vips/other.h
rename to libvips/include/vips/create.h
index 1ffcbe1c..07ee6faa 100644
--- a/libvips/include/vips/other.h
+++ b/libvips/include/vips/create.h
@@ -1,4 +1,4 @@
-/* other.h
+/* create.h
*
* 20/9/09
* - from proto.h
@@ -31,13 +31,27 @@
*/
-#ifndef IM_OTHER_H
-#define IM_OTHER_H
+#ifndef VIPS_CREATE_H
+#define VIPS_CREATE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
+void vips_create_operation_init( void );
+
+int vips_black( VipsImage **out, int width, int height, ... )
+ __attribute__((sentinel));
+int vips_xyz( VipsImage **out, int width, int height, ... )
+ __attribute__((sentinel));
+int vips_text( VipsImage **out, const char *text, ... )
+ __attribute__((sentinel));
+int vips_gaussnoise( VipsImage **out, int width, int height, ... )
+ __attribute__((sentinel));
+
+
+
+
int im_grey( VipsImage *out, const int xsize, const int ysize );
int im_fgrey( VipsImage *out, const int xsize, const int ysize );
@@ -57,4 +71,4 @@ int im_benchmark2( VipsImage *in, double *out );
}
#endif /*__cplusplus*/
-#endif /*IM_OTHER_H*/
+#endif /*VIPS_CREATE_H*/
diff --git a/libvips/include/vips/vips.h b/libvips/include/vips/vips.h
index 3dcb1dd8..d5df3b4f 100644
--- a/libvips/include/vips/vips.h
+++ b/libvips/include/vips/vips.h
@@ -134,7 +134,7 @@ extern "C" {
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c
index 4b74e740..9954a224 100644
--- a/libvips/iofuncs/init.c
+++ b/libvips/iofuncs/init.c
@@ -245,6 +245,7 @@ vips_init( const char *argv0 )
(void) vips_system_get_type();
vips_arithmetic_operation_init();
vips_conversion_operation_init();
+ vips_create_operation_init();
vips_foreign_operation_init();
vips_resample_operation_init();
vips_colour_operation_init();