Blender V5.0
BKE_image_format.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include <cstddef>
12
13#include "BKE_path_templates.hh"
14
15struct BlendDataReader;
16struct BlendWriter;
17struct ID;
18struct ImbFormatOptions;
19struct ImageFormatData;
20struct ImBuf;
21struct Scene;
22struct RenderData;
23
24/* Init/Copy/Free */
25
27void BKE_image_format_copy(ImageFormatData *imf_dst, const ImageFormatData *imf_src);
29
30/* Updates the color space of the given image format based on its image type. This can be used to
31 * set a good default color space when the user changes the image type. See the implementation for
32 * more information on the logic. */
34
37
38/* Sets the media type of the given format that belongs to the given ID. This involves updating the
39 * imtype to a default format if it does not match the newly set media type. */
41 ID *owner_id,
42 const MediaType media_type);
43void BKE_image_format_set(ImageFormatData *imf, ID *owner_id, const char imtype);
44
45/* File Paths */
46
55 char *filepath,
56 const char *base,
57 const char *relbase,
58 const blender::bke::path_templates::VariableMap *template_variables,
59 int frame,
61 bool use_ext,
62 bool use_frames,
63 const char *suffix);
65 char *filepath,
66 const char *base,
67 const char *relbase,
68 const blender::bke::path_templates::VariableMap *template_variables,
69 int frame,
70 char imtype,
71 bool use_ext,
72 bool use_frames,
73 const char *suffix);
74
79#define BKE_IMAGE_PATH_EXT_MAX 3
88 const char *r_ext[BKE_IMAGE_PATH_EXT_MAX]);
89int BKE_image_path_ext_from_imtype(const char imtype, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX]);
90
92 size_t filepath_maxncpy,
94int BKE_image_path_ext_from_imtype_ensure(char *filepath, size_t filepath_maxncpy, char imtype);
95
96/* File Types */
97
98#define IMA_CHAN_FLAG_BW 1
99#define IMA_CHAN_FLAG_RGB 2
100#define IMA_CHAN_FLAG_RGBA 4
101
102char BKE_ftype_to_imtype(int ftype, const ImbFormatOptions *options);
103int BKE_imtype_to_ftype(char imtype, ImbFormatOptions *r_options);
104
105/* Returns true if the given imtype represents an image. This excludes multi-layer images, use
106 * BKE_imtype_is_multi_layer_image to detect those images. */
107bool BKE_imtype_is_image(char imtype);
108/* Returns true if the given imtype represents a multi-layer image. */
109bool BKE_imtype_is_multi_layer_image(char imtype);
110bool BKE_imtype_is_movie(char imtype);
111bool BKE_imtype_supports_compress(char imtype);
112bool BKE_imtype_supports_quality(char imtype);
113bool BKE_imtype_requires_linear_float(char imtype);
114char BKE_imtype_valid_channels(char imtype);
115char BKE_imtype_valid_depths(char imtype);
116char BKE_imtype_valid_depths_with_video(char imtype, const ID *owner_id);
117char BKE_imtype_first_valid_depth(const char valid_depths);
118
123char BKE_imtype_from_arg(const char *imtype_arg);
124
125/* Conversion between #ImBuf settings. */
126
128void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf);
129
131
132/* Color Management */
133
136
137/* Image Output
138 *
139 * Initialize an image format that can be used for file writing, including
140 * color management settings from the scene. */
141
143 const Scene *scene_src,
144 const ImageFormatData *imf_src,
145 const bool allow_video = false);
void BKE_image_format_free(ImageFormatData *imf)
blender::Vector< blender::bke::path_templates::Error > BKE_image_path_from_imtype(char *filepath, const char *base, const char *relbase, const blender::bke::path_templates::VariableMap *template_variables, int frame, char imtype, bool use_ext, bool use_frames, const char *suffix)
void BKE_image_format_color_management_copy(ImageFormatData *imf, const ImageFormatData *imf_src)
bool BKE_imtype_is_image(char imtype)
void BKE_image_format_from_imbuf(ImageFormatData *im_format, const ImBuf *imbuf)
char BKE_imtype_valid_channels(char imtype)
int BKE_image_path_ext_from_imformat(const ImageFormatData *im_format, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX])
void BKE_image_format_blend_write(BlendWriter *writer, ImageFormatData *imf)
void BKE_image_format_blend_read_data(BlendDataReader *reader, ImageFormatData *imf)
int BKE_image_path_ext_from_imformat_ensure(char *filepath, size_t filepath_maxncpy, const ImageFormatData *im_format)
char BKE_imtype_from_arg(const char *imtype_arg)
void BKE_image_format_set(ImageFormatData *imf, ID *owner_id, const char imtype)
char BKE_imtype_first_valid_depth(const char valid_depths)
char BKE_ftype_to_imtype(int ftype, const ImbFormatOptions *options)
void BKE_image_format_update_color_space_for_type(ImageFormatData *format)
#define BKE_IMAGE_PATH_EXT_MAX
int BKE_image_path_ext_from_imtype(const char imtype, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX])
int BKE_image_path_ext_from_imtype_ensure(char *filepath, size_t filepath_maxncpy, char imtype)
bool BKE_imtype_is_multi_layer_image(char imtype)
void BKE_image_format_media_type_set(ImageFormatData *format, ID *owner_id, const MediaType media_type)
bool BKE_imtype_supports_compress(char imtype)
blender::Vector< blender::bke::path_templates::Error > BKE_image_path_from_imformat(char *filepath, const char *base, const char *relbase, const blender::bke::path_templates::VariableMap *template_variables, int frame, const ImageFormatData *im_format, bool use_ext, bool use_frames, const char *suffix)
void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf)
void BKE_image_format_init_for_write(ImageFormatData *imf, const Scene *scene_src, const ImageFormatData *imf_src, const bool allow_video=false)
bool BKE_imtype_supports_quality(char imtype)
void BKE_image_format_color_management_copy_from_scene(ImageFormatData *imf, const Scene *scene)
char BKE_imtype_valid_depths(char imtype)
int BKE_imtype_to_ftype(char imtype, ImbFormatOptions *r_options)
bool BKE_imtype_is_movie(char imtype)
bool BKE_image_format_is_byte(const ImageFormatData *imf)
void BKE_image_format_init(ImageFormatData *imf)
bool BKE_imtype_requires_linear_float(char imtype)
void BKE_image_format_copy(ImageFormatData *imf_dst, const ImageFormatData *imf_src)
char BKE_imtype_valid_depths_with_video(char imtype, const ID *owner_id)
Functions and classes for evaluating template expressions in filepaths.
MediaType
CCL_NAMESPACE_BEGIN struct Options options
format
Definition DNA_ID.h:414
struct ImageFormatData im_format