Skip to content

Commit a5aa042

Browse files
2.22.4
1 parent 7a842b1 commit a5aa042

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "q5",
3-
"version": "2.22.3",
3+
"version": "2.22.4",
44
"description": "Beginner friendly graphics powered by WebGPU and optimized for interactive art!",
55
"author": "quinton-ashley",
66
"contributors": [

q5.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ Q5.modules.canvas = ($, q) => {
391391
w = null;
392392
}
393393
options ??= arguments[3];
394-
394+
if (typeof options == 'string') options = { renderer: options };
395395
let opt = Object.assign({}, Q5.canvasOptions);
396396
if (typeof options == 'object') Object.assign(opt, options);
397397

@@ -430,6 +430,7 @@ Q5.modules.canvas = ($, q) => {
430430
};
431431

432432
$.createGraphics = function (w, h, opt = {}) {
433+
if (typeof opt == 'string') opt = { renderer: opt };
433434
let g = new Q5('graphics', undefined, opt.renderer || ($._webgpuFallback ? 'webgpu-fallback' : $._renderer));
434435
opt.alpha ??= true;
435436
opt.colorSpace ??= $.canvas.colorSpace;
@@ -655,6 +656,7 @@ Q5.HUE_ROTATE = 13;
655656

656657
Q5.C2D = Q5.P2D = Q5.P2DHDR = 'c2d';
657658
Q5.WEBGL = 'webgl';
659+
Q5.WEBGPU = 'webgpu';
658660

659661
Q5.canvasOptions = {
660662
alpha: false,

q5.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/q5-canvas.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Q5.modules.canvas = ($, q) => {
5252
w = null;
5353
}
5454
options ??= arguments[3];
55-
55+
if (typeof options == 'string') options = { renderer: options };
5656
let opt = Object.assign({}, Q5.canvasOptions);
5757
if (typeof options == 'object') Object.assign(opt, options);
5858

@@ -91,6 +91,7 @@ Q5.modules.canvas = ($, q) => {
9191
};
9292

9393
$.createGraphics = function (w, h, opt = {}) {
94+
if (typeof opt == 'string') opt = { renderer: opt };
9495
let g = new Q5('graphics', undefined, opt.renderer || ($._webgpuFallback ? 'webgpu-fallback' : $._renderer));
9596
opt.alpha ??= true;
9697
opt.colorSpace ??= $.canvas.colorSpace;
@@ -316,6 +317,7 @@ Q5.HUE_ROTATE = 13;
316317

317318
Q5.C2D = Q5.P2D = Q5.P2DHDR = 'c2d';
318319
Q5.WEBGL = 'webgl';
320+
Q5.WEBGPU = 'webgpu';
319321

320322
Q5.canvasOptions = {
321323
alpha: false,

0 commit comments

Comments
 (0)