1 /* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.graphics; 18 19 public class PorterDuff { 20 21 // these value must match their native equivalents. See SkPorterDuff.h 22 public enum Mode { 23 /** [0, 0] */ 24 CLEAR (0), 25 /** [Sa, Sc] */ 26 SRC (1), 27 /** [Da, Dc] */ 28 DST (2), 29 /** [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] */ 30 SRC_OVER (3), 31 /** [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc] */ 32 DST_OVER (4), 33 /** [Sa * Da, Sc * Da] */ 34 SRC_IN (5), 35 /** [Sa * Da, Sa * Dc] */ 36 DST_IN (6), 37 /** [Sa * (1 - Da), Sc * (1 - Da)] */ 38 SRC_OUT (7), 39 /** [Da * (1 - Sa), Dc * (1 - Sa)] */ 40 DST_OUT (8), 41 /** [Da, Sc * Da + (1 - Sa) * Dc] */ 42 SRC_ATOP (9), 43 /** [Sa, Sa * Dc + Sc * (1 - Da)] */ 44 DST_ATOP (10), 45 /** [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] */ 46 XOR (11), 47 /** [Sa + Da - Sa*Da, 48 Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)] */ 49 DARKEN (12), 50 /** [Sa + Da - Sa*Da, 51 Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)] */ 52 LIGHTEN (13), 53 /** [Sa * Da, Sc * Dc] */ 54 MULTIPLY (14), 55 /** [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] */ 56 SCREEN (15), 57 /** Saturate(S + D) */ 58 ADD (16), 59 OVERLAY (17); 60 Mode(int nativeInt)61 Mode(int nativeInt) { 62 this.nativeInt = nativeInt; 63 } 64 65 /** 66 * @hide 67 */ 68 public final int nativeInt; 69 } 70 } 71