mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 05:39:18 +01:00
fix updatePixels() and mask()
This commit is contained in:
@@ -913,8 +913,7 @@ public class PGraphicsAndroid2D extends PGraphics {
|
||||
who.format == ARGB, tint ? tintPaint : null);
|
||||
} else {
|
||||
// rect.set(x1, y1, x2, y2);
|
||||
if (who.bitmap == null ||
|
||||
who.width != who.bitmap.getWidth() ||
|
||||
if (who.width != who.bitmap.getWidth() ||
|
||||
who.height != who.bitmap.getHeight()) {
|
||||
// System.out.println("creating bitmap " + who.format + " " +
|
||||
// who.width + "x" + who.height);
|
||||
@@ -925,6 +924,10 @@ public class PGraphicsAndroid2D extends PGraphics {
|
||||
who.modified = true;
|
||||
}
|
||||
if (who.modified) {
|
||||
//System.out.println("mutable, recycled = " + who.bitmap.isMutable() + ", " + who.bitmap.isRecycled());
|
||||
if (!who.bitmap.isMutable()) {
|
||||
who.bitmap = Bitmap.createBitmap(who.width, who.height, Config.ARGB_8888);
|
||||
}
|
||||
who.bitmap.setPixels(who.pixels, 0, who.width, 0, 0, who.width, who.height);
|
||||
who.modified = false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004-08 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-10 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@@ -605,6 +605,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
* Set alpha channel for an image using another image as the source.
|
||||
*/
|
||||
public void mask(PImage alpha) {
|
||||
alpha.loadPixels();
|
||||
mask(alpha.pixels);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user