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 
17 package android.graphics;
18 
19 import com.android.layoutlib.bridge.impl.DelegateManager;
20 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
21 
22 /**
23  * Delegate implementing the native methods of android.graphics.LayerRasterizer
24  *
25  * Through the layoutlib_create tool, the original native methods of LayerRasterizer have
26  * been replaced by calls to methods of the same name in this delegate class.
27  *
28  * This class behaves like the original native implementation, but in Java, keeping previously
29  * native data into its own objects and mapping them to int that are sent back and forth between
30  * it and the original LayerRasterizer class.
31  *
32  * Because this extends {@link Rasterizer_Delegate}, there's no need to use a
33  * {@link DelegateManager}, as all the Shader classes will be added to the manager
34  * owned by {@link Rasterizer_Delegate}.
35  *
36  * @see Rasterizer_Delegate
37  *
38  */
39 public class LayerRasterizer_Delegate extends Rasterizer_Delegate {
40 
41     // ---- delegate data ----
42 
43     // ---- Public Helper methods ----
44 
45     @Override
isSupported()46     public boolean isSupported() {
47         return false;
48     }
49 
50     @Override
getSupportMessage()51     public String getSupportMessage() {
52         return "Layer Rasterizers are not supported.";
53     }
54 
55     // ---- native methods ----
56 
57     @LayoutlibDelegate
nativeConstructor()58     /*package*/ static long nativeConstructor() {
59         LayerRasterizer_Delegate newDelegate = new LayerRasterizer_Delegate();
60         return sManager.addNewDelegate(newDelegate);
61     }
62 
63     @LayoutlibDelegate
nativeAddLayer(long native_layer, long native_paint, float dx, float dy)64     /*package*/ static void nativeAddLayer(long native_layer, long native_paint, float dx, float dy) {
65 
66     }
67 
68     // ---- Private delegate/helper methods ----
69 }
70