textmode.js 0.1.6-beta.7 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -310,9 +310,9 @@ class eA extends X {
310
310
  const n = B / 2, a = this.BA(A - n, t - n), h = this.BA(A + n, t + n);
311
311
  this.QA(a.nx, a.ny, h.nx, h.ny);
312
312
  } else {
313
- const n = -i / o, a = s / o, h = B / 2, C = A + n * h, D = t + a * h, c = A - n * h, u = t - a * h, f = e + n * h, d = r + a * h, m = e - n * h, p = r - a * h, M = this.BA(C, D), v = this.BA(c, u), b = this.BA(f, d), z = this.BA(m, p), y = this.P;
313
+ const n = -i / o, a = s / o, h = B / 2, C = A + n * h, D = t + a * h, c = A - n * h, u = t - a * h, f = e + n * h, d = r + a * h, m = e - n * h, p = r - a * h, M = this.BA(C, D), b = this.BA(c, u), v = this.BA(f, d), z = this.BA(m, p), y = this.P;
314
314
  this.AA(), y.bindBuffer(y.ARRAY_BUFFER, this.N);
315
- const j = new Float32Array([M.nx, M.ny, 0, 0, v.nx, v.ny, 0, 1, b.nx, b.ny, 1, 0, v.nx, v.ny, 0, 1, z.nx, z.ny, 1, 1, b.nx, b.ny, 1, 0]);
315
+ const j = new Float32Array([M.nx, M.ny, 0, 0, b.nx, b.ny, 0, 1, v.nx, v.ny, 1, 0, b.nx, b.ny, 0, 1, z.nx, z.ny, 1, 1, v.nx, v.ny, 1, 0]);
316
316
  y.bufferData(y.ARRAY_BUFFER, j, y.DYNAMIC_DRAW);
317
317
  }
318
318
  const g = this.tA();
@@ -404,10 +404,10 @@ class rA {
404
404
  }
405
405
  $A(A, t, e, r) {
406
406
  if (this.oA !== null) {
407
- const c = (A + e) / 2, u = (t + r) / 2, f = Math.abs(e - A) || 1, d = Math.abs(r - t) || 1, { centerX: m, centerY: p, radians: M, aspectRatio: v } = this.YA(c - f / 2, u - d / 2, f, d);
408
- this.GA("u_rotation", M), this.GA("u_center", [m, p]), this.GA("u_aspectRatio", v);
409
- const b = this.CA > 0 ? this.CA : 1;
410
- return this.aA.iA(A, t, e, r, b), void (this.oA = null);
407
+ const c = (A + e) / 2, u = (t + r) / 2, f = Math.abs(e - A) || 1, d = Math.abs(r - t) || 1, { centerX: m, centerY: p, radians: M, aspectRatio: b } = this.YA(c - f / 2, u - d / 2, f, d);
408
+ this.GA("u_rotation", M), this.GA("u_center", [m, p]), this.GA("u_aspectRatio", b);
409
+ const v = this.CA > 0 ? this.CA : 1;
410
+ return this.aA.iA(A, t, e, r, v), void (this.oA = null);
411
411
  }
412
412
  if (!this.cA || this.CA <= 0) return;
413
413
  const B = this.gA, s = (A + e) / 2, i = (t + r) / 2, o = Math.abs(e - A) || 1, g = Math.abs(r - t) || 1, n = this.uA !== 0;
@@ -1663,7 +1663,7 @@ class xA {
1663
1663
  this.Ke.sB(e, B, r);
1664
1664
  }
1665
1665
  }
