SvgImage.java
package pro.verron.asciidoc.converters.svg;
/// SVG {@code <image>} element model.
///
/// @param x x coordinate
/// @param y y coordinate
/// @param width image width
/// @param height image height
/// @param href image URL
/// @param opts additional SVG attributes
public record SvgImage(
String x,
String y,
String width,
String height,
String href,
SvgAttributes opts
)
implements SvgElement {
/// Constructs an [SvgImage] element with variable attributes.
///
/// @param x x coordinate
/// @param y y coordinate
/// @param width image width
/// @param height image height
/// @param href image URL
/// @param opts additional SVG attributes
public SvgImage(
String x,
String y,
String width,
String height,
String href,
SvgAttribute... opts
) {
this(x, y, width, height, href, new SvgAttributes(opts));
}
@Override
public String markup() {
return "image";
}
@Override
public SvgAttributes attributes() {
var attributes = new SvgAttributes();
attributes.add("x", x);
attributes.add("y", y);
attributes.add("width", width);
attributes.add("height", height);
attributes.add("href", href);
attributes.addAll(opts);
return attributes;
}
}