File: create.c

package info (click to toggle)
vips 8.14.1-3%2Bdeb12u2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 35,912 kB
  • sloc: ansic: 165,449; cpp: 10,987; python: 4,462; xml: 4,212; sh: 471; perl: 40; makefile: 23
file content (188 lines) | stat: -rw-r--r-- 5,413 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* 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 <config.h>
#endif /*HAVE_CONFIG_H*/
#include <glib/gi18n-lib.h>

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include <vips/vips.h>
#include <vips/internal.h>

#include "pcreate.h"
#include "point.h"
#include "pmask.h"

/** 
 * SECTION: create
 * @short_description: create images in various ways
 * @stability: Stable
 * @include: vips/vips.h
 *
 * These functions generate various test images. You can combine them with
 * the arithmetic and rotate functions to build more complicated images.
 *
 * The im_benchmark() operations are for testing the VIPS SMP system.
 */

/** 
 * VipsTextWrap:
 * @VIPS_TEXT_WRAP_WORD: wrap at word boundaries
 * @VIPS_TEXT_WRAP_CHAR: wrap at character boundaries
 * @VIPS_TEXT_WRAP_WORD_CHAR: wrap at word boundaries, but fall back to character boundaries if there is not enough space for a full word
 * @VIPS_TEXT_WRAP_NONE: no wrapping
 *
 * Sets the word wrapping style for vips_text() when used with a maximum
 * width.
 *
 * See also: vips_text().
 */

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_gaussmat_get_type( void ); 
	extern GType vips_logmat_get_type( void ); 
	extern GType vips_gaussnoise_get_type( void ); 
#ifdef HAVE_PANGOCAIRO
	extern GType vips_text_get_type( void ); 
#endif /*HAVE_PANGOCAIRO*/
	extern GType vips_xyz_get_type( void ); 
	extern GType vips_eye_get_type( void ); 
	extern GType vips_grey_get_type( void ); 
	extern GType vips_zone_get_type( void ); 
	extern GType vips_sines_get_type( void ); 
	extern GType vips_buildlut_get_type( void ); 
	extern GType vips_invertlut_get_type( void ); 
	extern GType vips_tonelut_get_type( void ); 
	extern GType vips_identity_get_type( void ); 
	extern GType vips_mask_butterworth_get_type( void ); 
	extern GType vips_mask_butterworth_ring_get_type( void ); 
	extern GType vips_mask_butterworth_band_get_type( void ); 
	extern GType vips_mask_gaussian_get_type( void ); 
	extern GType vips_mask_gaussian_ring_get_type( void ); 
	extern GType vips_mask_gaussian_band_get_type( void ); 
	extern GType vips_mask_ideal_get_type( void ); 
	extern GType vips_mask_ideal_ring_get_type( void ); 
	extern GType vips_mask_ideal_band_get_type( void ); 
	extern GType vips_mask_fractal_get_type( void ); 
	extern GType vips_fractsurf_get_type( void ); 
	extern GType vips_worley_get_type( void ); 
	extern GType vips_perlin_get_type( void ); 

	vips_black_get_type();
	vips_gaussmat_get_type();
	vips_logmat_get_type();
	vips_gaussnoise_get_type(); 
#ifdef HAVE_PANGOCAIRO
	vips_text_get_type(); 
#endif /*HAVE_PANGOCAIRO*/
	vips_xyz_get_type(); 
	vips_eye_get_type(); 
	vips_grey_get_type(); 
	vips_zone_get_type(); 
	vips_sines_get_type(); 
	vips_buildlut_get_type(); 
	vips_invertlut_get_type(); 
	vips_tonelut_get_type(); 
	vips_identity_get_type(); 
	vips_mask_ideal_get_type(); 
	vips_mask_ideal_ring_get_type(); 
	vips_mask_ideal_band_get_type(); 
	vips_mask_butterworth_get_type(); 
	vips_mask_butterworth_ring_get_type(); 
	vips_mask_butterworth_band_get_type(); 
	vips_mask_gaussian_get_type(); 
	vips_mask_gaussian_ring_get_type(); 
	vips_mask_gaussian_band_get_type(); 
	vips_mask_fractal_get_type(); 
	vips_fractsurf_get_type(); 
	vips_worley_get_type(); 
	vips_perlin_get_type(); 
}