Android中的裁剪Region.Op参数

892 阅读1分钟
    // the native values for these must match up with the enum in SkRegion.h
    public enum Op {
        DIFFERENCE(0),
        INTERSECT(1),
        UNION(2),
        XOR(3),
        REVERSE_DIFFERENCE(4),
        REPLACE(5);

        Op(int nativeInt) {
            this.nativeInt = nativeInt;
        }

        /**
         * @hide
         */
        public final int nativeInt;
    }

A:表示第一个裁剪的形状;

B:表示第二次裁剪的形状;

Region.Op.DIFFERENCE :A - (A ∩ B)(先画的减去交集)

Region.Op.REPLACE:是只显示B的形状

Region.Op.REVERSE_DIFFERENCE :B - (A ∩ B)(后画的减去交集)

Region.Op.INTERSECT:交集 A ∩ B

Region.Op.UNION:全集 C = A ∪ B

Region.Op.XOR:补集 =(全集-交集)