/* Print header, or parts of header. */ static int print_header( IMAGE *im, gboolean many ) { if( !main_option_field ) { printf( "%s: ", im->filename ); vips_object_print_summary( VIPS_OBJECT( im ) ); if( main_option_all ) (void) vips_image_map( im, print_field_fn, &many ); } else if( strcmp( main_option_field, "getext" ) == 0 ) { if( im__has_extension_block( im ) ) { void *buf; int size; if( !(buf = im__read_extension_block( im, &size )) ) return( -1 ); printf( "%s", (char *) buf ); im_free( buf ); } } else if( strcmp( main_option_field, "Hist" ) == 0 ) printf( "%s", im_history_get( im ) ); else { GValue value = { 0 }; GType type; if( im_header_get( im, main_option_field, &value ) ) return( -1 ); /* Display the save form, if there is one. This way we display * something useful for ICC profiles, xml fields, etc. */ type = G_VALUE_TYPE( &value ); if( g_value_type_transformable( type, IM_TYPE_SAVE_STRING ) ) { GValue save_value = { 0 }; g_value_init( &save_value, IM_TYPE_SAVE_STRING ); if( !g_value_transform( &value, &save_value ) ) return( -1 ); printf( "%s\n", im_save_string_get( &save_value ) ); g_value_unset( &save_value ); } else { char *str_value; str_value = g_strdup_value_contents( &value ); printf( "%s\n", str_value ); g_free( str_value ); } g_value_unset( &value ); } return( 0 ); }
static void imageheader_refresh( Imageheader *imageheader ) { gtk_list_store_clear( imageheader->store ); if( imageheader->iimage && imageheader->iimage->value.ii ) { Imageinfo *ii = imageheader->iimage->value.ii; IMAGE *im = imageinfo_get( FALSE, ii ); im_header_map( im, (im_header_map_fn) imageheader_add_item, imageheader ); gtk_text_buffer_set_text( gtk_text_view_get_buffer( GTK_TEXT_VIEW( imageheader->history ) ), im_history_get( im ), -1 ); } else { gtk_editable_delete_text( GTK_EDITABLE( imageheader->history ), 0, -1 ); } }
void im_printdesc( IMAGE *image ) { if( !image ) { printf( "NULL descriptor\n" ); return; } printf( "IMAGE* %p\n", image ); if( im_isMSBfirst( image ) ) printf( "SPARC (MSB first) " ); else printf( "Intel (LSB first) " ); printf( "byte order image, on a " ); if( im_amiMSBfirst() ) printf( "SPARC (MSB first) " ); else printf( "Intel (LSB first) " ); printf( "byte order machine\n" ); (void) im_header_map( image, (im_header_map_fn) print_field_fn, NULL ); printf( "Hist: %s", im_history_get( image ) ); /* Print other (non-header) fields. */ if( image->generate ) printf( "generate function attached\n" ); if( image->closefns ) printf( "close callbacks attached\n" ); if( image->evalfns ) printf( "eval callbacks attached\n" ); if( image->evalendfns ) printf( "evalend callbacks attached\n" ); if( image->evalstartfns ) printf( "evalstart callbacks attached\n" ); if( image->preclosefns ) printf( "preclose callbacks attached\n" ); if( image->invalidatefns ) printf( "invalidate callbacks attached\n" ); if( image->regions ) { printf( "%d regions present\n", g_slist_length( image->regions ) ); im_slist_map2( image->regions, (VSListMap2Fn) print_region, NULL, NULL ); } if( image->kill ) printf( "kill flag set\n" ); if( image->closing ) printf( "closing flag set\n" ); if( image->close_pending ) printf( "close_pending flag set\n" ); #ifdef DEBUG /* Can't get these with im_header_get(), so only show for debugging. */ printf( "dhint: %s\n", im_dhint2char( image->dhint ) ); printf( "dtype: %s\n", im_dtype2char( image->dtype ) ); #endif /*DEBUG*/ }