mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibPDF: Add support for the CalRGB ColorSpace
This isn't tested all that well, as the PDF I am testing with only uses it for black (which is trivial). It can be tested further when LibPDF is able to process more complex PDFs that actually use this color space non-trivially.
This commit is contained in:
parent
7b4e36bf88
commit
006f5498de
Notes:
sideshowbarker
2024-07-18 12:21:03 +09:00
Author: https://github.com/mattco98
Commit: 006f5498de
Pull-request: https://github.com/SerenityOS/serenity/pull/7675
Reviewed-by: https://github.com/FireFox317
Reviewed-by: https://github.com/alimpfard
3 changed files with 205 additions and 0 deletions
|
@ -517,6 +517,25 @@ RefPtr<ColorSpace> Renderer::get_color_space(const Value& value)
|
|||
return DeviceRGBColorSpace::the();
|
||||
if (name == CommonNames::DeviceCMYK)
|
||||
return DeviceCMYKColorSpace::the();
|
||||
if (name == CommonNames::Pattern)
|
||||
TODO();
|
||||
|
||||
// The color space is a complex color space with parameters that resides in
|
||||
// the resource dictionary
|
||||
auto color_space_resource_dict = m_page.resources->get_dict(m_document, CommonNames::ColorSpace);
|
||||
if (!color_space_resource_dict->contains(name))
|
||||
TODO();
|
||||
|
||||
auto color_space_array = color_space_resource_dict->get_array(m_document, name);
|
||||
name = color_space_array->get_name_at(m_document, 0)->name();
|
||||
|
||||
Vector<Value> parameters;
|
||||
parameters.ensure_capacity(color_space_array->size() - 1);
|
||||
for (size_t i = 1; i < color_space_array->size(); i++)
|
||||
parameters.unchecked_append(color_space_array->at(i));
|
||||
|
||||
if (name == CommonNames::CalRGB)
|
||||
return CalRGBColorSpace::create(m_document, move(parameters));
|
||||
|
||||
TODO();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue