MCPcopy Index your code
hub / github.com/benfry/processing4 / colorCalcARGB

Method colorCalcARGB

core/src/processing/core/PGraphics.java:7750–7766  ·  view source on GitHub ↗

Unpacks AARRGGBB color for direct use with colorCalc. Handled here with its own function since this is independent of the color mode. Strangely the old version of this code ignored the alpha value. not sure if that was a bug or what. Note, no need for a bounds check for 'argb' since it's

(int argb, float alpha)

Source from the content-addressed store, hash-verified

7748 * Bounds now checked on alpha, however (rev 0225).
7749 */
7750 protected void colorCalcARGB(int argb, float alpha) {
7751 if (alpha == colorModeA) {
7752 calcAi = (argb >> 24) & 0xff;
7753 calcColor = argb;
7754 } else {
7755 calcAi = (int) (((argb >> 24) & 0xff) * PApplet.constrain((alpha / colorModeA), 0, 1));
7756 calcColor = (calcAi << 24) | (argb & 0xFFFFFF);
7757 }
7758 calcRi = (argb >> 16) & 0xff;
7759 calcGi = (argb >> 8) & 0xff;
7760 calcBi = argb & 0xff;
7761 calcA = calcAi / 255.0f;
7762 calcR = calcRi / 255.0f;
7763 calcG = calcGi / 255.0f;
7764 calcB = calcBi / 255.0f;
7765 calcAlpha = (calcAi != 255);
7766 }
7767
7768
7769

Callers 1

colorCalcMethod · 0.95

Calls 1

constrainMethod · 0.95

Tested by

no test coverage detected