1282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/*
2282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Copyright (C) 2010 The Android Open Source Project
3282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
4282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Licensed under the Apache License, Version 2.0 (the "License");
5282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * you may not use this file except in compliance with the License.
6282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * You may obtain a copy of the License at
7282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
8282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *      http://www.apache.org/licenses/LICENSE-2.0
9282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
10282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Unless required by applicable law or agreed to in writing, software
11282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * distributed under the License is distributed on an "AS IS" BASIS,
12282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * See the License for the specific language governing permissions and
14282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * limitations under the License.
15282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski */
16282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
17282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskipackage android.graphics;
18282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
19282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport com.android.layoutlib.bridge.impl.DelegateManager;
20282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport com.android.tools.layoutlib.annotations.LayoutlibDelegate;
21282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
22282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport java.awt.Stroke;
23282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
24282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/**
25282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Delegate implementing the native methods of android.graphics.SumPathEffect
26282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
27282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Through the layoutlib_create tool, the original native methods of SumPathEffect have been
28282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * replaced by calls to methods of the same name in this delegate class.
29282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
30282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * This class behaves like the original native implementation, but in Java, keeping previously
31282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * native data into its own objects and mapping them to int that are sent back and forth between
32282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * it and the original SumPathEffect class.
33282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
34282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Because this extends {@link PathEffect_Delegate}, there's no need to use a {@link DelegateManager},
35282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * as all the Shader classes will be added to the manager owned by {@link PathEffect_Delegate}.
36282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
37282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * @see PathEffect_Delegate
38282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
39282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski */
40282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskipublic class SumPathEffect_Delegate extends PathEffect_Delegate {
41282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
42282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    // ---- delegate data ----
43282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
44282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    // ---- Public Helper methods ----
45282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
46282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @Override
47282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    public Stroke getStroke(Paint_Delegate paint) {
48282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // FIXME
49282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        return null;
50282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
51282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
52282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @Override
53282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    public boolean isSupported() {
54282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        return false;
55282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
56282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
57282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @Override
58282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    public String getSupportMessage() {
59282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        return "Sum Path Effects are not supported in Layout Preview mode.";
60282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
61282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
62282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    // ---- native methods ----
63282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
64282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @LayoutlibDelegate
6588a8364c386c694f7ad56662ef89713dbf7c9d63Narayan Kamath    /*package*/ static long nativeCreate(long first, long second) {
66282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        SumPathEffect_Delegate newDelegate = new SumPathEffect_Delegate();
67282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        return sManager.addNewDelegate(newDelegate);
68282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
69282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
70282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    // ---- Private delegate/helper methods ----
71282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski}
72