create funcs always make MULTIBAND

Before, they could make B_W for one-band output. This caused problems
with (for example) two black image bandjoined: the second band then
looked like an alpha to hasalpha() and enabled premultiply/unpremultiply
for operations like affine.

Now, it's always MULTIBAND. This is the generic multiband image type, so
you don't get any unexpected alpha handling.
This commit is contained in:
John Cupitt 2018-04-04 09:22:57 +01:00
parent 0dd6b095aa
commit aebb8af803
9 changed files with 18 additions and 12 deletions

View File

@ -11,6 +11,7 @@
- better header sniffing for small files
- drop incompatible ICC profiles before save
- better hasalpha rules
- create funcs always make MULTIBAND (ie. no alpha)
12/3/18 started 8.6.4
- better fitting of fonts with overhanging edges, thanks Adrià

View File

@ -15,6 +15,9 @@
* - gtkdoc
* 31/10/11
* - redo as a class
* 3/4/18
* - always write MULTIBAND, otherwise when we join up these things it'll
* look like we have an alpha
*/
/*
@ -97,8 +100,7 @@ vips_black_build( VipsObject *object )
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,
VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );

View File

@ -134,7 +134,8 @@ vips_gaussmat_build( VipsObject *object )
vips_image_init_fields( create->out,
width, height, 1,
VIPS_FORMAT_DOUBLE, VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
VIPS_FORMAT_DOUBLE, VIPS_CODING_NONE,
VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );

View File

@ -134,7 +134,7 @@ vips_gaussnoise_build( VipsObject *object )
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_INTERPRETATION_MULTIBAND, 1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );

View File

@ -153,7 +153,8 @@ vips_logmat_build( VipsObject *object )
vips_image_init_fields( create->out,
width, height, 1,
VIPS_FORMAT_DOUBLE, VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
VIPS_FORMAT_DOUBLE, VIPS_CODING_NONE,
VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );

View File

@ -249,7 +249,7 @@ vips_perlin_build( VipsObject *object )
vips_image_init_fields( create->out,
perlin->width, perlin->height, 1,
perlin->uchar ? VIPS_FORMAT_UCHAR : VIPS_FORMAT_FLOAT,
VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
VIPS_CODING_NONE, VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );

View File

@ -109,10 +109,9 @@ vips_point_build( VipsObject *object )
return( -1 );
in = t[2];
/* uchar mode always does B_W. We don't want FOURIER or
* whatever in this case.
/* We don't want FOURIER or whatever in this case.
*/
in->Type = VIPS_INTERPRETATION_B_W;
in->Type = VIPS_INTERPRETATION_MULTIBAND;
}
if( vips_image_write( in, create->out ) )
@ -137,7 +136,7 @@ vips_point_class_init( VipsPointClass *class )
class->point = NULL;
class->min = -1.0;
class->max = 1.0;
class->interpretation = VIPS_INTERPRETATION_B_W;
class->interpretation = VIPS_INTERPRETATION_MULTIBAND;
VIPS_ARG_INT( class, "width", 2,
_( "Width" ),

View File

@ -379,7 +379,8 @@ vips_text_build( VipsObject *object )
vips_image_init_fields( create->out,
text->bitmap.width, text->bitmap.rows, 1,
VIPS_FORMAT_UCHAR, VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
VIPS_FORMAT_UCHAR, VIPS_CODING_NONE,
VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );

View File

@ -281,7 +281,8 @@ vips_worley_build( VipsObject *object )
vips_image_init_fields( create->out,
worley->width, worley->height, 1,
VIPS_FORMAT_FLOAT, VIPS_CODING_NONE, VIPS_INTERPRETATION_B_W,
VIPS_FORMAT_FLOAT, VIPS_CODING_NONE,
VIPS_INTERPRETATION_MULTIBAND,
1.0, 1.0 );
vips_image_pipelinev( create->out,
VIPS_DEMAND_STYLE_ANY, NULL );