Skip to content

Commit f6c8fcf

Browse files
committed
Add back global 'pixels', fixes #7482
1 parent fd39484 commit f6c8fcf

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/core/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ class p5 {
182182
}
183183
}
184184

185+
get pixels(){
186+
return this._renderer.pixels;
187+
}
188+
185189
static registerAddon(addon) {
186190
const lifecycles = {};
187191
addon(p5, p5.prototype, lifecycles);

src/core/rendering.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function rendering(p5, fn){
123123
* @param {HTMLCanvasElement} [canvas]
124124
* @return {p5.Renderer}
125125
*/
126-
p5.prototype.createCanvas = function (w, h, renderer, ...args) {
126+
fn.createCanvas = function (w, h, renderer, ...args) {
127127
// p5._validateParameters('createCanvas', arguments);
128128
//optional: renderer, otherwise defaults to p2d
129129

@@ -239,7 +239,7 @@ function rendering(p5, fn){
239239
* </code>
240240
* </div>
241241
*/
242-
p5.prototype.resizeCanvas = function (w, h, noRedraw) {
242+
fn.resizeCanvas = function (w, h, noRedraw) {
243243
// p5._validateParameters('resizeCanvas', arguments);
244244
if (this._renderer) {
245245
// Make sure width and height are updated before the renderer resizes so
@@ -274,7 +274,7 @@ function rendering(p5, fn){
274274
* </code>
275275
* </div>
276276
*/
277-
p5.prototype.noCanvas = function () {
277+
fn.noCanvas = function () {
278278
if (this.canvas) {
279279
this.canvas.parentNode.removeChild(this.canvas);
280280
}
@@ -392,7 +392,7 @@ function rendering(p5, fn){
392392
* @param {HTMLCanvasElement} [canvas]
393393
* @return {p5.Graphics}
394394
*/
395-
p5.prototype.createGraphics = function (w, h, ...args) {
395+
fn.createGraphics = function (w, h, ...args) {
396396
/**
397397
* args[0] is expected to be renderer
398398
* args[1] is expected to be canvas
@@ -541,7 +541,7 @@ function rendering(p5, fn){
541541
* </code>
542542
* </div>
543543
*/
544-
p5.prototype.createFramebuffer = function (options) {
544+
fn.createFramebuffer = function (options) {
545545
return new Framebuffer(this._renderer, options);
546546
};
547547

@@ -625,7 +625,7 @@ function rendering(p5, fn){
625625
* </code>
626626
* </div>
627627
*/
628-
p5.prototype.clearDepth = function (depth) {
628+
fn.clearDepth = function (depth) {
629629
this._assert3d('clearDepth');
630630
this._renderer.clearDepth(depth);
631631
};

0 commit comments

Comments
 (0)