|
@@ -10,6 +10,7 @@
|
|
#include <AK/Forward.h>
|
|
#include <AK/Forward.h>
|
|
#include <LibGfx/Color.h>
|
|
#include <LibGfx/Color.h>
|
|
#include <LibGfx/ICC/Profile.h>
|
|
#include <LibGfx/ICC/Profile.h>
|
|
|
|
+#include <LibGfx/PaintStyle.h>
|
|
#include <LibPDF/Function.h>
|
|
#include <LibPDF/Function.h>
|
|
#include <LibPDF/Value.h>
|
|
#include <LibPDF/Value.h>
|
|
|
|
|
|
@@ -28,6 +29,9 @@
|
|
|
|
|
|
namespace PDF {
|
|
namespace PDF {
|
|
|
|
|
|
|
|
+typedef Variant<Gfx::Color, NonnullRefPtr<Gfx::PaintStyle>> ColorOrStyle;
|
|
|
|
+class Renderer;
|
|
|
|
+
|
|
class ColorSpaceFamily {
|
|
class ColorSpaceFamily {
|
|
public:
|
|
public:
|
|
ColorSpaceFamily(DeprecatedFlyString name, bool may_be_specified_directly)
|
|
ColorSpaceFamily(DeprecatedFlyString name, bool may_be_specified_directly)
|
|
@@ -62,7 +66,7 @@ public:
|
|
|
|
|
|
virtual ~ColorSpace() = default;
|
|
virtual ~ColorSpace() = default;
|
|
|
|
|
|
- virtual PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const = 0;
|
|
|
|
|
|
+ virtual PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const = 0;
|
|
virtual int number_of_components() const = 0;
|
|
virtual int number_of_components() const = 0;
|
|
virtual Vector<float> default_decode() const = 0; // "TABLE 4.40 Default Decode arrays"
|
|
virtual Vector<float> default_decode() const = 0; // "TABLE 4.40 Default Decode arrays"
|
|
virtual ColorSpaceFamily const& family() const = 0;
|
|
virtual ColorSpaceFamily const& family() const = 0;
|
|
@@ -74,7 +78,7 @@ public:
|
|
|
|
|
|
~DeviceGrayColorSpace() override = default;
|
|
~DeviceGrayColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 1; }
|
|
int number_of_components() const override { return 1; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceGray; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceGray; }
|
|
@@ -89,7 +93,7 @@ public:
|
|
|
|
|
|
~DeviceRGBColorSpace() override = default;
|
|
~DeviceRGBColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 3; }
|
|
int number_of_components() const override { return 3; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceRGB; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceRGB; }
|
|
@@ -104,7 +108,7 @@ public:
|
|
|
|
|
|
~DeviceCMYKColorSpace() override = default;
|
|
~DeviceCMYKColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 4; }
|
|
int number_of_components() const override { return 4; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceCMYK; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceCMYK; }
|
|
@@ -119,7 +123,7 @@ public:
|
|
|
|
|
|
~DeviceNColorSpace() override = default;
|
|
~DeviceNColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override;
|
|
int number_of_components() const override;
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceN; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::DeviceN; }
|
|
@@ -140,7 +144,7 @@ public:
|
|
|
|
|
|
~CalGrayColorSpace() override = default;
|
|
~CalGrayColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 1; }
|
|
int number_of_components() const override { return 1; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::CalGray; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::CalGray; }
|
|
@@ -159,7 +163,7 @@ public:
|
|
|
|
|
|
~CalRGBColorSpace() override = default;
|
|
~CalRGBColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 3; }
|
|
int number_of_components() const override { return 3; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::CalRGB; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::CalRGB; }
|
|
@@ -179,7 +183,7 @@ public:
|
|
|
|
|
|
~ICCBasedColorSpace() override = default;
|
|
~ICCBasedColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override;
|
|
int number_of_components() const override;
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::ICCBased; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::ICCBased; }
|
|
@@ -197,7 +201,7 @@ public:
|
|
|
|
|
|
~LabColorSpace() override = default;
|
|
~LabColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 3; }
|
|
int number_of_components() const override { return 3; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::Lab; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::Lab; }
|
|
@@ -216,7 +220,7 @@ public:
|
|
|
|
|
|
~IndexedColorSpace() override = default;
|
|
~IndexedColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 1; }
|
|
int number_of_components() const override { return 1; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::Indexed; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::Indexed; }
|
|
@@ -235,7 +239,7 @@ public:
|
|
|
|
|
|
~SeparationColorSpace() override = default;
|
|
~SeparationColorSpace() override = default;
|
|
|
|
|
|
- PDFErrorOr<Color> color(ReadonlySpan<Value> arguments) const override;
|
|
|
|
|
|
+ PDFErrorOr<ColorOrStyle> style(ReadonlySpan<Value> arguments) const override;
|
|
int number_of_components() const override { return 1; }
|
|
int number_of_components() const override { return 1; }
|
|
Vector<float> default_decode() const override;
|
|
Vector<float> default_decode() const override;
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::Separation; }
|
|
ColorSpaceFamily const& family() const override { return ColorSpaceFamily::Separation; }
|
|
@@ -248,5 +252,4 @@ private:
|
|
NonnullRefPtr<Function> m_tint_transform;
|
|
NonnullRefPtr<Function> m_tint_transform;
|
|
Vector<Value> mutable m_tint_output_values;
|
|
Vector<Value> mutable m_tint_output_values;
|
|
};
|
|
};
|
|
-
|
|
|
|
}
|
|
}
|