1666
- const vA = (E) => class extends E {
1666
+ const bA = (E) => class extends E {
1667
1667
  toString(A = {}) {
1668
1668
  return new H().AB(this, A);
1669
1669
  }
@@ -1677,9 +1677,9 @@ const vA = (E) => class extends E {
1677
1677
  new k().ze(this, A);
1678
1678
  }
1679
1679
  async saveCanvas(A, t = "png", e = {}) {
1680
- await new xA().sB(this.textmodeCanvas, { ...e, filename: A, format: t });
1680
+ await new xA().sB(this.bt, { ...e, filename: A, format: t });
1681
1681
  }
1682
- }, bA = (E) => class extends E {
1682
+ }, vA = (E) => class extends E {
1683
1683
  async loadFont(A) {
1684
1684
  return this.et.It(A).then(() => {
1685
1685
  const t = this.et.maxGlyphDimensions;
@@ -1705,13 +1705,13 @@ class _A {
1705
1705
  Q(this, "WA");
1706
1706
  Q(this, "et");
1707
1707
  Q(this, "oB");
1708
- Q(this, "textmodeCanvas");
1708
+ Q(this, "bt");
1709
1709
  Q(this, "zt");
1710
1710
  }
1711
1711
  }
1712
1712
  class J extends function(t, ...e) {
1713
1713
  return e.reduce((r, B) => B(r), t);
1714
- }(_A, lA, vA, bA, yA) {
1714
+ }(_A, lA, bA, vA, yA) {
1715
1715
  constructor(t = null, e = {}) {
1716
1716
  super();
1717
1717
  Q(this, "St");
@@ -1740,9 +1740,9 @@ class J extends function(t, ...e) {
1740
1740
  static async create(t = null, e = {}) {
1741
1741
  const r = new this(t, e), B = r.mB ? e : void 0;
1742
1742
  let s, i;
1743
- r.textmodeCanvas = new gA(r.captureSource, r.mB, B), r.WA = new rA(r.textmodeCanvas.Rt()), r.mB ? (s = e.width || 800, i = e.height || 600) : (s = r.textmodeCanvas.width || 800, i = r.textmodeCanvas.height || 600), r.nB = r.WA.TA(s, i), r.et = new QA(r.WA, e.fontSize ?? 16), await r.et.Ct(e.fontSource);
1743
+ r.bt = new gA(r.captureSource, r.mB, B), r.WA = new rA(r.bt.Rt()), r.mB ? (s = e.width || 800, i = e.height || 600) : (s = r.bt.width || 800, i = r.bt.height || 600), r.nB = r.WA.TA(s, i), r.et = new QA(r.WA, e.fontSize ?? 16), await r.et.Ct(e.fontSource);
1744
1744
  const o = r.et.maxGlyphDimensions;
1745
- return r.zt = new oA(r.textmodeCanvas.canvas, o.width, o.height), r.oB = new hA(r.WA, r.et, r.zt), r.bB(), r.xB(), r;
1745
+ return r.zt = new oA(r.bt.canvas, o.width, o.height), r.oB = new hA(r.WA, r.et, r.zt), r.bB(), r.xB(), r;
1746
1746
  }
1747
1747
  bB() {
1748
1748
  this.vB = () => {
@@ -1755,7 +1755,7 @@ class J extends function(t, ...e) {
1755
1755
  this.MB(), this.IB++, this.dB ? console.warn("Cannot render: Required resources have been disposed") : (this.mB ? (this.nB.begin(), this.pB(), this.nB.end()) : this.nB.update(this.St), this.oB.hasEnabledConverters() ? (this.oB.le(this.nB), this.WA.SA(0), this.WA.kA(this.oB.texture, this.zt.offsetX, this.zt.offsetY, this.oB.texture.width, this.oB.texture.height)) : (this.WA.OA(), this.WA.kA(this.nB, this.zt.offsetX, this.zt.offsetY, this.nB.width, this.nB.height)));
1756
1756
  }
1757
1757
  yB() {
1758
- this.textmodeCanvas.$t(), this.nB.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this.zt.$t(), this.oB.$t(), this.WA.UA(), this.aB !== "manual" && this.render();
1758
+ this.bt.$t(), this.nB.resize(this.bt.width, this.bt.height), this.zt.$t(), this.oB.$t(), this.WA.UA(), this.aB !== "manual" && this.render();
1759
1759
  }
1760
1760
  xB() {
1761
1761
  if (this.aB !== "auto" || !this.cB) return;
@@ -1806,7 +1806,7 @@ class J extends function(t, ...e) {
1806
1806
  this._B = t;
1807
1807
  }
1808
1808
  resizeCanvas(t, e) {
1809
- this.textmodeCanvas.$t(t, e), this.nB.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this.zt.$t(), this.oB.$t(), this.WA.UA(), this.aB !== "manual" && this.render();
1809
+ this.bt.$t(t, e), this.nB.resize(this.bt.width, this.bt.height), this.zt.$t(), this.oB.$t(), this.WA.UA(), this.aB !== "manual" && this.render();
1810
1810
  }
1811
1811
  destroy() {
1812
1812
  this.dB || (this.GB(), window.removeEventListener("resize", this.vB), this.Ut && this.Ut.disconnect(), this.oB.S(), this.et.S(), this.nB.S(), this.WA.S(), this.dB = !0);
@@ -1830,10 +1830,13 @@ class J extends function(t, ...e) {
1830
1830
  this.IB = t;
1831
1831
  }
1832
1832
  get width() {
1833
- return this.textmodeCanvas.width;
1833
+ return this.bt.width;
1834
1834
  }
1835
1835
  get height() {
1836
- return this.textmodeCanvas.height;
1836
+ return this.bt.height;
1837
+ }
1838
+ get canvas() {
1839
+ return this.bt;
1837
1840
  }
1838
1841
  get isDisposed() {
1839
1842
  return this.dB;
@@ -1851,7 +1854,7 @@ class L {
1851
1854
  P.u(A);
1852
1855
  }
1853
1856
  static get version() {
1854
- return "0.1.6-beta.7";
1857
+ return "0.1.7";
1855
1858
  }
1856
1859
  }
1857
1860
  const MA = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), RA = L.create, FA = L.setErrorLevel, UA = L.version;
@@ -740,10 +740,10 @@ class ht {
740
740
  h(this, "fe");
741
741
  h(this, "de", "UrsaFont");
742
742
  h(this, "me");
743
- h(this, "pe");
744
743
  h(this, "ge");
744
+ h(this, "pe");
745
745
  h(this, "_e");
746
- this.he = e, this.me = new it(), this.pe = new ot(t), this.ge = new nt(), this._e = new at();
746
+ this.he = e, this.me = new it(), this.ge = new ot(t), this.pe = new nt(), this._e = new at();
747
747
  }
748
748
  async ve(t) {
749
749
  let e;
@@ -757,8 +757,8 @@ class ht {
757
757
  }
758
758
  we(t) {
759
759
  if (t === void 0) return this.he;
760
- this.he = t, this.ue = this.ge.calculateMaxGlyphDimensions(this.ne.map((r) => r.character), this.he, this.de);
761
- const e = this.pe.createTextureAtlas(this.ne, this.ue, this.he, this.de);
760
+ this.he = t, this.ue = this.pe.calculateMaxGlyphDimensions(this.ne.map((r) => r.character), this.he, this.de);
761
+ const e = this.ge.createTextureAtlas(this.ne, this.ue, this.he, this.de);
762
762
  this.ae = e.framebuffer, this.le = e.columns, this.ce = e.rows;
763
763
  }
764
764
  async Ce(t) {
@@ -780,8 +780,8 @@ class ht {
780
780
  }
781
781
  async be() {
782
782
  const t = this.me.extractCharacters(this.oe), e = this.me.filterProblematicCharacters(t);
783
- this.ne = this._e.createCharacterObjects(e, this.oe), this.ue = this.ge.calculateMaxGlyphDimensions(e, this.he, this.de);
784
- const r = this.pe.createTextureAtlas(this.ne, this.ue, this.he, this.de);
783
+ this.ne = this._e.createCharacterObjects(e, this.oe), this.ue = this.pe.calculateMaxGlyphDimensions(e, this.he, this.de);
784
+ const r = this.ge.createTextureAtlas(this.ne, this.ue, this.he, this.de);
785
785
  this.ae = r.framebuffer, this.le = r.columns, this.ce = r.rows;
786
786
  }
787
787
  getCharacterColor(t) {
@@ -1170,14 +1170,14 @@ class ft {
1170
1170
  h(this, "ur");
1171
1171
  h(this, "dr");
1172
1172
  h(this, "mr");
1173
- h(this, "pr");
1174
1173
  h(this, "gr");
1174
+ h(this, "pr");
1175
1175
  h(this, "We");
1176
1176
  h(this, "Ne");
1177
1177
  h(this, "Xe");
1178
1178
  h(this, "qe");
1179
1179
  h(this, "Ye");
1180
- this.Zt = t, this.oe = e, this.je = r, this.gr = this.Zt.zt(Z, "precision mediump float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D u_primaryColorTexture;uniform sampler2D u_secondaryColorTexture;uniform sampler2D u_transformTexture;uniform sampler2D u_asciiCharacterTexture;uniform sampler2D u_rotationTexture;uniform sampler2D u_captureTexture;uniform vec2 u_captureDimensions;uniform int u_backgroundMode;uniform vec2 u_gridCellDimensions;uniform vec2 u_gridPixelDimensions;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){vec2 adjustedCoord=gl_FragCoord.xy/u_gridPixelDimensions;vec2 gridCoord=adjustedCoord*u_gridCellDimensions;vec2 cellCoord=floor(gridCoord);vec2 charIndexTexCoord=(cellCoord+0.5)/u_gridCellDimensions;vec4 primaryColor=texture2D(u_primaryColorTexture,charIndexTexCoord);vec4 secondaryColor=texture2D(u_secondaryColorTexture,charIndexTexCoord);vec4 transformColor=texture2D(u_transformTexture,charIndexTexCoord);bool isInverted=transformColor.r>0.5;bool flipHorizontal=transformColor.g>0.5;bool flipVertical=transformColor.b>0.5;vec4 encodedIndexVec=texture2D(u_asciiCharacterTexture,charIndexTexCoord);if(encodedIndexVec.a<0.01){gl_FragColor=(u_backgroundMode==0)? vec4(0.0):texture2D(u_captureTexture,gl_FragCoord.xy/u_captureDimensions);return;}int charIndex=int(encodedIndexVec.r*255.0+0.5)+int(encodedIndexVec.g*255.0+0.5)*256;int charCol=int(mod(float(charIndex),u_charsetDimensions.x));int charRow=charIndex/int(u_charsetDimensions.x);float flippedRow=(u_charsetDimensions.y-1.0)-float(charRow);vec2 charCoord=vec2(float(charCol),flippedRow)/u_charsetDimensions;vec4 rotationColor=texture2D(u_rotationTexture,charIndexTexCoord);float scaledAngle=rotationColor.r*255.0+rotationColor.g;float rotationAngle=(scaledAngle*360.0/255.0)*0.017453292;vec2 fractionalPart=fract(gridCoord)-0.5;if(flipHorizontal)fractionalPart.x=-fractionalPart.x;if(flipVertical)fractionalPart.y=-fractionalPart.y;fractionalPart=rotate2D(rotationAngle)*fractionalPart+0.5;vec2 cellSize=1.0/u_charsetDimensions;vec2 texCoord=charCoord+fractionalPart*cellSize;vec2 cellMax=charCoord+cellSize;if(any(lessThan(texCoord,charCoord))||any(greaterThan(texCoord,cellMax))){gl_FragColor=isInverted ? primaryColor : secondaryColor;return;}vec4 charTexel=texture2D(u_characterTexture,texCoord);if(isInverted)charTexel.rgb=1.0-charTexel.rgb;gl_FragColor=mix(secondaryColor,primaryColor,charTexel);}"), this.dr = new I(t, e, r), this.mr = new U(t, e, r), this.ur = [this.dr, this.mr], this.We = this.Zt.Et(r.cols, r.rows), this.Ne = this.Zt.Et(r.cols, r.rows), this.Xe = this.Zt.Et(r.cols, r.rows), this.qe = this.Zt.Et(r.cols, r.rows), this.Ye = this.Zt.Et(r.cols, r.rows), this.pr = this.Zt.Et(this.je.width, this.je.height);
1180
+ this.Zt = t, this.oe = e, this.je = r, this.pr = this.Zt.zt(Z, "precision mediump float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D u_primaryColorTexture;uniform sampler2D u_secondaryColorTexture;uniform sampler2D u_transformTexture;uniform sampler2D u_asciiCharacterTexture;uniform sampler2D u_rotationTexture;uniform sampler2D u_captureTexture;uniform vec2 u_captureDimensions;uniform int u_backgroundMode;uniform vec2 u_gridCellDimensions;uniform vec2 u_gridPixelDimensions;mat2 rotate2D(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){vec2 adjustedCoord=gl_FragCoord.xy/u_gridPixelDimensions;vec2 gridCoord=adjustedCoord*u_gridCellDimensions;vec2 cellCoord=floor(gridCoord);vec2 charIndexTexCoord=(cellCoord+0.5)/u_gridCellDimensions;vec4 primaryColor=texture2D(u_primaryColorTexture,charIndexTexCoord);vec4 secondaryColor=texture2D(u_secondaryColorTexture,charIndexTexCoord);vec4 transformColor=texture2D(u_transformTexture,charIndexTexCoord);bool isInverted=transformColor.r>0.5;bool flipHorizontal=transformColor.g>0.5;bool flipVertical=transformColor.b>0.5;vec4 encodedIndexVec=texture2D(u_asciiCharacterTexture,charIndexTexCoord);if(encodedIndexVec.a<0.01){gl_FragColor=(u_backgroundMode==0)? vec4(0.0):texture2D(u_captureTexture,gl_FragCoord.xy/u_captureDimensions);return;}int charIndex=int(encodedIndexVec.r*255.0+0.5)+int(encodedIndexVec.g*255.0+0.5)*256;int charCol=int(mod(float(charIndex),u_charsetDimensions.x));int charRow=charIndex/int(u_charsetDimensions.x);float flippedRow=(u_charsetDimensions.y-1.0)-float(charRow);vec2 charCoord=vec2(float(charCol),flippedRow)/u_charsetDimensions;vec4 rotationColor=texture2D(u_rotationTexture,charIndexTexCoord);float scaledAngle=rotationColor.r*255.0+rotationColor.g;float rotationAngle=(scaledAngle*360.0/255.0)*0.017453292;vec2 fractionalPart=fract(gridCoord)-0.5;if(flipHorizontal)fractionalPart.x=-fractionalPart.x;if(flipVertical)fractionalPart.y=-fractionalPart.y;fractionalPart=rotate2D(rotationAngle)*fractionalPart+0.5;vec2 cellSize=1.0/u_charsetDimensions;vec2 texCoord=charCoord+fractionalPart*cellSize;vec2 cellMax=charCoord+cellSize;if(any(lessThan(texCoord,charCoord))||any(greaterThan(texCoord,cellMax))){gl_FragColor=isInverted ? primaryColor : secondaryColor;return;}vec4 charTexel=texture2D(u_characterTexture,texCoord);if(isInverted)charTexel.rgb=1.0-charTexel.rgb;gl_FragColor=mix(secondaryColor,primaryColor,charTexel);}"), this.dr = new I(t, e, r), this.mr = new U(t, e, r), this.ur = [this.dr, this.mr], this.We = this.Zt.Et(r.cols, r.rows), this.Ne = this.Zt.Et(r.cols, r.rows), this.Xe = this.Zt.Et(r.cols, r.rows), this.qe = this.Zt.Et(r.cols, r.rows), this.Ye = this.Zt.Et(r.cols, r.rows), this.gr = this.Zt.Et(this.je.width, this.je.height);
1181
1181
  }
1182
1182
  _r(t) {
1183
1183
  for (const r of this.ur) r.options.enabled && r instanceof k && r.cr(t);
@@ -1186,7 +1186,7 @@ class ft {
1186
1186
  for (const i of this.ur) i.options.enabled && this.Zt.Ot(s(i), 0, 0);
1187
1187
  r.end();
1188
1188
  };
1189
- e(this.We, (r) => r.characterFramebuffer), e(this.Ne, (r) => r.primaryColorFramebuffer), e(this.Xe, (r) => r.secondaryColorFramebuffer), e(this.qe, (r) => r.rotationFramebuffer), e(this.Ye, (r) => r.transformFramebuffer), this.pr.begin(), this.Zt.Bt(), this.Zt.yt(this.gr), this.Zt.Pt("u_characterTexture", this.oe.fontFramebuffer), this.Zt.Pt("u_charsetDimensions", [this.oe.textureColumns, this.oe.textureRows]), this.Zt.Pt("u_asciiCharacterTexture", this.We.texture), this.Zt.Pt("u_primaryColorTexture", this.Ne.texture), this.Zt.Pt("u_secondaryColorTexture", this.Xe.texture), this.Zt.Pt("u_transformTexture", this.Ye.texture), this.Zt.Pt("u_rotationTexture", this.qe.texture), this.Zt.Pt("u_captureTexture", t.texture), this.Zt.Pt("u_backgroundMode", !1), this.Zt.Pt("u_captureDimensions", [t.width, t.height]), this.Zt.Pt("u_gridCellDimensions", [this.je.cols, this.je.rows]), this.Zt.Pt("u_gridPixelDimensions", [this.je.width, this.je.height]), this.Zt.Ut(0, 0, this.pr.width, this.pr.height), this.pr.end();
1189
+ e(this.We, (r) => r.characterFramebuffer), e(this.Ne, (r) => r.primaryColorFramebuffer), e(this.Xe, (r) => r.secondaryColorFramebuffer), e(this.qe, (r) => r.rotationFramebuffer), e(this.Ye, (r) => r.transformFramebuffer), this.gr.begin(), this.Zt.Bt(), this.Zt.yt(this.pr), this.Zt.Pt("u_characterTexture", this.oe.fontFramebuffer), this.Zt.Pt("u_charsetDimensions", [this.oe.textureColumns, this.oe.textureRows]), this.Zt.Pt("u_asciiCharacterTexture", this.We.texture), this.Zt.Pt("u_primaryColorTexture", this.Ne.texture), this.Zt.Pt("u_secondaryColorTexture", this.Xe.texture), this.Zt.Pt("u_transformTexture", this.Ye.texture), this.Zt.Pt("u_rotationTexture", this.qe.texture), this.Zt.Pt("u_captureTexture", t.texture), this.Zt.Pt("u_backgroundMode", !1), this.Zt.Pt("u_captureDimensions", [t.width, t.height]), this.Zt.Pt("u_gridCellDimensions", [this.je.cols, this.je.rows]), this.Zt.Pt("u_gridPixelDimensions", [this.je.width, this.je.height]), this.Zt.Ut(0, 0, this.gr.width, this.gr.height), this.gr.end();
1190
1190
  }
1191
1191
  add(t) {
1192
1192
  if (!C.p(t === "brightness" || t === "custom", 'Converter type must be either "brightness" or "custom".', { method: "add", providedValue: t })) return;
@@ -1199,7 +1199,7 @@ class ft {
1199
1199
  C.p(e !== -1, "Converter instance not found in pipeline.", { method: "remove", providedValue: t, convertersCount: this.ur.length }) && this.ur.splice(e, 1);
1200
1200
  }
1201
1201
  Pe() {
1202
- this.pr.resize(this.je.width, this.je.height);
1202
+ this.gr.resize(this.je.width, this.je.height);
1203
1203
  const t = this.je.cols, e = this.je.rows;
1204
1204
  this.We.resize(t, e), this.Ne.resize(t, e), this.Xe.resize(t, e), this.qe.resize(t, e), this.Ye.resize(t, e);
1205
1205
  for (const r of this.ur) r.Pe();
@@ -1215,10 +1215,10 @@ class ft {
1215
1215
  }
1216
1216
  P() {
1217
1217
  for (const t of this.ur) t.P();
1218
- this.We.P(), this.Ne.P(), this.Xe.P(), this.qe.P(), this.Ye.P(), this.pr.P(), this.gr.P();
1218
+ this.We.P(), this.Ne.P(), this.Xe.P(), this.qe.P(), this.Ye.P(), this.gr.P(), this.pr.P();
1219
1219
  }
1220
1220
  get texture() {
1221
- return this.pr;
1221
+ return this.gr;
1222
1222
  }
1223
1223
  get characterFramebuffer() {
1224
1224
  return this.We;
@@ -1639,21 +1639,21 @@ class Pt {
1639
1639
  Zr(t) {
1640
1640
  return { format: t.format ?? "png", quality: t.quality ?? 1, scale: t.scale ?? 1, backgroundColor: t.backgroundColor ?? "transparent" };
1641
1641
  }
1642
- ps(t) {
1642
+ gs(t) {
1643
1643
  if (console.log("Validating image export options:", t), !this.Qr.ds(t.format)) throw Error(`Saving '${t.format}' files is not supported`);
1644
1644
  if (t.quality < 0 || t.quality > 1) throw Error("Image quality must be between 0.0 and 1.0");
1645
1645
  if (t.scale <= 0) throw Error("Scale factor must be greater than 0");
1646
1646
  t.scale > 10 && console.warn("Large scale factors may result in very large files and slow performance"), t.format === "jpg" && t.backgroundColor === "transparent" && (t.backgroundColor = "black");
1647
1647
  }
1648
- gs(t, e = {}) {
1648
+ ps(t, e = {}) {
1649
1649
  const r = this.Zr(e);
1650
- if (this.ps(r), r.scale === 1 && r.backgroundColor === "transparent") return this.Yr.hs(t.canvas, r);
1650
+ if (this.gs(r), r.scale === 1 && r.backgroundColor === "transparent") return this.Yr.hs(t.canvas, r);
1651
1651
  const s = this.qr.ns(t, r.scale, r.backgroundColor);
1652
1652
  return this.Yr.hs(s, r);
1653
1653
  }
1654
1654
  async cs(t, e = {}) {
1655
1655
  const r = this.Zr(e);
1656
- if (this.ps(r), r.scale === 1 && r.backgroundColor === "transparent") return await this.Yr.cs(t.canvas, r);
1656
+ if (this.gs(r), r.scale === 1 && r.backgroundColor === "transparent") return await this.Yr.cs(t.canvas, r);
1657
1657
  const s = this.qr.ns(t, r.scale, r.backgroundColor);
1658
1658
  return await this.Yr.cs(s, r);
1659
1659
  }
@@ -1676,7 +1676,7 @@ const Rt = (a) => class extends a {
1676
1676
  new V().Xr(this, t);
1677
1677
  }
1678
1678
  async saveCanvas(t, e = "png", r = {}) {
1679
- await new Pt().us(this.textmodeCanvas, { ...r, filename: t, format: e });
1679
+ await new Pt().us(this.Me, { ...r, filename: t, format: e });
1680
1680
  }
1681
1681
  }, Ft = (a) => class extends a {
1682
1682
  async loadFont(t) {
@@ -1704,7 +1704,7 @@ class At {
1704
1704
  h(this, "Zt");
1705
1705
  h(this, "oe");
1706
1706
  h(this, "_s");
1707
- h(this, "textmodeCanvas");
1707
+ h(this, "Me");
1708
1708
  h(this, "je");
1709
1709
  }
1710
1710
  }
@@ -1739,9 +1739,9 @@ class O extends function(e, ...r) {
1739
1739
  static async create(e = null, r = {}) {
1740
1740
  const s = new this(e, r), i = s.zs ? r : void 0;
1741
1741
  let o, n;
1742
- s.textmodeCanvas = new ct(s.captureSource, s.zs, i), s.Zt = new st(s.textmodeCanvas.He()), s.zs ? (o = r.width || 800, n = r.height || 600) : (o = s.textmodeCanvas.width || 800, n = s.textmodeCanvas.height || 600), s.vs = s.Zt.Et(o, n), s.oe = new ht(s.Zt, r.fontSize ?? 16), await s.oe.ve(r.fontSource);
1742
+ s.Me = new ct(s.captureSource, s.zs, i), s.Zt = new st(s.Me.He()), s.zs ? (o = r.width || 800, n = r.height || 600) : (o = s.Me.width || 800, n = s.Me.height || 600), s.vs = s.Zt.Et(o, n), s.oe = new ht(s.Zt, r.fontSize ?? 16), await s.oe.ve(r.fontSource);
1743
1743
  const l = s.oe.maxGlyphDimensions;
1744
- return s.je = new lt(s.textmodeCanvas.canvas, l.width, l.height), s._s = new ft(s.Zt, s.oe, s.je), s.As(), s.Gs(), s;
1744
+ return s.je = new lt(s.Me.canvas, l.width, l.height), s._s = new ft(s.Zt, s.oe, s.je), s.As(), s.Gs(), s;
1745
1745
  }
1746
1746
  As() {
1747
1747
  this.Us = () => {
@@ -1754,7 +1754,7 @@ class O extends function(e, ...r) {
1754
1754
  this.Ls(), this.Ss++, this.ks ? console.warn("Cannot render: Required resources have been disposed") : (this.zs ? (this.vs.begin(), this.Is(), this.vs.end()) : this.vs.update(this.Ae), this._s.hasEnabledConverters() ? (this._s._r(this.vs), this.Zt.Lt(0), this.Zt.Ot(this._s.texture, this.je.offsetX, this.je.offsetY, this._s.texture.width, this._s.texture.height)) : (this.Zt.Bt(), this.Zt.Ot(this.vs, this.je.offsetX, this.je.offsetY, this.vs.width, this.vs.height)));
1755
1755
  }
1756
1756
  Es() {
1757
- this.textmodeCanvas.Pe(), this.vs.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this.je.Pe(), this._s.Pe(), this.Zt.Ht(), this.bs !== "manual" && this.render();
1757
+ this.Me.Pe(), this.vs.resize(this.Me.width, this.Me.height), this.je.Pe(), this._s.Pe(), this.Zt.Ht(), this.bs !== "manual" && this.render();
1758
1758
  }
1759
1759
  Gs() {
1760
1760
  if (this.bs !== "auto" || !this.Ts) return;
@@ -1805,7 +1805,7 @@ class O extends function(e, ...r) {
1805
1805
  this.Ps = e;
1806
1806
  }
1807
1807
  resizeCanvas(e, r) {
1808
- this.textmodeCanvas.Pe(e, r), this.vs.resize(this.textmodeCanvas.width, this.textmodeCanvas.height), this.je.Pe(), this._s.Pe(), this.Zt.Ht(), this.bs !== "manual" && this.render();
1808
+ this.Me.Pe(e, r), this.vs.resize(this.Me.width, this.Me.height), this.je.Pe(), this._s.Pe(), this.Zt.Ht(), this.bs !== "manual" && this.render();
1809
1809
  }
1810
1810
  destroy() {
1811
1811
  this.ks || (this.Bs(), window.removeEventListener("resize", this.Us), this.Ee && this.Ee.disconnect(), this._s.P(), this.oe.P(), this.vs.P(), this.Zt.P(), this.ks = !0);
@@ -1829,10 +1829,13 @@ class O extends function(e, ...r) {
1829
1829
  this.Ss = e;
1830
1830
  }
1831
1831
  get width() {
1832
- return this.textmodeCanvas.width;
1832
+ return this.Me.width;
1833
1833
  }
1834
1834
  get height() {
1835
- return this.textmodeCanvas.height;
1835
+ return this.Me.height;
1836
+ }
1837
+ get canvas() {
1838
+ return this.Me;
1836
1839
  }
1837
1840
  get isDisposed() {
1838
1841
  return this.ks;
@@ -1850,7 +1853,7 @@ class N {
1850
1853
  C._(t);
1851
1854
  }
1852
1855
  static get version() {
1853
- return "0.1.6-beta.7";
1856
+ return "0.1.7";
1854
1857
  }
1855
1858
  }
1856
1859
  const St = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), Zt = N.create, $t = N.setErrorLevel, Bt = N.version;