Here you can find the source of combineAlpha(float[] partsAlpha, int partsN)
Parameter | Description |
---|---|
partsAlpha | alpha values. |
partsN | number of values. |
public static float combineAlpha(float[] partsAlpha, int partsN)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w.j a va 2 s . co m*/ * Combine multiple alpha values. * * @param partsAlpha * alpha values. * @param partsN * number of values. * @return combined alpha */ public static float combineAlpha(float[] partsAlpha, int partsN) { float sumAlpha = 0.f; int count = 0; for (int i = 0; i < partsN; i++) { if (!Float.isNaN(partsAlpha[i])) { sumAlpha += partsAlpha[i]; count++; } } if (count > 0) { return sumAlpha / count; } else { return 0.f; } } }