void tga_write_float_cmap(std::ostream &o, float f, const uint32_t *cmap, const size_t cmap_size) { uint32_t c = 0; if (f == -std::numeric_limits<float>::infinity()) { c = rgba(0, 0, 0, 0); } else if (f == std::numeric_limits<float>::infinity()) { c = rgba(0, 0, 0, 0); } else if (f <= 0) { c = cmap[0]; } else if (f >= 1) { c = cmap[cmap_size - 1]; } else if (f > 0 && f < 1) { size_t idx = f * (cmap_size - 1); float step = 1. / (cmap_size - 1); float rf = fmod(f, step) / step; c = interpolate(cmap[idx], cmap[idx + 1], rf); } WRITE_COLOR(o, c); }
static void write_global_attributes(GString *outstr, gint indent) { /* General Options */ WRITE_NL(); WRITE_BOOL(*options, show_icon_names); WRITE_SEPARATOR(); WRITE_NL(); WRITE_BOOL(*options, tree_descend_subdirs); WRITE_NL(); WRITE_BOOL(*options, view_dir_list_single_click_enter); WRITE_NL(); WRITE_BOOL(*options, lazy_image_sync); WRITE_NL(); WRITE_BOOL(*options, update_on_time_change); WRITE_SEPARATOR(); WRITE_NL(); WRITE_BOOL(*options, progressive_key_scrolling); WRITE_NL(); WRITE_UINT(*options, keyboard_scroll_step); WRITE_NL(); WRITE_UINT(*options, duplicates_similarity_threshold); WRITE_NL(); WRITE_UINT(*options, duplicates_match); WRITE_NL(); WRITE_UINT(*options, duplicates_select_type); WRITE_NL(); WRITE_BOOL(*options, duplicates_thumbnails); WRITE_NL(); WRITE_BOOL(*options, rot_invariant_sim); WRITE_SEPARATOR(); WRITE_NL(); WRITE_BOOL(*options, mousewheel_scrolls); WRITE_NL(); WRITE_BOOL(*options, image_lm_click_nav); WRITE_NL(); WRITE_INT(*options, open_recent_list_maxsize); WRITE_NL(); WRITE_INT(*options, dnd_icon_size); WRITE_NL(); WRITE_BOOL(*options, place_dialogs_under_mouse); WRITE_NL(); WRITE_BOOL(*options, save_window_positions); WRITE_NL(); WRITE_BOOL(*options, use_saved_window_positions_for_new_windows); WRITE_NL(); WRITE_BOOL(*options, tools_restore_state); /* File operations Options */ WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename); WRITE_NL(); WRITE_BOOL(*options, file_ops.confirm_delete); WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_delete_key); WRITE_NL(); WRITE_BOOL(*options, file_ops.safe_delete_enable); WRITE_NL(); WRITE_CHAR(*options, file_ops.safe_delete_path); WRITE_NL(); WRITE_INT(*options, file_ops.safe_delete_folder_maxsize); /* Properties dialog Options */ WRITE_NL(); WRITE_CHAR(*options, properties.tabs_order); /* Image Options */ WRITE_NL(); WRITE_UINT(*options, image.zoom_mode); WRITE_SEPARATOR(); WRITE_NL(); WRITE_BOOL(*options, image.zoom_2pass); WRITE_NL(); WRITE_BOOL(*options, image.zoom_to_fit_allow_expand); WRITE_NL(); WRITE_UINT(*options, image.zoom_quality); WRITE_NL(); WRITE_INT(*options, image.zoom_increment); WRITE_NL(); WRITE_BOOL(*options, image.fit_window_to_image); WRITE_NL(); WRITE_BOOL(*options, image.limit_window_size); WRITE_NL(); WRITE_INT(*options, image.max_window_size); WRITE_NL(); WRITE_BOOL(*options, image.limit_autofit_size); WRITE_NL(); WRITE_INT(*options, image.max_autofit_size); WRITE_NL(); WRITE_UINT(*options, image.scroll_reset_method); WRITE_NL(); WRITE_INT(*options, image.tile_cache_max); WRITE_NL(); WRITE_INT(*options, image.image_cache_max); WRITE_NL(); WRITE_BOOL(*options, image.enable_read_ahead); WRITE_NL(); WRITE_BOOL(*options, image.exif_rotate_enable); WRITE_NL(); WRITE_BOOL(*options, image.use_custom_border_color); WRITE_NL(); WRITE_BOOL(*options, image.use_custom_border_color_in_fullscreen); WRITE_NL(); WRITE_COLOR(*options, image.border_color); WRITE_NL(); WRITE_BOOL(*options, image.use_clutter_renderer); /* Thumbnails Options */ WRITE_NL(); WRITE_INT(*options, thumbnails.max_width); WRITE_NL(); WRITE_INT(*options, thumbnails.max_height); WRITE_NL(); WRITE_BOOL(*options, thumbnails.enable_caching); WRITE_NL(); WRITE_BOOL(*options, thumbnails.cache_into_dirs); WRITE_NL(); WRITE_BOOL(*options, thumbnails.use_xvpics); WRITE_NL(); WRITE_BOOL(*options, thumbnails.spec_standard); WRITE_NL(); WRITE_UINT(*options, thumbnails.quality); WRITE_NL(); WRITE_BOOL(*options, thumbnails.use_exif); /* File sorting Options */ WRITE_NL(); WRITE_INT(*options, file_sort.method); WRITE_NL(); WRITE_BOOL(*options, file_sort.ascending); WRITE_NL(); WRITE_BOOL(*options, file_sort.case_sensitive); WRITE_NL(); WRITE_BOOL(*options, file_sort.natural); /* Fullscreen Options */ WRITE_NL(); WRITE_INT(*options, fullscreen.screen); WRITE_NL(); WRITE_BOOL(*options, fullscreen.clean_flip); WRITE_NL(); WRITE_BOOL(*options, fullscreen.disable_saver); WRITE_NL(); WRITE_BOOL(*options, fullscreen.above); WRITE_SEPARATOR(); /* Image Overlay Options */ WRITE_NL(); WRITE_CHAR(*options, image_overlay.template_string); WRITE_NL(); WRITE_INT(*options, image_overlay.x); WRITE_NL(); WRITE_INT(*options, image_overlay.y); WRITE_NL(); WRITE_INT(*options, image_overlay.text_red); WRITE_NL(); WRITE_INT(*options, image_overlay.text_green); WRITE_NL(); WRITE_INT(*options, image_overlay.text_blue); WRITE_NL(); WRITE_INT(*options, image_overlay.text_alpha); WRITE_NL(); WRITE_INT(*options, image_overlay.background_red); WRITE_NL(); WRITE_INT(*options, image_overlay.background_green); WRITE_NL(); WRITE_INT(*options, image_overlay.background_blue); WRITE_NL(); WRITE_INT(*options, image_overlay.background_alpha); WRITE_NL(); WRITE_CHAR(*options, image_overlay.font); /* Slideshow Options */ WRITE_NL(); WRITE_INT_UNIT(*options, slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION); WRITE_NL(); WRITE_BOOL(*options, slideshow.random); WRITE_NL(); WRITE_BOOL(*options, slideshow.repeat); /* Collection Options */ WRITE_NL(); WRITE_BOOL(*options, collections.rectangular_selection); /* Filtering Options */ WRITE_NL(); WRITE_BOOL(*options, file_filter.show_hidden_files); WRITE_NL(); WRITE_BOOL(*options, file_filter.show_parent_directory); WRITE_NL(); WRITE_BOOL(*options, file_filter.show_dot_directory); WRITE_NL(); WRITE_BOOL(*options, file_filter.disable_file_extension_checks); WRITE_NL(); WRITE_BOOL(*options, file_filter.disable); WRITE_SEPARATOR(); /* Sidecars Options */ WRITE_NL(); WRITE_CHAR(*options, sidecar.ext); /* Shell command */ WRITE_NL(); WRITE_CHAR(*options, shell.path); WRITE_NL(); WRITE_CHAR(*options, shell.options); /* Helpers */ WRITE_NL(); WRITE_CHAR(*options, helpers.html_browser.command_name); WRITE_NL(); WRITE_CHAR(*options, helpers.html_browser.command_line); /* Metadata Options */ WRITE_NL(); WRITE_BOOL(*options, metadata.enable_metadata_dirs); WRITE_NL(); WRITE_BOOL(*options, metadata.save_in_image_file); WRITE_NL(); WRITE_BOOL(*options, metadata.save_legacy_IPTC); WRITE_NL(); WRITE_BOOL(*options, metadata.warn_on_write_problems); WRITE_NL(); WRITE_BOOL(*options, metadata.save_legacy_format); WRITE_NL(); WRITE_BOOL(*options, metadata.sync_grouped_files); WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_write); WRITE_NL(); WRITE_INT(*options, metadata.confirm_timeout); WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_after_timeout); WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_on_image_change); WRITE_NL(); WRITE_BOOL(*options, metadata.confirm_on_dir_change); WRITE_NL(); WRITE_BOOL(*options, metadata.keywords_case_sensitive); WRITE_NL(); WRITE_BOOL(*options, metadata.write_orientation); WRITE_NL(); WRITE_INT(*options, stereo.mode); WRITE_NL(); WRITE_INT(*options, stereo.fsmode); WRITE_NL(); WRITE_BOOL(*options, stereo.enable_fsmode); WRITE_NL(); WRITE_INT(*options, stereo.fixed_w); WRITE_NL(); WRITE_INT(*options, stereo.fixed_h); WRITE_NL(); WRITE_INT(*options, stereo.fixed_x1); WRITE_NL(); WRITE_INT(*options, stereo.fixed_y1); WRITE_NL(); WRITE_INT(*options, stereo.fixed_x2); WRITE_NL(); WRITE_INT(*options, stereo.fixed_y2); }