Blender
V3.3
|
#include <cerrno>
#include <cstring>
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_vector.hh"
#include "DNA_image_types.h"
#include "MEM_guardedalloc.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_openexr.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_image_format.h"
#include "BKE_image_save.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "RE_pipeline.h"
Go to the source code of this file.
Functions | |
static char | imtype_best_depth (ImBuf *ibuf, const char imtype) |
bool | BKE_image_save_options_init (ImageSaveOptions *opts, Main *bmain, Scene *scene, Image *ima, ImageUser *iuser, const bool guess_path, const bool save_as_render) |
void | BKE_image_save_options_update (ImageSaveOptions *opts, const Image *image) |
void | BKE_image_save_options_free (ImageSaveOptions *opts) |
static void | image_save_update_filepath (Image *ima, const char *filepath, const ImageSaveOptions *opts) |
static void | image_save_post (ReportList *reports, Image *ima, ImBuf *ibuf, int ok, const ImageSaveOptions *opts, int save_copy, const char *filepath, bool *r_colorspace_changed) |
static void | imbuf_save_post (ImBuf *ibuf, ImBuf *colormanaged_ibuf) |
static bool | image_save_single (ReportList *reports, Image *ima, ImageUser *iuser, const ImageSaveOptions *opts, bool *r_colorspace_changed) |
bool | BKE_image_save (ReportList *reports, Main *bmain, Image *ima, ImageUser *iuser, const ImageSaveOptions *opts) |
static float * | image_exr_from_scene_linear_to_output (float *rect, const int width, const int height, const int channels, const ImageFormatData *imf, Vector< float * > &tmp_output_rects) |
bool | BKE_image_render_write_exr (ReportList *reports, const RenderResult *rr, const char *filepath, const ImageFormatData *imf, const bool save_as_render, const char *view, int layer) |
static void | image_render_print_save_message (ReportList *reports, const char *name, int ok, int err) |
static int | image_render_write_stamp_test (ReportList *reports, const Scene *scene, const RenderResult *rr, ImBuf *ibuf, const char *name, const ImageFormatData *imf, const bool stamp) |
bool | BKE_image_render_write (ReportList *reports, RenderResult *rr, const Scene *scene, const bool stamp, const char *filepath_basis) |
bool BKE_image_render_write | ( | ReportList * | reports, |
RenderResult * | rr, | ||
const Scene * | scene, | ||
const bool | stamp, | ||
const char * | filepath_basis | ||
) |
Definition at line 910 of file image_save.cc.
References BKE_image_format_free(), BKE_image_format_init_for_write(), BKE_image_path_ensure_ext_from_imformat(), BKE_image_render_write_exr(), BKE_scene_multiview_view_filepath_get(), BLI_assert, BLI_findstringindex(), BLI_listbase_count_at_most(), BLI_path_extension_check(), ImageFormatData::depth, RenderData::dither_intensity, ELEM, FILE_MAX, ListBase::first, ImageFormatData::flag, image_render_print_save_message(), image_render_write_stamp_test(), IMB_colormanagement_imbuf_for_write(), IMB_freeImBuf(), IMB_stereo3d_ImBuf(), ImageFormatData::imtype, names, ImBuf::planes, Scene::r, R_IMF_CHAN_DEPTH_8, R_IMF_FLAG_PREVIEW_JPG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_MULTILAYER, R_IMF_IMTYPE_OPENEXR, R_IMF_VIEWS_INDIVIDUAL, R_IMF_VIEWS_MULTIVIEW, R_IMF_VIEWS_STEREO_3D, RE_HasFloatPixels(), RE_render_result_rect_to_ibuf(), scene, STEREO_LEFT_NAME, STEREO_RIGHT_NAME, STRNCPY, RenderResult::views, and ImageFormatData::views_format.
bool BKE_image_render_write_exr | ( | ReportList * | reports, |
const RenderResult * | rr, | ||
const char * | filepath, | ||
const ImageFormatData * | imf, | ||
const bool | save_as_render, | ||
const char * | view, | ||
int | layer | ||
) |
Definition at line 702 of file image_save.cc.
References Freestyle::a, BKE_reportf(), BLI_make_existing_file(), BLI_strncpy(), ImageFormatData::depth, ImageFormatData::exr_codec, EXR_PASS_MAXNAME, ListBase::first, ImageFormatData::flag, RenderResult::have_combined, if(), image_exr_from_scene_linear_to_output(), IMB_exr_add_channel(), IMB_exr_add_view(), IMB_exr_begin_write(), IMB_exr_close(), IMB_exr_get_handle(), IMB_exr_write_channels(), ImageFormatData::imtype, RenderResult::layers, LISTBASE_FOREACH, MEM_freeN, RenderView::name, RenderView::next, R_IMF_CHAN_DEPTH_16, R_IMF_FLAG_ZBUF, R_IMF_IMTYPE_OPENEXR, RE_PASSNAME_COMBINED, RE_PASSNAME_Z, RE_render_result_full_channel_name(), RenderResult::rectx, RenderResult::recty, RPT_ERROR, RenderResult::stamp_data, STR_ELEM, STREQ, view, and RenderResult::views.
Referenced by BKE_image_render_write(), and image_save_single().
bool BKE_image_save | ( | ReportList * | reports, |
Main * | bmain, | ||
Image * | ima, | ||
ImageUser * | iuser, | ||
const ImageSaveOptions * | opts | ||
) |
Definition at line 612 of file image_save.cc.
References BKE_image_get_tile_strformat(), BKE_image_set_filepath_from_tile_number(), BKE_image_signal(), BKE_imageuser_default(), BKE_reportf(), ImageSaveOptions::filepath, IMA_SIGNAL_COLORMANAGE, IMA_SRC_TILED, image_save_single(), image_save_update_filepath(), LISTBASE_FOREACH, MEM_freeN, RPT_ERROR, ImageSaveOptions::scene, ImageUser::scene, Image::source, tile, ImageUser::tile, Image::tiles, and UDIM_TILE_FORMAT_NONE.
void BKE_image_save_options_free | ( | ImageSaveOptions * | opts | ) |
Definition at line 241 of file image_save.cc.
References BKE_image_format_free(), and ImageSaveOptions::im_format.
Referenced by ED_image_save_all_modified(), image_save_as_free(), image_save_as_init(), and image_save_exec().
bool BKE_image_save_options_init | ( | ImageSaveOptions * | opts, |
Main * | bmain, | ||
Scene * | scene, | ||
Image * | ima, | ||
ImageUser * | iuser, | ||
const bool | guess_path, | ||
const bool | save_as_render | ||
) |
Definition at line 76 of file image_save.cc.
References BKE_image_acquire_ibuf(), BKE_image_format_color_management_copy_from_scene(), BKE_image_format_from_imbuf(), BKE_image_format_init(), BKE_image_format_init_for_write(), BKE_image_is_multiview(), BKE_image_release_ibuf(), BKE_image_user_file_path_ex(), BKE_imageuser_default(), BKE_main_blendfile_path(), BLI_path_abs(), BLI_path_make_safe(), BLI_snprintf(), BLI_strncpy(), ImageSaveOptions::bmain, ImageFormatData::color_management, COLOR_ROLE_DEFAULT_BYTE, Image::colorspace_settings, ImageFormatData::depth, ELEM, ImageSaveOptions::filepath, G, Image::id, ImageSaveOptions::im_format, RenderData::im_format, IMA_SRC_GENERATED, IMA_SRC_TILED, IMA_SRC_VIEWER, IMB_colormanagement_role_colorspace_name_get(), IMB_colormanagement_space_name_is_data(), ImageFormatData::imtype, imtype_best_depth(), len, ImageFormatData::linear_colorspace_settings, lock, ColorManagedColorspaceSettings::name, ID::name, ImageFormatData::planes, ImageSaveOptions::prev_imtype, ImageSaveOptions::prev_save_as_render, ImageFormatData::quality, Scene::r, R_IMF_COLOR_MANAGEMENT_FOLLOW_SCENE, R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA, ImageSaveOptions::save_as_render, ImageSaveOptions::scene, scene, ImageUser::scene, Image::source, Image::stereo3d_format, ImageFormatData::stereo3d_format, STR_CONCAT, STREQ, STRNCPY, Image::views_format, and ImageFormatData::views_format.
Referenced by ED_image_save_all_modified(), image_save_as_init(), and image_save_exec().
void BKE_image_save_options_update | ( | ImageSaveOptions * | opts, |
const Image * | image | ||
) |
Definition at line 197 of file image_save.cc.
References BKE_color_managed_colorspace_settings_copy(), BKE_image_format_color_management_copy_from_scene(), BKE_image_format_init_for_write(), BKE_imtype_requires_linear_float(), COLOR_ROLE_DEFAULT_BYTE, COLOR_ROLE_DEFAULT_FLOAT, ELEM, ImageSaveOptions::im_format, IMA_TYPE_COMPOSITE, IMA_TYPE_R_RESULT, image(), IMB_colormanagement_role_colorspace_name_get(), IMB_colormanagement_space_name_is_data(), IMB_colormanagement_space_name_is_scene_linear(), ImageFormatData::imtype, ImageFormatData::linear_colorspace_settings, ColorManagedColorspaceSettings::name, ImageSaveOptions::prev_imtype, ImageSaveOptions::prev_save_as_render, ImageSaveOptions::save_as_render, ImageSaveOptions::scene, and STRNCPY.
|
static |
Definition at line 675 of file image_save.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), channels(), COLOR_ROLE_SCENE_LINEAR, height, IMB_colormanagement_role_colorspace_name_get(), IMB_colormanagement_space_name_is_scene_linear(), IMB_colormanagement_transform(), ImageFormatData::linear_colorspace_settings, MEM_dupallocN, ColorManagedColorspaceSettings::name, and width.
Referenced by BKE_image_render_write_exr().
|
static |
Definition at line 875 of file image_save.cc.
References BKE_reportf(), err, and RPT_ERROR.
Referenced by BKE_image_render_write(), and image_render_write_stamp_test().
|
static |
Definition at line 887 of file image_save.cc.
References BKE_imbuf_write(), BKE_imbuf_write_stamp(), image_render_print_save_message(), and scene.
Referenced by BKE_image_render_write().
|
static |
Definition at line 261 of file image_save.cc.
References BKE_color_managed_colorspace_settings_copy(), BKE_color_managed_colorspace_settings_equals(), BKE_imtype_requires_linear_float(), BKE_reportf(), BLI_strncpy(), Image::colorspace_settings, ImageSaveOptions::do_newpath, ELEM, IB_BITMAPDIRTY, IB_rect, IB_rectfloat, IB_zbuf, IB_zbuffloat, ImageSaveOptions::im_format, IMA_SRC_FILE, IMA_SRC_GENERATED, IMA_SRC_TILED, IMA_SRC_VIEWER, IMA_TYPE_IMAGE, IMA_TYPE_R_RESULT, image_save_update_filepath(), imb_freerectfloatImBuf(), imb_freerectImBuf(), IMB_freezbuffloatImBuf(), IMB_freezbufImBuf(), ImageFormatData::imtype, ImageFormatData::linear_colorspace_settings, ImBuf::mall, ColorManagedColorspaceSettings::name, ImBuf::name, ImBuf::rect, ImBuf::rect_float, RPT_ERROR, ImageSaveOptions::save_as_render, Image::source, Image::type, ImBuf::userflags, ImBuf::zbuf, and ImBuf::zbuf_float.
Referenced by image_save_single().
|
static |
ima->filepath
and ibuf->name
should end up the same. ibuf
is important to get the settings. Definition at line 349 of file image_save.cc.
References BKE_image_acquire_ibuf(), BKE_image_acquire_renderresult(), BKE_image_format_to_imbuf(), BKE_image_is_stereo(), BKE_image_multilayer_index(), BKE_image_multiview_index(), BKE_image_release_ibuf(), BKE_image_release_renderresult(), BKE_image_render_write_exr(), BKE_imageuser_default(), BKE_imbuf_alpha_test(), BKE_imbuf_stamp_info(), BKE_imbuf_write_as(), BKE_report(), BKE_reportf(), BKE_scene_multiview_view_filepath_get(), BLI_findlink(), BLI_findstring(), BLI_findstringindex(), BLI_listbase_count(), BLI_listbase_count_at_most(), ELEM, FILE_MAX, ImageSaveOptions::filepath, ImageUser::flag, IB_BITMAPDIRTY, id, if(), ImageSaveOptions::im_format, IMA_SHOW_STEREO, IMA_TYPE_R_RESULT, image_save_post(), IMB_colormanagement_imbuf_for_write(), IMB_dupImBuf(), IMB_freeImBuf(), IMB_stereo3d_ImBuf(), imbuf_save_post(), ImageFormatData::imtype, ImageUser::layer, lock, names, ImBuf::planes, ImageFormatData::planes, Scene::r, R_IMF_IMTYPE_MULTILAYER, R_IMF_IMTYPE_OPENEXR, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA, R_IMF_VIEWS_INDIVIDUAL, R_IMF_VIEWS_MULTIVIEW, R_IMF_VIEWS_STEREO_3D, RE_HasFloatPixels(), ImBuf::rect, ImBuf::rect_float, RPT_ERROR, ImageSaveOptions::save_as_render, ImageSaveOptions::save_copy, ImageSaveOptions::scene, STEREO_LEFT_NAME, STEREO_RIGHT_NAME, Image::type, ImBuf::userflags, view, ImageUser::view, Image::views, RenderResult::views, and ImageFormatData::views_format.
Referenced by BKE_image_save().
|
static |
Definition at line 246 of file image_save.cc.
References BLI_path_rel(), BLI_strncpy(), ImageSaveOptions::bmain, ImageSaveOptions::do_newpath, Image::filepath, Image::id, ID_BLEND_PATH, and ImageSaveOptions::relative.
Referenced by BKE_image_save(), and image_save_post().
Definition at line 329 of file image_save.cc.
References ImBuf::foptions, ImBuf::ftype, IMB_freeImBuf(), and ImBuf::planes.
Referenced by image_save_single().
|
static |
Definition at line 38 of file image_save.cc.
References BKE_imtype_valid_depths(), R_IMF_CHAN_DEPTH_12, R_IMF_CHAN_DEPTH_16, R_IMF_CHAN_DEPTH_24, R_IMF_CHAN_DEPTH_32, R_IMF_CHAN_DEPTH_8, and ImBuf::rect_float.
Referenced by BKE_image_save_options_init().