Xfermode_Delegate.java revision 4b606da91d2d76dd90a427cb3e37ea7df655e8e0
1/*
2 * Copyright (C) 2010 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
17package android.graphics;
18
19import com.android.layoutlib.bridge.DelegateManager;
20
21/**
22 * Delegate implementing the native methods of android.graphics.Xfermode
23 *
24 * Through the layoutlib_create tool, the original native methods of Xfermode have been replaced
25 * by calls to methods of the same name in this delegate class.
26 *
27 * This class behaves like the original native implementation, but in Java, keeping previously
28 * native data into its own objects and mapping them to int that are sent back and forth between
29 * it and the original Xfermode class.
30 *
31 * This also serve as a base class for all Xfermode delegate classes.
32 *
33 * @see DelegateManager
34 *
35 */
36public class Xfermode_Delegate {
37
38    // ---- delegate manager ----
39    protected static final DelegateManager<Xfermode_Delegate> sManager =
40            new DelegateManager<Xfermode_Delegate>();
41
42    // ---- delegate helper data ----
43
44    // ---- delegate data ----
45
46    // ---- Public Helper methods ----
47
48    public static Xfermode_Delegate getDelegate(int native_instance) {
49        return sManager.getDelegate(native_instance);
50    }
51
52    // ---- native methods ----
53
54    /*package*/ static void finalizer(int native_instance) {
55        sManager.removeDelegate(native_instance);
56    }
57
58    // ---- Private delegate/helper methods ----
59
60}
61