data FontInclude {
char name[]
char source[]
}
component provides SVGCanvas requires data.DecUtil du, data.IntUtil iu, encoding.Encoder:base64 b64, io.File, io.FileSystem fileSystem, data.query.Search search, System system {
int width
int height
char svg[]
bool embedFonts
FontInclude fontTable[]
void SVGCanvas:rect(Rect2D rect)
{
dec opacity = rect.color.a
opacity = opacity / 255.0
svg = new char[](svg, "")
}
void SVGCanvas:rectOutline(Rect2D rect, opt int thickness)
{
dec opacity = rect.color.a
opacity = opacity / 255.0
svg = new char[](svg, "")
}
void SVGCanvas:roundedRect(Rect2D r, int xRadius, int yRadius)
{
}
void SVGCanvas:roundedRectOutline(Rect2D r, int xRadius, int yRadius, opt int thickness)
{
if (!(isset thickness)) thickness = 1
int offset = thickness / 2
/*
drawLine(new Line2D(r.x - offset, r.y, (r.x + r.width) + offset - 1, r.y, r.color), thickness)
drawLine(new Line2D(r.x, r.y, r.x, (r.y + r.height) + offset - 1, r.color), thickness)
drawLine(new Line2D((r.x + r.width) - 1, r.y, (r.x + r.width) - 1, (r.y + r.height) + offset - 1, r.color), thickness)
drawLine(new Line2D(r.x, (r.y + r.height) - 1, (r.x + r.width) - 1, (r.y + r.height) - 1, r.color), thickness)
*/
}
void SVGCanvas:line(Line2D line, opt int thickness)
{
dec opacity = line.color.a
opacity = opacity / 255.0
svg = new char[](svg, "")
}
void SVGCanvas:curve(Curve2D line, int isteps, opt int thickness)
{
}
void SVGCanvas:point(Point2D point)
{
}
void SVGCanvas:ellipse(Ellipse2D r)
{
}
void SVGCanvas:ellipseOutline(Ellipse2D r, opt int thickness)
{
}
void SVGCanvas:arc(Arc2D r)
{
}
void SVGCanvas:arcOutline(Arc2D r, opt int lineWidth)
{
}
void SVGCanvas:pie(Arc2D r)
{
}
void SVGCanvas:polygon(Polygon2D r)
{
}
void SVGCanvas:polygonOutline(Polygon2D r)
{
}
void SVGCanvas:polygonBezier(Polygon2D r, int isteps)
{
}
void SVGCanvas:pixels(PixelMap map, int x, int y, opt int scaledWidth, int scaledHeight, int rotation, Rect subRect)
{
}
void SVGCanvas:text(Point2D position, Font f, char text[], opt int rotation)
{
dec opacity = position.color.a
opacity = opacity / 255.0
//SVG uses bottom-left anchoring for the text *baseline* location, but the screen renderer uses top-left absolute height anchoring, so here we adjust...
int adjustedY = position.y + f.getFontMetrics().ascent
int rotationX = position.x
int rotationY = position.y
//note that Dana's screen-rendered fonts are effectively sized in pixels (sized in points at a fixed 72 DPI), so here we use pixels to avoid scaling issues with different DPI ranges
svg = new char[](svg, "$text")
//note the font details as we'll need to define its source data in the header
if (fontTable.find(FontInclude.[name], new FontInclude(f.getFontName())) == null)
{
fontTable = new FontInclude[](fontTable, new FontInclude(f.getFontName(), f.getSource()))
}
}
void SVGCanvas:pushSurface(Rect rect, int xscr, int yscr, byte alpha)
{
}
void SVGCanvas:popSurface()
{
}
void SVGCanvas:setSize(int w, int h)
{
width = w
height = h
}
void SVGCanvas:clear()
{
svg = null
fontTable = null
}
char[] resolveFontPath(char source[])
{
//first check if it exists as-is, then checking the core path
if (fileSystem.exists(source))
return source
char DH[] = system.getDanaHome()
if (fileSystem.exists("$DH/resources-ext/fonts/$source"))
return "$DH/resources-ext/fonts/$source"
return null
}
void SVGCanvas:setEmbedFonts(bool b)
{
embedFonts = b
}
char[] SVGCanvas:getSVG()
{
char fontDefs[] = "")
return new char[](" ")
}
}