gradientType = "radial";
gradientDirectionSvg = "cx=\"50%\" cy=\"50%\" r=\"75%\"";
rectangleDimension = "x=\"-50\" y=\"-50\" width=\"101\" height=\"101\"";
} else {
problemsHandler.wrongEnumeratedArgument(functionCall, "direction", "to bottom", "to right", "to bottom right", "to top right", "ellipse", "ellipse at center");
return new FaultyExpression(functionCall);
}
StringBuilder returner = new StringBuilder("<?xml version=\"1.0\" ?>");
returner.append("<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"100%\" height=\"100%\" viewBox=\"0 0 1 1\" preserveAspectRatio=\"none\">");
returner.append("<");
returner.append(gradientType);
returner.append("Gradient id=\"gradient\" gradientUnits=\"userSpaceOnUse\" ");
returner.append(gradientDirectionSvg);
returner.append(">");
Iterator<Expression> iterator = stops.iterator();
boolean isFirstStop = true;
while (iterator.hasNext()) {
Expression stop = iterator.next();
if (!addColorStop(returner, stop, isFirstStop, !iterator.hasNext(), functionCall, problemsHandler))
return new FaultyExpression(functionCall);
isFirstStop = false;
}
returner.append("</").append(gradientType).append("Gradient>");
returner.append("<rect ").append(rectangleDimension).append(" fill=\"url(#gradient)\" /></svg>");