Blender V5.3
format_psd.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
11#include "IMB_filetype.hh"
12
13#include "IMB_imbuf_types.hh"
14
15namespace blender {
16
17const char *imb_file_extensions_psd[] = {".psd", ".pdd", ".psb", nullptr};
18
19OIIO_NAMESPACE_USING
20using namespace blender::imbuf;
21
22bool imb_is_a_psd(const uchar *mem, size_t size)
23{
24 return imb_oiio_check(mem, size, "psd");
25}
26
28 size_t size,
29 ImBufFlags flags,
30 ImFileColorSpace &r_colorspace)
31{
32 ImageSpec config, spec;
33 config.attribute("oiio:UnassociatedAlpha", 1);
34
35 ReadContext ctx{mem, size, "psd", IMB_FTYPE_PSD, flags};
36
37 /* PSD should obey color space information embedded in the file. */
38 ctx.use_metadata_colorspace = true;
39
40 return imb_oiio_read(ctx, config, r_colorspace, spec);
41}
42
43} // namespace blender
ImBuf * imb_oiio_read(const ReadContext &ctx, const ImageSpec &config, ImFileColorSpace &r_colorspace, ImageSpec &r_newspec)
bool imb_oiio_check(const uchar *mem, size_t mem_size, const char *file_format)
BMesh Iterators.
bool imb_is_a_psd(const uchar *mem, size_t size)
Definition format_psd.cc:22
ImBuf * imb_load_psd(const uchar *mem, size_t size, ImBufFlags flags, ImFileColorSpace &r_colorspace)
Definition format_psd.cc:27
unsigned char uchar
Definition BKE_text.h:58
const char * imb_file_extensions_psd[]
Definition format_psd.cc:17