2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.graphics.drawable.shapes;
19 import android.graphics.Canvas;
20 import android.graphics.Outline;
21 import android.graphics.Paint;
24 * Creates an arc shape. The arc shape starts at a specified
25 * angle and sweeps clockwise, drawing slices of pie.
26 * The arc can be drawn to a Canvas with its own draw() method,
27 * but more graphical control is available if you instead pass
28 * the ArcShape to a {@link android.graphics.drawable.ShapeDrawable}.
30 public class ArcShape extends RectShape {
35 * ArcShape constructor.
37 * @param startAngle the angle (in degrees) where the arc begins
38 * @param sweepAngle the sweep angle (in degrees). Anything equal to or
39 * greater than 360 results in a complete circle/oval.
41 public ArcShape(float startAngle, float sweepAngle) {
47 public void draw(Canvas canvas, Paint paint) {
48 canvas.drawArc(rect(), mStart, mSweep, true, paint);
52 public void getOutline(Outline outline) {
53 // Since we don't support concave outlines, arc shape does not attempt
54 // to provide an outline.