admin管理员组

文章数量:1600685

一对一视频聊天app源码,Android开发之取两个色值的中间色

/**
 * 获取两个色值的中间色
 * @param fraction
 * @param startColor
 * @param endColor
 * @return
 */
public static int getCurrentColor(float fraction, int startColor, int endColor) {
    int redCurrent;
    int blueCurrent;
    int greenCurrent;
    int alphaCurrent;
 
    int redStart = Color.red(startColor);
    int blueStart = Color.blue(startColor);
    int greenStart = Color.green(startColor);
    int alphaStart = Color.alpha(startColor);
 
    int redEnd = Color.red(endColor);
    int blueEnd = Color.blue(endColor);
    int greenEnd = Color.green(endColor);
    int alphaEnd = Color.alpha(endColor);
 
    int redDifference = redEnd - redStart;
    int blueDifference = blueEnd - blueStart;
    int greenDifference = greenEnd - greenStart;
    int alphaDifference = alphaEnd - alphaStart;
 
    redCurrent = (int) (redStart + fraction * redDifference);
    blueCurrent = (int) (blueStart + fraction * blueDifference);
    greenCurrent = (int) (greenStart + fraction * greenDifference);
    alphaCurrent = (int) (alphaStart + fraction * alphaDifference);
 
    return Color.argb(alphaCurrent, redCurrent, greenCurrent, blueCurrent);
}

以上就是一对一视频聊天app源码,Android开发之取两个色值的中间色, 更多内容欢迎关注之后的文章

本文标签: 源码两个视频中间色app