SVGParser.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:iosched-reader 作者:
private void finishGradients() {
    for(Gradient gradient : gradientMap.values()) {
        if (gradient.xlink != null) {
            Gradient parent = gradientMap.get(gradient.xlink);
            if (parent != null) {
                gradient.inherit(parent);
            }
        }
        int[] colors = new int[gradient.colors.size()];
        for (int i = 0; i < colors.length; i++) {
            colors[i] = gradient.colors.get(i);
        }
        float[] positions = new float[gradient.positions.size()];
        for (int i = 0; i < positions.length; i++) {
            positions[i] = gradient.positions.get(i);
        }
        if (colors.length == 0) {
            Log.d("BAD", "BAD gradient, id="+gradient.id);
        }
        if (gradient.isLinear) {
            gradient.shader= new LinearGradient(gradient.x1, gradient.y1, gradient.x2, gradient.y2, colors, positions, gradient.tilemode);
        } else {
            gradient.shader= new RadialGradient(gradient.x, gradient.y, gradient.radius, colors, positions, gradient.tilemode);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号