diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-03-11 19:50:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-03-21 18:38:13 +0300 |
commit | 6e4d2fa9140864a13356b07ffca082817822987f (patch) | |
tree | cb8894c3b6898e82410f3edffe2fb9d85a3a2399 /source/blender/blenkernel/BKE_image_format.h | |
parent | 4abb8a14a2133f876c7718a8e09284baa62b1cf5 (diff) |
Cleanup: add image_format.cc for functions related to ImageFormatData
Also fixes missing code to read/write/free/copy color management settings
in various places. This can't be set through the UI currently, but still
should be handled consistently.
Diffstat (limited to 'source/blender/blenkernel/BKE_image_format.h')
-rw-r--r-- | source/blender/blenkernel/BKE_image_format.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_image_format.h b/source/blender/blenkernel/BKE_image_format.h new file mode 100644 index 00000000000..189d2db1b4f --- /dev/null +++ b/source/blender/blenkernel/BKE_image_format.h @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2001-2002 NaN Holding BV. All rights reserved. */ + +#pragma once + +/** \file + * \ingroup bke + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct BlendDataReader; +struct BlendWriter; +struct ImbFormatOptions; +struct ImageFormatData; +struct ImBuf; + +/* Init/Copy/Free */ + +void BKE_image_format_init(struct ImageFormatData *imf, const bool render); +void BKE_image_format_copy(struct ImageFormatData *imf_dst, const struct ImageFormatData *imf_src); +void BKE_image_format_free(struct ImageFormatData *imf); + +void BKE_image_format_blend_read_data(struct BlendDataReader *reader, struct ImageFormatData *imf); +void BKE_image_format_blend_write(struct BlendWriter *writer, struct ImageFormatData *imf); + +/* File Paths */ + +void BKE_image_path_from_imformat(char *string, + const char *base, + const char *relbase, + int frame, + const struct ImageFormatData *im_format, + bool use_ext, + bool use_frames, + const char *suffix); +void BKE_image_path_from_imtype(char *string, + const char *base, + const char *relbase, + int frame, + char imtype, + bool use_ext, + bool use_frames, + const char *suffix); +int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format); +int BKE_image_path_ensure_ext_from_imtype(char *string, char imtype); + +/* File Types */ + +#define IMA_CHAN_FLAG_BW 1 +#define IMA_CHAN_FLAG_RGB 2 +#define IMA_CHAN_FLAG_ALPHA 4 + +char BKE_ftype_to_imtype(int ftype, const struct ImbFormatOptions *options); +int BKE_imtype_to_ftype(char imtype, struct ImbFormatOptions *r_options); + +bool BKE_imtype_is_movie(char imtype); +bool BKE_imtype_supports_zbuf(char imtype); +bool BKE_imtype_supports_compress(char imtype); +bool BKE_imtype_supports_quality(char imtype); +bool BKE_imtype_requires_linear_float(char imtype); +char BKE_imtype_valid_channels(char imtype, bool write_file); +char BKE_imtype_valid_depths(char imtype); + +/** + * String is from command line `--render-format` argument, + * keep in sync with `creator_args.c` help info. + */ +char BKE_imtype_from_arg(const char *arg); + +/* Conversion between ImBuf settings. */ + +void BKE_image_format_from_imbuf(struct ImageFormatData *im_format, const struct ImBuf *imbuf); +void BKE_image_format_to_imbuf(struct ImBuf *ibuf, const struct ImageFormatData *imf); + +#ifdef __cplusplus +} +#endif |