2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2023-03-14 04:42:17 +01:00
|
|
|
|
2023-07-07 15:03:49 +10:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup imbuf
|
|
|
|
|
*/
|
|
|
|
|
|
2023-03-14 04:42:17 +01:00
|
|
|
#include "oiio/openimageio_support.hh"
|
|
|
|
|
|
2024-01-18 22:50:23 +02:00
|
|
|
#include "IMB_filetype.hh"
|
2023-03-14 16:09:08 +11:00
|
|
|
|
2024-01-18 22:50:23 +02:00
|
|
|
#include "IMB_imbuf_types.hh"
|
2023-03-14 04:42:17 +01:00
|
|
|
|
|
|
|
|
OIIO_NAMESPACE_USING
|
|
|
|
|
using namespace blender::imbuf;
|
|
|
|
|
|
|
|
|
|
bool imb_is_a_psd(const uchar *mem, size_t size)
|
|
|
|
|
{
|
2024-01-06 05:50:04 +01:00
|
|
|
return imb_oiio_check(mem, size, "psd");
|
2023-03-14 04:42:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImBuf *imb_load_psd(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
|
|
|
|
|
{
|
|
|
|
|
ImageSpec config, spec;
|
|
|
|
|
config.attribute("oiio:UnassociatedAlpha", 1);
|
|
|
|
|
|
|
|
|
|
ReadContext ctx{mem, size, "psd", IMB_FTYPE_PSD, flags};
|
|
|
|
|
|
|
|
|
|
/* PSD should obey color space information embedded in the file. */
|
|
|
|
|
ctx.use_embedded_colorspace = true;
|
|
|
|
|
|
|
|
|
|
return imb_oiio_read(ctx, config, colorspace, spec);
|
|
|
|
|
}
|