Skip to content

Commit 63dd52b

Browse files
committed
Fix fn not defined in image functions
1 parent 40895d6 commit 63dd52b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/image/p5.Image.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import Filters from './filters';
1414
import { Renderer } from '../core/p5.Renderer';
1515

16+
let fnRef;
17+
1618
class Image {
1719
constructor(width, height) {
1820
this.width = width;
@@ -939,7 +941,7 @@ class Image {
939941
* @param {Integer} dh
940942
*/
941943
copy(...args) {
942-
fn.copy.apply(this, args);
944+
fnRef.copy.apply(this, args);
943945
}
944946

945947
/**
@@ -1373,7 +1375,7 @@ class Image {
13731375
*/
13741376
blend(...args) {
13751377
// p5._validateParameters('p5.Image.blend', arguments);
1376-
fn.blend.apply(this, args);
1378+
fnRef.blend.apply(this, args);
13771379
this.setModified(true);
13781380
}
13791381

@@ -1459,9 +1461,9 @@ class Image {
14591461
*/
14601462
save(filename, extension) {
14611463
if (this.gifProperties) {
1462-
fn.encodeAndDownloadGif(this, filename);
1464+
fnRef.encodeAndDownloadGif(this, filename);
14631465
} else {
1464-
fn.saveCanvas(this.canvas, filename, extension);
1466+
fnRef.saveCanvas(this.canvas, filename, extension);
14651467
}
14661468
}
14671469

@@ -1820,6 +1822,8 @@ class Image {
18201822
};
18211823

18221824
function image(p5, fn){
1825+
fnRef = fn;
1826+
18231827
/**
18241828
* A class to describe an image.
18251829
*

0 commit comments

Comments
 (0)