- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
- 272
- 273
- 274
- 275
- 276
- 277
- 278
- 279
- 280
- 281
- 282
- 283
- 284
- 285
- 286
- 287
- 288
- 289
- 290
- 291
- 292
- 293
- 294
- 295
- 296
- 297
- 298
- 299
- 300
- 301
- 302
- 303
- 304
- 305
- 306
- 307
- 308
- 309
- 310
- 311
- 312
- 313
- 314
- 315
- 316
- 317
- 318
- 319
- 320
- 321
- 322
- 323
- 324
- 325
- 326
- 327
- 328
- 329
- 330
- 331
- 332
- 333
- 334
- 335
- 336
- 337
- 338
- 339
- 340
- 341
- 342
- 343
- 344
- 345
- 346
- 347
- 348
- 349
- 350
- 351
- 352
- 353
- 354
- 355
- 356
- 357
- 358
- 359
- 360
- 361
- 362
- 363
- 364
- 365
- 366
- 367
- 368
- 369
- 370
- 371
- 372
- 373
- 374
- 375
- 376
- 377
- 378
- 379
- 380
- 381
- 382
- 383
- 384
- 385
- 386
- 387
- 388
- 389
- 390
- 391
- 392
- 393
- 394
- 395
- 396
- 397
- 398
- 399
- 400
- 401
- 402
- 403
- 404
- 405
- 406
- 407
- 408
- 409
- 410
- 411
- 412
- 413
- 414
- 415
- 416
- 417
- 418
- 419
- 420
- 421
- 422
- 423
- 424
- 425
- 426
- 427
- 428
- 429
- 430
- 431
- 432
- 433
- 434
- 435
- 436
- 437
- 438
- 439
- 440
- 441
- 442
- 443
- 444
- 445
- 446
- 447
- 448
- 449
- 450
- 451
- 452
- 453
- 454
- 455
- 456
- 457
- 458
- 459
- 460
- 461
- 462
- 463
- 464
- 465
- 466
- 467
- 468
- 469
- 470
- 471
- 472
- 473
- 474
- 475
- 476
- 477
- 478
- 479
- 480
- 481
- 482
- 483
- 484
- 485
- 486
- 487
- 488
- 489
- 490
- 491
- 492
- 493
- 494
- 495
- 496
- 497
- 498
- 499
- 500
- 501
- 502
- 503
- 504
- 505
- 506
- 507
- 508
- 509
- 510
- 511
- 512
- 513
- 514
- 515
- 516
- 517
- 518
- 519
- 520
- 521
- 522
- 523
- 524
- 525
- 526
- 527
- 528
- 529
- 530
- 531
- 532
- 533
- 534
- 535
- 536
- 537
- 538
- 539
- 540
- 541
- 542
- 543
- 544
- 545
- 546
- 547
- 548
- 549
- 550
- 551
- 552
- 553
- 554
- 555
- 556
- 557
- 558
- 559
- 560
- 561
- 562
- 563
- 564
- 565
- 566
- 567
- 568
- 569
- 570
- 571
- 572
- 573
- 574
- 575
- 576
- 577
- 578
- 579
- 580
- 581
- 582
- 583
- 584
- 585
- 586
- 587
- 588
- 589
- 590
- 591
- 592
- 593
- 594
- 595
- 596
- 597
- 598
- 599
- 600
- 601
- 602
- 603
- 604
- 605
- 606
- 607
- 608
- 609
- 610
- 611
- 612
- 613
- 614
- 615
- 616
- 617
- 618
- 619
- 620
- 621
- 622
- 623
- 624
- 625
- 626
- 627
- 628
import type { ExtensionMetadata } from '@pixi/core';
import { ExtensionType, Texture } from '@pixi/core';
import { SHAPES, Matrix } from '@pixi/math';
import { canvasUtils } from '@pixi/canvas-renderer';
import type { CanvasRenderer, CrossPlatformCanvasRenderingContext2D } from '@pixi/canvas-renderer';
import type { FillStyle, Graphics, GraphicsData, LineStyle } from '@pixi/graphics';
import type { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle } from '@pixi/math';
import { PolygonUtils } from './utils/PolygonUtils';
/*
* @author Mat Groves
*
* Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/
* for creating the original PixiJS version!
* Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they
* now share 4 bytes on the vertex buffer
*
* Heavily inspired by LibGDX's CanvasGraphicsRenderer:
* https://github.com/libgdx/libgdx/blob/1.0.0/gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java
*/
/**
* Renderer dedicated to drawing and batching graphics objects.
* @class
* @protected
* @memberof PIXI
*/
export class CanvasGraphicsRenderer
{
/** @ignore */
static extension: ExtensionMetadata = {
name: 'graphics',
type: ExtensionType.CanvasRendererPlugin,
};
/** A reference to the current renderer */
public renderer: CanvasRenderer;
private _svgMatrix: DOMMatrix | boolean = null;
private _tempMatrix: Matrix = new Matrix();
/**
* @param renderer - A reference to the current renderer.
*/
constructor(renderer: CanvasRenderer)
{
this.renderer = renderer;
}
/**
* calculates fill/stroke style for canvas
* @private
* @param style - A graphics PIXI.FILL_STYLE where if `texture` is specified then a tinted CanvasPattern
* will be used for the fill.stroke
* @param tint - color to set the fill/stroke too.
*/
private _calcCanvasStyle(style: FillStyle, tint: number): string | CanvasPattern
{
let res;
if (style.texture && style.texture.baseTexture !== Texture.WHITE.baseTexture)
{
if (style.texture.valid)
{
res = canvasUtils.getTintedPattern(style.texture, tint);
this.setPatternTransform(res, style.matrix || Matrix.IDENTITY);
}
else
{
res = '#808080';
}
}
else
{
res = `#${(`00000${(tint | 0).toString(16)}`).slice(-6)}`;
}
return res;
}
/**
* Renders a Graphics object to a canvas.
* @param graphics - the actual graphics object to render
*/
public render(graphics: Graphics): void
{
const renderer = this.renderer;
const context = renderer.context;
const worldAlpha = graphics.worldAlpha;
const transform = graphics.transform.worldTransform;
renderer.setContextTransform(transform);
renderer.setBlendMode(graphics.blendMode);
const graphicsData = graphics.geometry.graphicsData;
let contextFillStyle;
let contextStrokeStyle;
const tintR = ((graphics.tint >> 16) & 0xFF) / 255;
const tintG = ((graphics.tint >> 8) & 0xFF) / 255;
const tintB = (graphics.tint & 0xFF) / 255;
for (let i = 0; i < graphicsData.length; i++)
{
const data = graphicsData[i];
const shape = data.shape;
const fillStyle = data.fillStyle;
const lineStyle = data.lineStyle;
const fillColor = data.fillStyle.color | 0;
const lineColor = data.lineStyle.color | 0;
if (data.matrix)
{
renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix));
}
if (fillStyle.visible)
{
const fillTint = (
(((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)
+ (((fillColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)
+ (((fillColor & 0xFF) / 255) * tintB * 255)
);
contextFillStyle = this._calcCanvasStyle(fillStyle, fillTint);
}
if (lineStyle.visible)
{
const lineTint = (
(((lineColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)
+ (((lineColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)
+ (((lineColor & 0xFF) / 255) * tintB * 255)
);
contextStrokeStyle = this._calcCanvasStyle(lineStyle, lineTint);
}
context.lineWidth = lineStyle.width;
context.lineCap = lineStyle.cap;
context.lineJoin = lineStyle.join;
context.miterLimit = lineStyle.miterLimit;
if (data.type === SHAPES.POLY)
{
context.beginPath();
const tempShape = shape as Polygon;
let points = tempShape.points;
const holes = data.holes;
let outerArea;
let innerArea;
let px;
let py;
let holesDirection: boolean[];
context.moveTo(points[0], points[1]);
for (let j = 2; j < points.length; j += 2)
{
context.lineTo(points[j], points[j + 1]);
}
if (tempShape.closeStroke)
{
context.closePath();
}
if (holes.length > 0)
{
holesDirection = [];
outerArea = 0;
px = points[0];
py = points[1];
for (let j = 2; j + 2 < points.length; j += 2)
{
outerArea += ((points[j] - px) * (points[j + 3] - py))
- ((points[j + 2] - px) * (points[j + 1] - py));
}
for (let k = 0; k < holes.length; k++)
{
points = (holes[k].shape as Polygon).points;
if (!points)
{
continue;
}
innerArea = 0;
px = points[0];
py = points[1];
for (let j = 2; j + 2 < points.length; j += 2)
{
innerArea += ((points[j] - px) * (points[j + 3] - py))
- ((points[j + 2] - px) * (points[j + 1] - py));
}
if (innerArea * outerArea < 0)
{
context.moveTo(points[0], points[1]);
for (let j = 2; j < points.length; j += 2)
{
context.lineTo(points[j], points[j + 1]);
}
}
else
{
context.moveTo(points[points.length - 2], points[points.length - 1]);
for (let j = points.length - 4; j >= 0; j -= 2)
{
context.lineTo(points[j], points[j + 1]);
}
}
if ((holes[k].shape as Polygon).closeStroke)
{
context.closePath();
}
holesDirection[k] = innerArea * outerArea < 0;
}
}
if (fillStyle.visible)
{
context.globalAlpha = fillStyle.alpha * worldAlpha;
context.fillStyle = contextFillStyle;
context.fill();
}
if (lineStyle.visible)
{
this.paintPolygonStroke(
tempShape, lineStyle, contextStrokeStyle, holes, holesDirection, worldAlpha, context
);
}
}
else if (data.type === SHAPES.RECT)
{
const tempShape = shape as Rectangle;
if (fillStyle.visible)
{
context.globalAlpha = fillStyle.alpha * worldAlpha;
context.fillStyle = contextFillStyle;
context.fillRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height);
}
if (lineStyle.visible)
{
const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));
const width = tempShape.width + (2 * alignmentOffset);
const height = tempShape.height + (2 * alignmentOffset);
context.globalAlpha = lineStyle.alpha * worldAlpha;
context.strokeStyle = contextStrokeStyle;
context.strokeRect(tempShape.x - alignmentOffset, tempShape.y - alignmentOffset, width, height);
}
}
else if (data.type === SHAPES.CIRC)
{
const tempShape = shape as Circle;
// TODO - need to be Undefined!
context.beginPath();
context.arc(tempShape.x, tempShape.y, tempShape.radius, 0, 2 * Math.PI);
context.closePath();
if (fillStyle.visible)
{
context.globalAlpha = fillStyle.alpha * worldAlpha;
context.fillStyle = contextFillStyle;
context.fill();
}
if (lineStyle.visible)
{
if (lineStyle.alignment !== 0.5)
{
const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));
context.beginPath();
context.arc(tempShape.x, tempShape.y, tempShape.radius + alignmentOffset, 0, 2 * Math.PI);
context.closePath();
}
context.globalAlpha = lineStyle.alpha * worldAlpha;
context.strokeStyle = contextStrokeStyle;
context.stroke();
}
}
else if (data.type === SHAPES.ELIP)
{
const tempShape = shape as Ellipse;
const drawShapeOverStroke = lineStyle.alignment === 1;
if (!drawShapeOverStroke)
{
this.paintEllipse(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);
}
if (lineStyle.visible)
{
if (lineStyle.alignment !== 0.5)
{
const kappa = 0.5522848;
const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));
const sW = (tempShape.width + alignmentOffset) * 2;
const sH = (tempShape.height + alignmentOffset) * 2;
const sX = tempShape.x - (sW / 2);
const sY = tempShape.y - (sH / 2);
const sOx = (sW / 2) * kappa;
const sOy = (sH / 2) * kappa;
const sXe = sX + sW;
const sYe = sY + sH;
const sXm = sX + (sW / 2);
const sYm = sY + (sH / 2);
context.beginPath();
context.moveTo(sX, sYm);
context.bezierCurveTo(sX, sYm - sOy, sXm - sOx, sY, sXm, sY);
context.bezierCurveTo(sXm + sOx, sY, sXe, sYm - sOy, sXe, sYm);
context.bezierCurveTo(sXe, sYm + sOy, sXm + sOx, sYe, sXm, sYe);
context.bezierCurveTo(sXm - sOx, sYe, sX, sYm + sOy, sX, sYm);
context.closePath();
}
context.globalAlpha = lineStyle.alpha * worldAlpha;
context.strokeStyle = contextStrokeStyle;
context.stroke();
}
if (drawShapeOverStroke)
{
this.paintEllipse(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);
}
}
else if (data.type === SHAPES.RREC)
{
const tempShape = shape as RoundedRectangle;
const drawShapeOverStroke = lineStyle.alignment === 1;
if (!drawShapeOverStroke)
{
this.paintRoundedRectangle(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);
}
if (lineStyle.visible)
{
if (lineStyle.alignment !== 0.5)
{
const width = tempShape.width;
const height = tempShape.height;
const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));
const sRx = tempShape.x - alignmentOffset;
const sRy = tempShape.y - alignmentOffset;
const sWidth = tempShape.width + (2 * alignmentOffset);
const sHeight = tempShape.height + (2 * alignmentOffset);
const radiusOffset = alignmentOffset * (lineStyle.alignment >= 1
? Math.min(sWidth / width, sHeight / height) : Math.min(width / sWidth, height / sHeight));
let sRadius = tempShape.radius + radiusOffset;
const sMaxRadius = Math.min(sWidth, sHeight) / 2;
sRadius = sRadius > sMaxRadius ? sMaxRadius : sRadius;
context.beginPath();
context.moveTo(sRx, sRy + sRadius);
context.lineTo(sRx, sRy + sHeight - sRadius);
context.quadraticCurveTo(sRx, sRy + sHeight, sRx + sRadius, sRy + sHeight);
context.lineTo(sRx + sWidth - sRadius, sRy + sHeight);
context.quadraticCurveTo(sRx + sWidth, sRy + sHeight, sRx + sWidth, sRy + sHeight - sRadius);
context.lineTo(sRx + sWidth, sRy + sRadius);
context.quadraticCurveTo(sRx + sWidth, sRy, sRx + sWidth - sRadius, sRy);
context.lineTo(sRx + sRadius, sRy);
context.quadraticCurveTo(sRx, sRy, sRx, sRy + sRadius);
context.closePath();
}
context.globalAlpha = lineStyle.alpha * worldAlpha;
context.strokeStyle = contextStrokeStyle;
context.stroke();
}
if (drawShapeOverStroke)
{
this.paintRoundedRectangle(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);
}
}
}
}
/**
* Paint stroke for polygon and holes
* @private
* @param shape - Shape to be drawn
* @param lineStyle - Line style for the shape
* @param contextStrokeStyle - The strokeStyle for the canvas context
* @param holes - Holes to be added to the shape
* @param holesDirection -
* @param worldAlpha - The multiplied alpha of the displayObject
* @param context - The canvas context
*/
private paintPolygonStroke(
shape: Polygon, lineStyle: LineStyle, contextStrokeStyle: string | CanvasPattern,
holes: GraphicsData[], holesDirection: boolean[],
worldAlpha: number, context: CrossPlatformCanvasRenderingContext2D
): void
{
if (lineStyle.alignment !== 0.5)
{
const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));
let offsetPoints = PolygonUtils.offsetPolygon(shape.points, alignmentOffset);
let points;
context.beginPath();
context.moveTo(offsetPoints[0], offsetPoints[1]);
for (let j = 2; j < offsetPoints.length; j += 2)
{
context.lineTo(offsetPoints[j], offsetPoints[j + 1]);
}
if (shape.closeStroke)
{
context.closePath();
}
for (let k = 0; k < holes.length; k++)
{
points = (holes[k].shape as Polygon).points;
offsetPoints = PolygonUtils.offsetPolygon(points, alignmentOffset);
if (holesDirection[k])
{
context.moveTo(offsetPoints[0], offsetPoints[1]);
for (let j = 2; j < offsetPoints.length; j += 2)
{
context.lineTo(offsetPoints[j], offsetPoints[j + 1]);
}
}
else
{
context.moveTo(offsetPoints[offsetPoints.length - 2], offsetPoints[offsetPoints.length - 1]);
for (let j = offsetPoints.length - 4; j >= 0; j -= 2)
{
context.lineTo(offsetPoints[j], offsetPoints[j + 1]);
}
}
if ((holes[k].shape as Polygon).closeStroke)
{
context.closePath();
}
}
}
context.globalAlpha = lineStyle.alpha * worldAlpha;
context.strokeStyle = contextStrokeStyle;
context.stroke();
}
/**
* Paint Ellipse
* @private
* @param shape - Shape to be drawn
* @param fillStyle - Fill for the shape
* @param lineStyle - Line style for the shape
* @param contextFillStyle - The canvas context fill style
* @param worldAlpha - The multiplied alpha of the displayObject
* @param context - The canvas context
*/
private paintEllipse(
shape: Ellipse, fillStyle: FillStyle, lineStyle: LineStyle,
contextFillStyle: string | CanvasPattern, worldAlpha: number,
context: CrossPlatformCanvasRenderingContext2D): void
{
// ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
const w = shape.width * 2;
const h = shape.height * 2;
const x = shape.x - (w / 2);
const y = shape.y - (h / 2);
const kappa = 0.5522848;
const ox = (w / 2) * kappa; // control point offset horizontal
const oy = (h / 2) * kappa; // control point offset vertical
const xe = x + w; // x-end
const ye = y + h; // y-end
const xm = x + (w / 2); // x-middle
const ym = y + (h / 2); // y-middle
if (lineStyle.alignment === 0)
{
context.save();
}
context.beginPath();
context.moveTo(x, ym);
context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
context.closePath();
if (lineStyle.alignment === 0)
{
context.clip();
}
if (fillStyle.visible)
{
context.globalAlpha = fillStyle.alpha * worldAlpha;
context.fillStyle = contextFillStyle;
context.fill();
}
if (lineStyle.alignment === 0)
{
context.restore();
}
}
/**
* Paint Rounded Rectangle
* @private
* @param shape - Shape to be drawn
* @param fillStyle - Fill for the shape
* @param lineStyle - Line style for the shape
* @param contextFillStyle - The canvas context fill style
* @param worldAlpha - The multiplied alpha of the displayObject
* @param context - The canvas context
*/
private paintRoundedRectangle(
shape: RoundedRectangle, fillStyle: FillStyle, lineStyle: LineStyle,
contextFillStyle: string | CanvasPattern, worldAlpha: number,
context: CrossPlatformCanvasRenderingContext2D
): void
{
const rx = shape.x;
const ry = shape.y;
const width = shape.width;
const height = shape.height;
let radius = shape.radius;
const maxRadius = Math.min(width, height) / 2;
radius = radius > maxRadius ? maxRadius : radius;
if (lineStyle.alignment === 0)
{
context.save();
}
context.beginPath();
context.moveTo(rx, ry + radius);
context.lineTo(rx, ry + height - radius);
context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);
context.lineTo(rx + width - radius, ry + height);
context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);
context.lineTo(rx + width, ry + radius);
context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);
context.lineTo(rx + radius, ry);
context.quadraticCurveTo(rx, ry, rx, ry + radius);
context.closePath();
if (lineStyle.alignment === 0)
{
context.clip();
}
if (fillStyle.visible)
{
context.globalAlpha = fillStyle.alpha * worldAlpha;
context.fillStyle = contextFillStyle;
context.fill();
}
if (lineStyle.alignment === 0)
{
context.restore();
}
}
public setPatternTransform(pattern: CanvasPattern, matrix: Matrix): void
{
if (this._svgMatrix === false)
{
return;
}
if (!this._svgMatrix)
{
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
if (svg && svg.createSVGMatrix)
{
this._svgMatrix = svg.createSVGMatrix();
}
if (!this._svgMatrix || !pattern.setTransform)
{
this._svgMatrix = false;
return;
}
}
(this._svgMatrix as DOMMatrix).a = matrix.a;
(this._svgMatrix as DOMMatrix).b = matrix.b;
(this._svgMatrix as DOMMatrix).c = matrix.c;
(this._svgMatrix as DOMMatrix).d = matrix.d;
(this._svgMatrix as DOMMatrix).e = matrix.tx;
(this._svgMatrix as DOMMatrix).f = matrix.ty;
pattern.setTransform((this._svgMatrix as DOMMatrix).inverse());
}
/** destroy graphics object */
public destroy(): void
{
this.renderer = null;
this._svgMatrix = null;
this._tempMatrix = null;
}
}