/* サムネイルを隠す色をロードする */ static bool load_hide_color(void) { int r, g, b; r = get_int_param(RETROSPECT_PARAM_HIDE_R); if (r < 0) { log_script_rgb_negative(r); log_script_exec_footer(); return false; } g = get_int_param(RETROSPECT_PARAM_HIDE_G); if (g < 0) { log_script_rgb_negative(g); log_script_exec_footer(); return false; } b = get_int_param(RETROSPECT_PARAM_HIDE_B); if (b < 0) { log_script_rgb_negative(b); log_script_exec_footer(); return false; } hide_color = make_pixel(0xff, (uint8_t)r, (uint8_t)g, (uint8_t)b); return true; }
int im__arith_binary_const( const char *domain, IMAGE *in, IMAGE *out, int n, double *c, VipsBandFmt vfmt, int format_table[10], im_wrapone_fn fn1, im_wrapone_fn fnn ) { PEL *vector; if( im_piocheck( in, out ) || im_check_vector( domain, n, in ) || im_check_uncoded( domain, in ) ) return( -1 ); if( im_cp_desc( out, in ) ) return( -1 ); out->BandFmt = format_table[in->BandFmt]; /* Some operations need the vector in the input type (eg. * im_equal_vec() where the output type is always uchar and is useless * for comparisons), some need it in the output type (eg. * im_andimage_vec() where we want to get the double to an int so we * can do bitwise-and without having to cast for each pixel), some * need a fixed type (eg. im_powtra_vec(), where we want to keep it as * double). * * Therefore pass in the desired vector type as a param. */ if( !(vector = make_pixel( out, vfmt, n, c )) ) return( -1 ); /* Band-up the input image if we have a >1 vector and * a 1-band image. */ if( n > 1 && out->Bands == 1 ) { IMAGE *t; if( !(t = im_open_local( out, domain, "p" )) || im__bandup( domain, in, t, n ) ) return( -1 ); in = t; } if( n == 1 ) { if( im_wrapone( in, out, fn1, vector, in ) ) return( -1 ); } else { if( im_wrapone( in, out, fnn, vector, in ) ) return( -1 ); } return( 0 ); }
static int vips_unary_const_build( VipsObject *object ) { VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object ); VipsUnary *unary = (VipsUnary *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object; /* If we have a three-element vector we need to bandup the image to * match. */ uconst->n = 1; if( uconst->c ) uconst->n = VIPS_MAX( uconst->n, uconst->c->n ); if( unary->in ) uconst->n = VIPS_MAX( uconst->n, unary->in->Bands ); arithmetic->base_bands = uconst->n; if( unary->in && uconst->c ) { if( vips_check_vector( "VipsRelationalConst", uconst->c->n, unary->in ) ) return( -1 ); } /* Some operations need the vector in the input type (eg. * im_equal_vec() where the output type is always uchar and is useless * for comparisons), some need it in the output type (eg. * im_andimage_vec() where we want to get the double to an int so we * can do bitwise-and without having to cast for each pixel), some * need a fixed type (eg. im_powtra_vec(), where we want to keep it as * double). * * Therefore pass in the desired vector type as a param. */ if( uconst->c ) uconst->c_ready = make_pixel( (VipsObject *) uconst, uconst->n, uconst->const_format, uconst->c->n, (double *) uconst->c->data ); if( VIPS_OBJECT_CLASS( vips_unary_const_parent_class )-> build( object ) ) return( -1 ); return( 0 ); }