set Type for new colour classes

This commit is contained in:
John Cupitt 2012-09-18 18:36:48 +01:00
parent 91e52a1ee2
commit 0116c641c6
4 changed files with 11 additions and 0 deletions

View File

@ -135,6 +135,7 @@ vips_Lab2LCh_class_init( VipsLab2LChClass *class )
object_class->description = _( "transform Lab to LCh" ); object_class->description = _( "transform Lab to LCh" );
colour_class->process_line = vips_Lab2LCh_line; colour_class->process_line = vips_Lab2LCh_line;
colour_class->interpretation = VIPS_INTERPRETATION_LCH;
} }
static void static void

View File

@ -168,6 +168,7 @@ vips_Lab2XYZ_class_init( VipsLab2XYZClass *class )
object_class->build = vips_Lab2XYZ_build; object_class->build = vips_Lab2XYZ_build;
colour_class->process_line = vips_Lab2XYZ_line; colour_class->process_line = vips_Lab2XYZ_line;
colour_class->interpretation = VIPS_INTERPRETATION_XYZ;
VIPS_ARG_BOXED( class, "temp", 110, VIPS_ARG_BOXED( class, "temp", 110,
_( "Temperature" ), _( "Temperature" ),

View File

@ -87,6 +87,8 @@ static int
vips_colour_build( VipsObject *object ) vips_colour_build( VipsObject *object )
{ {
VipsColour *colour = VIPS_COLOUR( object ); VipsColour *colour = VIPS_COLOUR( object );
VipsColourClass *class = VIPS_COLOUR_GET_CLASS( colour );
int i; int i;
#ifdef DEBUG #ifdef DEBUG
@ -114,6 +116,7 @@ vips_colour_build( VipsObject *object )
return( -1 ); return( -1 );
vips_demand_hint_array( colour->out, vips_demand_hint_array( colour->out,
VIPS_DEMAND_STYLE_THINSTRIP, colour->in ); VIPS_DEMAND_STYLE_THINSTRIP, colour->in );
out->Type = class->interpretation;
if( vips_image_generate( colour->out, if( vips_image_generate( colour->out,
vips_start_many, vips_colour_gen, vips_stop_many, vips_start_many, vips_colour_gen, vips_stop_many,
@ -139,6 +142,8 @@ vips_colour_class_init( VipsColourClass *class )
operation_class->flags = VIPS_OPERATION_SEQUENTIAL; operation_class->flags = VIPS_OPERATION_SEQUENTIAL;
class->interpretation = VIPS_INTERPRETATION_sRGB;
VIPS_ARG_IMAGE( class, "out", 100, VIPS_ARG_IMAGE( class, "out", 100,
_( "Output" ), _( "Output" ),
_( "Output image" ), _( "Output image" ),

View File

@ -77,6 +77,10 @@ typedef struct _VipsColourClass {
/* The buffer processor. /* The buffer processor.
*/ */
VipsColourProcessFn process_line; VipsColourProcessFn process_line;
/* What to set Type to for this subclass.
*/
VipsInterpretation interpretation;
} VipsColourClass; } VipsColourClass;
GType vips_colour_get_type( void ); GType vips_colour_get_type( void );