1 /* base class for all create operations
2  *
3  * properties:
4  * 	- single output image we build
5  */
6 
7 /*
8 
9     Copyright (C) 1991-2005 The National Gallery
10 
11     This library is free software; you can redistribute it and/or
12     modify it under the terms of the GNU Lesser General Public
13     License as published by the Free Software Foundation; either
14     version 2.1 of the License, or (at your option) any later version.
15 
16     This library is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     Lesser General Public License for more details.
20 
21     You should have received a copy of the GNU Lesser General Public
22     License along with this library; if not, write to the Free Software
23     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24     02110-1301  USA
25 
26  */
27 
28 /*
29 
30     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
31 
32  */
33 
34 /*
35 #define DEBUG
36  */
37 
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif /*HAVE_CONFIG_H*/
41 #include <vips/intl.h>
42 
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <math.h>
46 
47 #include <vips/vips.h>
48 #include <vips/internal.h>
49 
50 #include "pcreate.h"
51 #include "point.h"
52 #include "pmask.h"
53 
54 /**
55  * SECTION: create
56  * @short_description: create images in various ways
57  * @stability: Stable
58  * @include: vips/vips.h
59  *
60  * These functions generate various test images. You can combine them with
61  * the arithmetic and rotate functions to build more complicated images.
62  *
63  * The im_benchmark() operations are for testing the VIPS SMP system.
64  */
65 
66 G_DEFINE_ABSTRACT_TYPE( VipsCreate, vips_create, VIPS_TYPE_OPERATION );
67 
68 static int
vips_create_build(VipsObject * object)69 vips_create_build( VipsObject *object )
70 {
71 	VipsCreate *create = VIPS_CREATE( object );
72 
73 #ifdef DEBUG
74 	printf( "vips_create_build: " );
75 	vips_object_print_name( object );
76 	printf( "\n" );
77 #endif /*DEBUG*/
78 
79 	g_object_set( create, "out", vips_image_new(), NULL );
80 
81 	if( VIPS_OBJECT_CLASS( vips_create_parent_class )->build( object ) )
82 		return( -1 );
83 
84 	return( 0 );
85 }
86 
87 static void
vips_create_class_init(VipsCreateClass * class)88 vips_create_class_init( VipsCreateClass *class )
89 {
90 	GObjectClass *gobject_class = G_OBJECT_CLASS( class );
91 	VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
92 
93 	gobject_class->set_property = vips_object_set_property;
94 	gobject_class->get_property = vips_object_get_property;
95 
96 	vobject_class->nickname = "create";
97 	vobject_class->description = _( "create operations" );
98 	vobject_class->build = vips_create_build;
99 
100 	VIPS_ARG_IMAGE( class, "out", 1,
101 		_( "Output" ),
102 		_( "Output image" ),
103 		VIPS_ARGUMENT_REQUIRED_OUTPUT,
104 		G_STRUCT_OFFSET( VipsCreate, out ) );
105 }
106 
107 static void
vips_create_init(VipsCreate * create)108 vips_create_init( VipsCreate *create )
109 {
110 }
111 
112 void
vips_create_operation_init(void)113 vips_create_operation_init( void )
114 {
115 	extern GType vips_black_get_type( void );
116 	extern GType vips_gaussmat_get_type( void );
117 	extern GType vips_logmat_get_type( void );
118 	extern GType vips_gaussnoise_get_type( void );
119 #ifdef HAVE_PANGOCAIRO
120 	extern GType vips_text_get_type( void );
121 #endif /*HAVE_PANGOCAIRO*/
122 	extern GType vips_xyz_get_type( void );
123 	extern GType vips_eye_get_type( void );
124 	extern GType vips_grey_get_type( void );
125 	extern GType vips_zone_get_type( void );
126 	extern GType vips_sines_get_type( void );
127 	extern GType vips_buildlut_get_type( void );
128 	extern GType vips_invertlut_get_type( void );
129 	extern GType vips_tonelut_get_type( void );
130 	extern GType vips_identity_get_type( void );
131 	extern GType vips_mask_butterworth_get_type( void );
132 	extern GType vips_mask_butterworth_ring_get_type( void );
133 	extern GType vips_mask_butterworth_band_get_type( void );
134 	extern GType vips_mask_gaussian_get_type( void );
135 	extern GType vips_mask_gaussian_ring_get_type( void );
136 	extern GType vips_mask_gaussian_band_get_type( void );
137 	extern GType vips_mask_ideal_get_type( void );
138 	extern GType vips_mask_ideal_ring_get_type( void );
139 	extern GType vips_mask_ideal_band_get_type( void );
140 	extern GType vips_mask_fractal_get_type( void );
141 	extern GType vips_fractsurf_get_type( void );
142 	extern GType vips_worley_get_type( void );
143 	extern GType vips_perlin_get_type( void );
144 
145 	vips_black_get_type();
146 	vips_gaussmat_get_type();
147 	vips_logmat_get_type();
148 	vips_gaussnoise_get_type();
149 #ifdef HAVE_PANGOCAIRO
150 	vips_text_get_type();
151 #endif /*HAVE_PANGOCAIRO*/
152 	vips_xyz_get_type();
153 	vips_eye_get_type();
154 	vips_grey_get_type();
155 	vips_zone_get_type();
156 	vips_sines_get_type();
157 	vips_buildlut_get_type();
158 	vips_invertlut_get_type();
159 	vips_tonelut_get_type();
160 	vips_identity_get_type();
161 	vips_mask_ideal_get_type();
162 	vips_mask_ideal_ring_get_type();
163 	vips_mask_ideal_band_get_type();
164 	vips_mask_butterworth_get_type();
165 	vips_mask_butterworth_ring_get_type();
166 	vips_mask_butterworth_band_get_type();
167 	vips_mask_gaussian_get_type();
168 	vips_mask_gaussian_ring_get_type();
169 	vips_mask_gaussian_band_get_type();
170 	vips_mask_fractal_get_type();
171 	vips_fractsurf_get_type();
172 	vips_worley_get_type();
173 	vips_perlin_get_type();
174 }
175 
176