1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

LibPDF: Sketch out DeviceN color spaces a bit

Documents using them now show render-time diagnostics instead
of asserting that number of parameters passed to a color don't
match whatever number of channels the previously-set color space
had.

Fixes two asserts on the `-n 500` 0000.zip test set.
This commit is contained in:
Nico Weber 2023-10-24 10:26:20 -07:00 committed by Andreas Kling
parent f915aa70cd
commit f8bf9c6506
3 changed files with 66 additions and 0 deletions

View file

@ -106,6 +106,23 @@ private:
DeviceCMYKColorSpace() = default;
};
class DeviceNColorSpace final : public ColorSpace {
public:
static PDFErrorOr<NonnullRefPtr<DeviceNColorSpace>> create(Document*, Vector<Value>&& parameters);
~DeviceNColorSpace() override = default;
PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
int number_of_components() const override;
Vector<float> default_decode() const override;
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceN; }
private:
DeviceNColorSpace(size_t number_of_components);
size_t m_number_of_components { 0 };
};
class CalRGBColorSpace final : public ColorSpace {
public:
static PDFErrorOr<NonnullRefPtr<CalRGBColorSpace>> create(Document*, Vector<Value>&& parameters);