imageHasAlphaPixel function

bool imageHasAlphaPixel(
  1. Image image
)

True if the decoded image has at least one non-opaque pixel. Short-circuits on the first match. Used by doctor / strict mode for the iOS App Store alpha-rejection rule (upstream #172).

Implementation

bool imageHasAlphaPixel(Image image) {
  if (!image.hasAlpha) {
    return false;
  }
  for (final px in image) {
    if (px.a != 255) {
      return true;
    }
  }
  return false;
}