diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2021-05-27 14:01:37 -0700 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-06-12 22:45:01 +0430 |
commit | 7b4e36bf88ae1498287c262c910874e9ad9c5cbf (patch) | |
tree | 0bab3957e91c387f928a9c7efcef57daca22fbd8 /Userland/Libraries/LibPDF/Renderer.h | |
parent | ea3abb14fe2eff0ef5d319c2d83358fbb233e4f5 (diff) | |
download | serenity-7b4e36bf88ae1498287c262c910874e9ad9c5cbf.zip |
LibPDF: Split ColorSpace into a different class for each color space
While unnecessary at the moment, this will allow for more fine-grained
control when complex color spaces get added.
Diffstat (limited to 'Userland/Libraries/LibPDF/Renderer.h')
-rw-r--r-- | Userland/Libraries/LibPDF/Renderer.h | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/Userland/Libraries/LibPDF/Renderer.h b/Userland/Libraries/LibPDF/Renderer.h index 5709d1c564..36bd103d7a 100644 --- a/Userland/Libraries/LibPDF/Renderer.h +++ b/Userland/Libraries/LibPDF/Renderer.h @@ -16,22 +16,10 @@ #include <LibGfx/Point.h> #include <LibGfx/Rect.h> #include <LibGfx/Size.h> +#include <LibPDF/ColorSpace.h> #include <LibPDF/Document.h> #include <LibPDF/Object.h> -#define ENUMERATE_COLOR_SPACES(V) \ - V(DeviceGray) \ - V(DeviceRGB) \ - V(DeviceCMYK) \ - V(CalGray) \ - V(CalRGB) \ - V(Lab) \ - V(ICCBased) \ - V(Indexed) \ - V(Pattern) \ - V(Separation) \ - V(DeviceN) - namespace PDF { enum class LineCapStyle : u8 { @@ -73,23 +61,10 @@ struct TextState { bool knockout { true }; }; -class ColorSpace { -public: - enum class Type { -#define ENUM(name) name, - ENUMERATE_COLOR_SPACES(ENUM) -#undef ENUM - }; - - static Optional<ColorSpace::Type> color_space_from_string(const FlyString&); - static Color default_color_for_color_space(ColorSpace::Type); - static Color color_from_parameters(ColorSpace::Type color_space, const Vector<Value>& args); -}; - struct GraphicsState { Gfx::AffineTransform ctm; - ColorSpace::Type stroke_color_space { ColorSpace::Type::DeviceGray }; - ColorSpace::Type paint_color_space { ColorSpace::Type::DeviceGray }; + RefPtr<ColorSpace> stroke_color_space { DeviceGrayColorSpace::the() }; + RefPtr<ColorSpace> paint_color_space { DeviceGrayColorSpace::the() }; Gfx::Color stroke_color { Gfx::Color::NamedColor::Black }; Gfx::Color paint_color { Gfx::Color::NamedColor::Black }; float line_width { 1.0f }; @@ -119,7 +94,7 @@ private: // shift is the manual advance given in the TJ command array void show_text(const String&, int shift = 0); - ColorSpace::Type get_color_space(const Value&); + RefPtr<ColorSpace> get_color_space(const Value&); ALWAYS_INLINE const GraphicsState& state() const { return m_graphics_state_stack.last(); } ALWAYS_INLINE GraphicsState& state() { return m_graphics_state_stack.last(); } |