1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-16 00:27:38 +00:00
serenity/Userland/Libraries/LibWeb/SVG/SVGContext.h
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

45 lines
1.1 KiB
C++

/*
* Copyright (c) 2020, Matthew Olsson <matthewcolsson@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Vector.h>
#include <LibGfx/Color.h>
namespace Web {
class SVGContext {
public:
SVGContext()
{
m_states.append(State());
}
const Gfx::Color& fill_color() const { return state().fill_color; }
const Gfx::Color& stroke_color() const { return state().stroke_color; }
float stroke_width() const { return state().stroke_width; }
void set_fill_color(Gfx::Color color) { state().fill_color = color; }
void set_stroke_color(Gfx::Color color) { state().stroke_color = color; }
void set_stroke_width(float width) { state().stroke_width = width; }
void save() { m_states.append(m_states.last()); }
void restore() { m_states.take_last(); }
private:
struct State {
Gfx::Color fill_color { Gfx::Color::Black };
Gfx::Color stroke_color { Gfx::Color::Transparent };
float stroke_width { 1.0 };
};
const State& state() const { return m_states.last(); }
State& state() { return m_states.last(); }
Vector<State> m_states;
};
}