MCPcopy Index your code
hub / github.com/processing/processing / colorCalcARGB

Method colorCalcARGB

core/src/processing/core/PGraphics.java:7761–7777  ·  view source on GitHub ↗

Unpacks AARRGGBB color for direct use with colorCalc. Handled here with its own function since this is indepenent 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

7759 * Bounds now checked on alpha, however (rev 0225).
7760 */
7761 protected void colorCalcARGB(int argb, float alpha) {
7762 if (alpha == colorModeA) {
7763 calcAi = (argb >> 24) & 0xff;
7764 calcColor = argb;
7765 } else {
7766 calcAi = (int) (((argb >> 24) & 0xff) * PApplet.constrain((alpha / colorModeA), 0, 1));
7767 calcColor = (calcAi << 24) | (argb & 0xFFFFFF);
7768 }
7769 calcRi = (argb >> 16) & 0xff;
7770 calcGi = (argb >> 8) & 0xff;
7771 calcBi = argb & 0xff;
7772 calcA = calcAi / 255.0f;
7773 calcR = calcRi / 255.0f;
7774 calcG = calcGi / 255.0f;
7775 calcB = calcBi / 255.0f;
7776 calcAlpha = (calcAi != 255);
7777 }
7778
7779
7780

Callers 1

colorCalcMethod · 0.95

Calls 1

constrainMethod · 0.95

Tested by

no test coverage detected