LibPDF: Add basic tiled, coloured pattern rendering

This commit is contained in:
Kyle Pereira 2023-12-07 13:07:56 +00:00 committed by Andreas Kling
commit 8ff87911a3
Notes: sideshowbarker 2024-07-17 05:02:42 +09:00
5 changed files with 129 additions and 20 deletions

View file

@ -616,14 +616,8 @@ RENDERER_HANDLER(set_stroking_color)
RENDERER_HANDLER(set_stroking_color_extended)
{
// FIXME: Handle Pattern color spaces
auto last_arg = args.last();
if (last_arg.has<NonnullRefPtr<Object>>() && last_arg.get<NonnullRefPtr<Object>>()->is<NameObject>()) {
dbgln("pattern space {}", last_arg.get<NonnullRefPtr<Object>>()->cast<NameObject>()->name());
return Error::rendering_unsupported_error("Pattern color spaces not yet implemented");
}
state().stroke_style = TRY(state().stroke_color_space->style(args));
// FIXME: Pattern color spaces might need extra resources
state().paint_style = TRY(state().paint_color_space->style(args));
return {};
}
@ -635,13 +629,7 @@ RENDERER_HANDLER(set_painting_color)
RENDERER_HANDLER(set_painting_color_extended)
{
// FIXME: Handle Pattern color spaces
auto last_arg = args.last();
if (last_arg.has<NonnullRefPtr<Object>>() && last_arg.get<NonnullRefPtr<Object>>()->is<NameObject>()) {
dbgln("pattern space {}", last_arg.get<NonnullRefPtr<Object>>()->cast<NameObject>()->name());
return Error::rendering_unsupported_error("Pattern color spaces not yet implemented");
}
// FIXME: Pattern color spaces might need extra resources
state().paint_style = TRY(state().paint_color_space->style(args));
return {};
}