mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fix for #2439, set bounds on alpha
This commit is contained in:
@@ -7287,14 +7287,15 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* Strangely the old version of this code ignored the alpha
|
||||
* value. not sure if that was a bug or what.
|
||||
* <P>
|
||||
* Note, no need for a bounds check since it's a 32 bit number.
|
||||
* Note, no need for a bounds check for 'argb' since it's a 32 bit number.
|
||||
* Bounds now checked on alpha, however (rev 0225).
|
||||
*/
|
||||
protected void colorCalcARGB(int argb, float alpha) {
|
||||
if (alpha == colorModeA) {
|
||||
calcAi = (argb >> 24) & 0xff;
|
||||
calcColor = argb;
|
||||
} else {
|
||||
calcAi = (int) (((argb >> 24) & 0xff) * (alpha / colorModeA));
|
||||
calcAi = (int) (((argb >> 24) & 0xff) * PApplet.constrain((alpha / colorModeA), 0, 1));
|
||||
calcColor = (calcAi << 24) | (argb & 0xFFFFFF);
|
||||
}
|
||||
calcRi = (argb >> 16) & 0xff;
|
||||
|
||||
+4
-5
@@ -5,6 +5,10 @@ X call revalidate() via reflection
|
||||
X text looks lousy compared to the Apple JVM
|
||||
X mess with rendering hints? (notes in PGraphicsJava2D)
|
||||
X improvements made, but still not amazing.. just at level of Windows/Linux
|
||||
o XML.getChildren() throwing NPE when getInt() called on non-existent var
|
||||
o https://github.com/processing/processing/issues/2367
|
||||
X PGraphics.colorCalcARGB(int, float) doesn't cap alpha
|
||||
X https://github.com/processing/processing/issues/2439
|
||||
|
||||
fixed in 2.1
|
||||
X draw() called again before finishing on OS X (retina issue)
|
||||
@@ -37,14 +41,9 @@ A https://github.com/processing/processing/issues/2416
|
||||
A fix pixels[] array for video capture
|
||||
A https://github.com/processing/processing/issues/2424
|
||||
|
||||
_ PGraphics.colorCalcARGB(int, float) doesn't cap alpha
|
||||
_ https://github.com/processing/processing/issues/2439
|
||||
|
||||
_ tint() not working in PDF (regression from previous release)
|
||||
_ https://github.com/processing/processing/issues/2428
|
||||
|
||||
_ XML.getChildren() fix
|
||||
_ https://github.com/processing/processing/issues/2367
|
||||
_ default font fixes
|
||||
_ https://github.com/processing/processing/issues/2331
|
||||
_ https://github.com/processing/processing/pull/2338
|
||||
|
||||
Reference in New Issue
Block a user