Skip to content

Commit 2cc6cb8

Browse files
authored
Merge pull request #7713 from processing/fix/image
2.0 bug fixes
2 parents 40895d6 + b4477ba commit 2cc6cb8

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/color/color_spaces/hsb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default new ColorSpace({
5757
toBase,
5858

5959
formats: {
60-
default :{
60+
default: {
6161
type: 'custom',
6262
serialize: (coords, alpha) => {
6363
const rgb = toBase(coords);

src/dom/dom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ function dom(p5, fn){
17551755
inst.push();
17561756
if (value) {
17571757
if (value.mode) {
1758-
inst.colorMode(value.mode, ...value?.maxes[value.mode]);
1758+
inst.colorMode(value.mode, ...(value?.maxes ? value.maxes[value.mode] || [] : []));
17591759
}
17601760
}
17611761
const c = inst.color(this.elt.value);

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)