2023-05-02 23:11:58 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/SVG/AttributeParser.h>
|
|
|
|
|
#include <LibWeb/SVG/SVGAnimatedLength.h>
|
|
|
|
|
#include <LibWeb/SVG/SVGGradientElement.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::SVG {
|
|
|
|
|
|
|
|
|
|
class SVGRadialGradientElement : public SVGGradientElement {
|
|
|
|
|
WEB_PLATFORM_OBJECT(SVGRadialGradientElement, SVGGradientElement);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(SVGRadialGradientElement);
|
2023-05-02 23:11:58 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual ~SVGRadialGradientElement() override = default;
|
|
|
|
|
|
2024-11-14 08:14:16 -05:00
|
|
|
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
|
2023-05-02 23:11:58 +01:00
|
|
|
|
2024-06-13 15:22:46 +03:00
|
|
|
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;
|
2023-05-02 23:11:58 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<SVGAnimatedLength> cx() const;
|
|
|
|
|
GC::Ref<SVGAnimatedLength> cy() const;
|
|
|
|
|
GC::Ref<SVGAnimatedLength> fx() const;
|
|
|
|
|
GC::Ref<SVGAnimatedLength> fy() const;
|
|
|
|
|
GC::Ref<SVGAnimatedLength> fr() const;
|
|
|
|
|
GC::Ref<SVGAnimatedLength> r() const;
|
2023-05-02 23:11:58 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
SVGRadialGradientElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2023-05-02 23:11:58 +01:00
|
|
|
|
|
|
|
|
private:
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<SVGRadialGradientElement const> linked_radial_gradient(HashTable<SVGGradientElement const*>& seen_gradients) const
|
2023-05-02 23:11:58 +01:00
|
|
|
{
|
2024-03-10 12:18:09 +01:00
|
|
|
if (auto gradient = linked_gradient(seen_gradients); gradient && is<SVGRadialGradientElement>(*gradient))
|
2025-01-21 09:12:05 -05:00
|
|
|
return &as<SVGRadialGradientElement>(*gradient);
|
2023-05-02 23:11:58 +01:00
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NumberPercentage start_circle_x() const;
|
|
|
|
|
NumberPercentage start_circle_y() const;
|
|
|
|
|
NumberPercentage start_circle_radius() const;
|
|
|
|
|
NumberPercentage end_circle_x() const;
|
|
|
|
|
NumberPercentage end_circle_y() const;
|
|
|
|
|
NumberPercentage end_circle_radius() const;
|
|
|
|
|
|
2024-03-10 12:18:09 +01:00
|
|
|
NumberPercentage start_circle_x_impl(HashTable<SVGGradientElement const*>& seen_gradients) const;
|
|
|
|
|
NumberPercentage start_circle_y_impl(HashTable<SVGGradientElement const*>& seen_gradients) const;
|
|
|
|
|
NumberPercentage start_circle_radius_impl(HashTable<SVGGradientElement const*>& seen_gradients) const;
|
|
|
|
|
NumberPercentage end_circle_x_impl(HashTable<SVGGradientElement const*>& seen_gradients) const;
|
|
|
|
|
NumberPercentage end_circle_y_impl(HashTable<SVGGradientElement const*>& seen_gradients) const;
|
|
|
|
|
NumberPercentage end_circle_radius_impl(HashTable<SVGGradientElement const*>& seen_gradients) const;
|
|
|
|
|
|
2023-05-02 23:11:58 +01:00
|
|
|
Optional<NumberPercentage> m_cx;
|
|
|
|
|
Optional<NumberPercentage> m_cy;
|
|
|
|
|
Optional<NumberPercentage> m_fx;
|
|
|
|
|
Optional<NumberPercentage> m_fy;
|
|
|
|
|
Optional<NumberPercentage> m_fr;
|
|
|
|
|
Optional<NumberPercentage> m_r;
|
|
|
|
|
|
2024-06-13 15:22:46 +03:00
|
|
|
mutable RefPtr<Painting::SVGRadialGradientPaintStyle> m_paint_style;
|
2023-05-02 23:11:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|