private static int alphaBlendingComponent(int foregroundComponent,
                                            int foregroundAlpha,
                                            int backgroundComponent,
                                            int backgroundAlpha) {

    int denominator = 255 * 255 - (255 - foregroundAlpha) * (255 - backgroundAlpha);
    if (denominator == 0) {
      return 0;
    }
    return (255 * foregroundAlpha * foregroundComponent + (255 - foregroundAlpha) * backgroundAlpha * backgroundComponent) / denominator;
  }
private static int alphaBlendingComponent(int foregroundComponent,
                                            int foregroundAlpha,
                                            int backgroundComponent,
                                            int backgroundAlpha)