LibPDF: Get color rendering intent from image dict

Still not used for anything, so no behavior change.
This commit is contained in:
Nico Weber 2023-10-19 19:53:08 -04:00 committed by Andreas Kling
parent b640747116
commit ea6fed627a
Notes: sideshowbarker 2024-07-17 01:21:02 +09:00
2 changed files with 7 additions and 0 deletions

View file

@ -89,6 +89,7 @@
X(Index) \
X(Indexed) \
X(Info) \
X(Intent) \
X(JBIG2Decode) \
X(JPXDecode) \
X(Keywords) \

View file

@ -836,6 +836,12 @@ PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> Renderer::load_image(NonnullRefPtr<Stream
auto color_space_object = MUST(image_dict->get_object(m_document, CommonNames::ColorSpace));
auto color_space = TRY(get_color_space_from_document(color_space_object));
auto color_rendering_intent = state().color_rendering_intent;
if (image_dict->contains(CommonNames::Intent))
color_rendering_intent = TRY(image_dict->get_name(m_document, CommonNames::Intent))->name();
// FIXME: Do something with color_rendering_intent.
auto bits_per_component = image_dict->get_value(CommonNames::BitsPerComponent).get<int>();
if (bits_per_component != 8) {
return Error(Error::Type::RenderingUnsupported, "Image's bit per component != 8");