70
70
VipsPoint *point = (VipsPoint *) a;
71
71
VipsPointClass *class = VIPS_POINT_GET_CLASS( point );
72
72
VipsRect *r = &or->valid;
75
int ri = VIPS_RECT_RIGHT( r );
76
int bo = VIPS_RECT_BOTTOM( r );
80
for( y = to; y < bo; y++ ) {
81
float *q = (float *) VIPS_REGION_ADDR( or, le, y );
76
for( y = 0; y < r->height; y++ ) {
78
float *q = (float *) VIPS_REGION_ADDR( or, r->left, ay );
83
for( x = le; x < ri; x++ )
84
*q++ = class->point( point, x, y );
80
for( x = 0; x < r->width; x++ )
81
q[x] = class->point( point, r->left + x, ay );
91
88
vips_point_build( VipsObject *object )
93
90
VipsCreate *create = VIPS_CREATE( object );
94
VipsPoint *point = (VipsPoint *) object;
95
VipsImage **t = (VipsImage **) vips_object_local_array( object, 3 );
91
VipsPoint *point = VIPS_POINT( object );
92
VipsPointClass *class = VIPS_POINT_GET_CLASS( point );
93
VipsImage **t = (VipsImage **) vips_object_local_array( object, 4 );
98
97
if( VIPS_OBJECT_CLASS( vips_point_parent_class )->build( object ) )
101
100
t[0] = vips_image_new();
102
101
vips_image_init_fields( t[0],
103
102
point->width, point->height, 1,
104
VIPS_FORMAT_FLOAT, VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
103
VIPS_FORMAT_FLOAT, VIPS_CODING_NONE, class->interpretation,
106
vips_demand_hint( t[0],
105
vips_image_pipelinev( t[0],
107
106
VIPS_DEMAND_STYLE_ANY, NULL );
108
107
if( vips_image_generate( t[0],
109
108
NULL, vips_point_gen, NULL, point, NULL ) )
113
112
if( point->uchar ) {
114
if( vips_linear1( in, &t[1], 127.5, 127.5, NULL ) ||
115
vips_cast( t[1], &t[2], VIPS_FORMAT_UCHAR, NULL ) )
113
float min = class->min;
114
float max = class->max;
115
float range = max - min;
117
if( vips_linear1( in, &t[2],
118
255.0 / range, -min * 255.0 / range,
124
/* uchar mode always does B_W. We don't want FOURIER or
125
* whatever in this case.
127
in->Type = VIPS_INTERPRETATION_B_W;
120
130
if( vips_image_write( in, create->out ) )
136
146
vobject_class->description = _( "make a point image" );
137
147
vobject_class->build = vips_point_build;
152
class->interpretation = VIPS_INTERPRETATION_B_W;
139
154
VIPS_ARG_INT( class, "width", 2,
141
156
_( "Image width in pixels" ),
150
165
G_STRUCT_OFFSET( VipsPoint, height ),
153
VIPS_ARG_BOOL( class, "uchar", 7,
168
VIPS_ARG_BOOL( class, "uchar", 4,
155
170
_( "Output an unsigned char image" ),
156
171
VIPS_ARGUMENT_OPTIONAL_INPUT,