|
13 | 13 | import Filters from './filters';
|
14 | 14 | import { Renderer } from '../core/p5.Renderer';
|
15 | 15 |
|
| 16 | +let fnRef; |
| 17 | + |
16 | 18 | class Image {
|
17 | 19 | constructor(width, height) {
|
18 | 20 | this.width = width;
|
@@ -939,7 +941,7 @@ class Image {
|
939 | 941 | * @param {Integer} dh
|
940 | 942 | */
|
941 | 943 | copy(...args) {
|
942 |
| - fn.copy.apply(this, args); |
| 944 | + fnRef.copy.apply(this, args); |
943 | 945 | }
|
944 | 946 |
|
945 | 947 | /**
|
@@ -1373,7 +1375,7 @@ class Image {
|
1373 | 1375 | */
|
1374 | 1376 | blend(...args) {
|
1375 | 1377 | // p5._validateParameters('p5.Image.blend', arguments);
|
1376 |
| - fn.blend.apply(this, args); |
| 1378 | + fnRef.blend.apply(this, args); |
1377 | 1379 | this.setModified(true);
|
1378 | 1380 | }
|
1379 | 1381 |
|
@@ -1459,9 +1461,9 @@ class Image {
|
1459 | 1461 | */
|
1460 | 1462 | save(filename, extension) {
|
1461 | 1463 | if (this.gifProperties) {
|
1462 |
| - fn.encodeAndDownloadGif(this, filename); |
| 1464 | + fnRef.encodeAndDownloadGif(this, filename); |
1463 | 1465 | } else {
|
1464 |
| - fn.saveCanvas(this.canvas, filename, extension); |
| 1466 | + fnRef.saveCanvas(this.canvas, filename, extension); |
1465 | 1467 | }
|
1466 | 1468 | }
|
1467 | 1469 |
|
@@ -1820,6 +1822,8 @@ class Image {
|
1820 | 1822 | };
|
1821 | 1823 |
|
1822 | 1824 | function image(p5, fn){
|
| 1825 | + fnRef = fn; |
| 1826 | + |
1823 | 1827 | /**
|
1824 | 1828 | * A class to describe an image.
|
1825 | 1829 | *
|
|
0 commit comments