Blender V5.3
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
15namespace blender {
16
17struct BlendDataReader;
18struct BlendWriter;
19struct ID;
20struct ImbFormatOptions;
21struct ImageFormatData;
22struct ImBuf;
23struct Scene;
24struct RenderData;
25enum eImbFileType : int8_t;
26
27/* Init/Copy/Free */
28
30void BKE_image_format_copy(ImageFormatData *imf_dst, const ImageFormatData *imf_src);
32
33/* Updates the color space of the given image format based on its image type. This can be used to
34 * set a good default color space when the user changes the image type. See the implementation for
35 * more information on the logic. */
37
40
41/* Sets the media type of the given format that belongs to the given ID. This involves updating the
42 * imtype to a default format if it does not match the newly set media type. */
44 ID *owner_id,
45 const MediaType media_type);
46void BKE_image_format_set(ImageFormatData *imf, ID *owner_id, const char imtype);
47
48/* File Paths */
49
58 char *filepath,
59 const char *base,
60 const char *relbase,
61 const bke::path_templates::VariableMap *template_variables,
62 int frame,
63 const ImageFormatData *im_format,
64 bool use_ext,
65 bool use_frames,
66 const char *suffix);
68 char *filepath,
69 const char *base,
70 const char *relbase,
71 const bke::path_templates::VariableMap *template_variables,
72 int frame,
73 char imtype,
74 bool use_ext,
75 bool use_frames,
76 const char *suffix);
77
82#define BKE_IMAGE_PATH_EXT_MAX 3
90int BKE_image_path_ext_from_imformat(const ImageFormatData *im_format,
91 const char *r_ext[BKE_IMAGE_PATH_EXT_MAX]);
92int BKE_image_path_ext_from_imtype(const char imtype, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX]);
93
95 size_t filepath_maxncpy,
96 const ImageFormatData *im_format);
97int BKE_image_path_ext_from_imtype_ensure(char *filepath, size_t filepath_maxncpy, char imtype);
98
99/* File Types */
100
101#define IMA_CHAN_FLAG_BW 1
102#define IMA_CHAN_FLAG_RGB 2
103#define IMA_CHAN_FLAG_RGBA 4
104
105char BKE_ftype_to_imtype(eImbFileType ftype, const ImbFormatOptions *options);
106eImbFileType BKE_imtype_to_ftype(char imtype, ImbFormatOptions *r_options);
107
108/* Returns true if the given imtype represents an image. This excludes multi-layer images, use
109 * BKE_imtype_is_multi_layer_image to detect those images. */
110bool BKE_imtype_is_image(char imtype);
111/* Returns true if the given imtype represents a multi-layer image. */
112bool BKE_imtype_is_multi_layer_image(char imtype);
113bool BKE_imtype_is_movie(char imtype);
114bool BKE_imtype_supports_compress(char imtype);
115bool BKE_imtype_supports_quality(char imtype);
116bool BKE_imtype_requires_linear_float(char imtype);
117char BKE_imtype_valid_channels(char imtype);
119eImageFormatDepth BKE_imtype_valid_depths_with_video(char imtype, const ID *owner_id);
121
126char BKE_imtype_from_arg(const char *imtype_arg);
127
128/* Conversion between #ImBuf settings. */
129
130void BKE_image_format_from_imbuf(ImageFormatData *im_format, const ImBuf *imbuf);
131void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf);
132
133bool BKE_image_format_is_byte(const ImageFormatData *imf);
134
135/* Color Management */
136
137void BKE_image_format_color_management_copy(ImageFormatData *imf, const ImageFormatData *imf_src);
138void BKE_image_format_color_management_copy_from_scene(ImageFormatData *imf, const Scene *scene);
139
140/* Image Output
141 *
142 * Initialize an image format that can be used for file writing, including
143 * color management settings from the scene. */
144
145void BKE_image_format_init_for_write(ImageFormatData *imf,
146 const Scene *scene_src,
147 const ImageFormatData *imf_src,
148 const bool allow_video = false);
149
150} // namespace blender
#define BKE_IMAGE_PATH_EXT_MAX
Functions and classes for evaluating template expressions in filepaths.
Definition scene.h:133
CCL_NAMESPACE_BEGIN struct Options options
BMesh Iterators.
bool BKE_image_format_is_byte(const ImageFormatData *imf)
void BKE_image_format_set(ImageFormatData *imf, ID *owner_id, const char imtype)
void BKE_image_format_media_type_set(ImageFormatData *format, ID *owner_id, const MediaType media_type)
void BKE_image_format_color_management_copy_from_scene(ImageFormatData *imf, const Scene *scene)
void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf)
void BKE_image_format_blend_write(BlendWriter *writer, ImageFormatData *imf)
eImbFileType BKE_imtype_to_ftype(char imtype, ImbFormatOptions *r_options)
Vector< bke::path_templates::Error > BKE_image_path_from_imformat(char *filepath, const char *base, const char *relbase, const bke::path_templates::VariableMap *template_variables, int frame, const ImageFormatData *im_format, bool use_ext, bool use_frames, const char *suffix)
bool BKE_imtype_is_multi_layer_image(char imtype)
void BKE_image_format_from_imbuf(ImageFormatData *im_format, const ImBuf *imbuf)
bool BKE_imtype_supports_compress(char imtype)
bool BKE_imtype_is_image(char imtype)
int BKE_image_path_ext_from_imtype(const char imtype, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX])
void BKE_image_format_blend_read_data(BlendDataReader *reader, ImageFormatData *imf)
bool BKE_imtype_supports_quality(char imtype)
int BKE_image_path_ext_from_imformat_ensure(char *filepath, size_t filepath_maxncpy, const ImageFormatData *im_format)
void BKE_image_format_init(ImageFormatData *imf)
void BKE_image_format_color_management_copy(ImageFormatData *imf, const ImageFormatData *imf_src)
eImageFormatDepth BKE_imtype_valid_depths(char imtype)
void BKE_image_format_free(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_requires_linear_float(char imtype)
bool BKE_imtype_is_movie(char imtype)
char BKE_ftype_to_imtype(eImbFileType ftype, const ImbFormatOptions *options)
eImageFormatDepth BKE_imtype_first_valid_depth(eImageFormatDepth valid_depths)
char BKE_imtype_from_arg(const char *imtype_arg)
Vector< bke::path_templates::Error > BKE_image_path_from_imtype(char *filepath, const char *base, const char *relbase, const bke::path_templates::VariableMap *template_variables, int frame, char imtype, bool use_ext, bool use_frames, const char *suffix)
char BKE_imtype_valid_channels(char imtype)
void BKE_image_format_update_color_space_for_type(ImageFormatData *format)
int BKE_image_path_ext_from_imtype_ensure(char *filepath, size_t filepath_maxncpy, char imtype)
int BKE_image_path_ext_from_imformat(const ImageFormatData *im_format, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX])
eImageFormatDepth BKE_imtype_valid_depths_with_video(char imtype, const ID *owner_id)
void BKE_image_format_copy(ImageFormatData *imf_dst, const ImageFormatData *imf_src)
signed char int8_t
Definition BKE_text.h:76