"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.SSvgPaintEngine = void 0;
var lib_1 = require("@saga-web/base/lib");
var SPath2D_1 = require("../SPath2D");
var __1 = require("..");
var SSvgPaintEngine = (function (_super) {
__extends(SSvgPaintEngine, _super);
function SSvgPaintEngine(w, h) {
var _this = _super.call(this) || this;
_this._builder = new lib_1.SStringBuilder();
_this.version = "1.1";
_this.width = 0;
_this.height = 0;
_this.width = w;
_this.height = h;
_this._builder.append("");
_this._builder.append("");
_this._builder.append("\n";
};
SSvgPaintEngine.prototype.setClip = function (path) {
};
SSvgPaintEngine.prototype.clearRect = function (rect) { };
SSvgPaintEngine.prototype.drawRect = function (rect) {
this._builder.append("");
};
SSvgPaintEngine.prototype.drawCircle = function (cx, cy, r) {
this._builder.append("");
};
SSvgPaintEngine.prototype.drawEllipse = function (cx, cy, rx, ry) {
this._builder.append("");
};
SSvgPaintEngine.prototype.drawArc = function (x, y, width, height, startAngle, endAngle) {
var path = SPath2D_1.SPath2D.arc(x, y, width, height, startAngle, endAngle);
this._builder.append("");
};
SSvgPaintEngine.prototype.drawChord = function (x, y, width, height, startAngle, endAngle) {
var path = SPath2D_1.SPath2D.chord(x, y, width, height, startAngle, endAngle);
this._builder.append("");
};
SSvgPaintEngine.prototype.drawPie = function (x, y, width, height, startAngle, endAngle) {
var path = SPath2D_1.SPath2D.pie(x, y, width, height, startAngle, endAngle);
this._builder.append("");
};
SSvgPaintEngine.prototype.drawLine = function (line) {
this._builder.append("");
};
SSvgPaintEngine.prototype.drawPolyline = function (points) {
this._builder.append("");
};
SSvgPaintEngine.prototype.drawPolygon = function (points) {
this._builder.append("");
};
SSvgPaintEngine.prototype.drawPath = function (path) {
this._builder.append("");
};
SSvgPaintEngine.prototype.drawText = function (text, x, y, maxWidth) {
this._builder.append("" + text + ">");
};
SSvgPaintEngine.prototype.drawImage = function (img, x, y, width, height) {
};
SSvgPaintEngine.prototype.textWidth = function (text) {
return 0;
};
SSvgPaintEngine.prototype.changeFont = function (font) { };
SSvgPaintEngine.prototype.getSvgMatrix = function () {
return "transform=\"matrix(" + this.state.matrix.a + ", " + this.state.matrix.b + ", " + this.state.matrix.c + ", " + this.state.matrix.d + ", " + this.state.matrix.e + ", " + this.state.matrix.f + ")\"";
};
SSvgPaintEngine.pointsToStr = function (points) {
var strBuilder = new lib_1.SStringBuilder();
for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
var p = points_1[_i];
strBuilder.append(p.x + "," + p.y);
}
return strBuilder.toString(" ");
};
SSvgPaintEngine.prototype.getStyle = function (brush, pen, font) {
if (brush === void 0) { brush = false; }
if (pen === void 0) { pen = false; }
if (font === void 0) { font = false; }
var builder = new lib_1.SStringBuilder();
builder.append('style="');
if (pen) {
builder.append("stroke:rgba(" + this.state.pen.color.red + ", " + this.state.pen.color.green + ", " + this.state.pen.color.blue + ", " + this.state.pen.color.alpha /
255.0 + ");");
builder.append("stroke-width:" + this.state.pen.lineWidth + ";");
}
else {
builder.append("stroke-width:0;");
}
if (brush) {
builder.append("fill:rgba(" + this.state.brush.color.red + ", " + this.state.brush.color.green + ", " + this.state.brush.color.blue + ", " + this.state.brush.color
.alpha / 255.0 + ");");
}
else {
builder.append("fill:rgba(0,0,0,0);");
}
if (font) {
builder.append("font-size:" + this.state.font.size + "px;");
}
builder.append('"');
return builder.toString("");
};
return SSvgPaintEngine;
}(__1.SPaintEngine));
exports.SSvgPaintEngine = SSvgPaintEngine;