AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
SVGImageElement.hpp
1/*
2Copyright (C) 2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGUI_SVGIMAGEELEMENT_H
17#define AEONGUI_SVGIMAGEELEMENT_H
18
19#include "SVGGraphicsElement.hpp"
20#include "SVGAnimatedLength.hpp"
21#include "SVGAnimatedString.hpp"
22#include "SVGAnimatedPreserveAspectRatio.hpp"
23#include "aeongui/RasterImage.hpp"
24
25namespace AeonGUI
26{
27 namespace DOM
28 {
33 {
34 public:
40 DLL SVGImageElement ( const DOMString& aTagName, AttributeMap&& aAttributes, Node* aParent );
42 DLL ~SVGImageElement() final;
43
46 DLL const SVGAnimatedLength& x() const;
49 DLL const SVGAnimatedLength& y() const;
52 DLL const SVGAnimatedLength& width() const;
55 DLL const SVGAnimatedLength& height() const;
58 DLL const SVGAnimatedString& href() const;
64 DLL const DOMString& crossOrigin() const;
67 DLL const DOMString& decoding() const;
68
72 DLL void DrawStart ( Canvas& aCanvas ) const final;
73
74 private:
75 void ParseAttributes ( const AttributeMap& aAttributes );
76 bool EnsureImageLoaded() const;
77
80 SVGAnimatedLength mWidth{};
81 SVGAnimatedLength mHeight{};
82 SVGAnimatedString mHref{};
83 SVGAnimatedPreserveAspectRatio mPreserveAspectRatio{};
84 DOMString mCrossOrigin{};
85 DOMString mDecoding{"auto"};
86 mutable RasterImage mRasterImage{};
87 mutable bool mImageLoadAttempted{false};
88 };
89 }
90}
91
92#endif
Abstract 2D rendering surface.
Definition Canvas.hpp:39
Base class for all nodes in the DOM tree.
Definition Node.hpp:40
Animated length attribute (SVG).
Definition SVGAnimatedLength.hpp:30
Animated preserveAspectRatio attribute (SVG).
Definition SVGAnimatedPreserveAspectRatio.hpp:31
Animated string attribute (SVG).
Definition SVGAnimatedString.hpp:31
SVGGraphicsElement(const DOMString &aTagName, AttributeMap &&aAttributes, Node *aParent)
Construct an SVGGraphicsElement.
Definition SVGGraphicsElement.cpp:24
~SVGImageElement() final
Destructor.
const SVGAnimatedString & href() const
Get the animated href (image source URL).
Definition SVGImageElement.cpp:211
const SVGAnimatedPreserveAspectRatio & preserveAspectRatio() const
Get the animated preserveAspectRatio.
Definition SVGImageElement.cpp:216
const SVGAnimatedLength & height() const
Get the animated height.
Definition SVGImageElement.cpp:206
const DOMString & crossOrigin() const
Get the crossOrigin attribute value.
Definition SVGImageElement.cpp:221
const SVGAnimatedLength & x() const
Get the animated x position.
Definition SVGImageElement.cpp:191
const SVGAnimatedLength & width() const
Get the animated width.
Definition SVGImageElement.cpp:201
void DrawStart(Canvas &aCanvas) const final
Draw the embedded image onto the canvas.
Definition SVGImageElement.cpp:231
const SVGAnimatedLength & y() const
Get the animated y position.
Definition SVGImageElement.cpp:196
const DOMString & decoding() const
Get the decoding hint ("auto", "sync", or "async").
Definition SVGImageElement.cpp:226
SVGImageElement(const DOMString &aTagName, AttributeMap &&aAttributes, Node *aParent)
Construct an SVGImageElement.
Definition SVGImageElement.cpp:84