1 /* 2 * Copyright (C) 2008 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 RadialGradient extends Shader { 20 21 /** Create a shader that draws a radial gradient given the center and radius. 22 @param x The x-coordinate of the center of the radius 23 @param y The y-coordinate of the center of the radius 24 @param radius Must be positive. The radius of the circle for this gradient 25 @param colors The colors to be distributed between the center and edge of the circle 26 @param positions May be NULL. The relative position of 27 each corresponding color in the colors array. If this is NULL, 28 the the colors are distributed evenly between the center and edge of the circle. 29 @param tile The Shader tiling mode 30 */ RadialGradient(float x, float y, float radius, int colors[], float positions[], TileMode tile)31 public RadialGradient(float x, float y, float radius, 32 int colors[], float positions[], TileMode tile) { 33 if (radius <= 0) { 34 throw new IllegalArgumentException("radius must be > 0"); 35 } 36 if (colors.length < 2) { 37 throw new IllegalArgumentException("needs >= 2 number of colors"); 38 } 39 if (positions != null && colors.length != positions.length) { 40 throw new IllegalArgumentException("color and position arrays must be of equal length"); 41 } 42 43 // FIXME Implement shader 44 } 45 46 /** Create a shader that draws a radial gradient given the center and radius. 47 @param x The x-coordinate of the center of the radius 48 @param y The y-coordinate of the center of the radius 49 @param radius Must be positive. The radius of the circle for this gradient 50 @param color0 The color at the center of the circle. 51 @param color1 The color at the edge of the circle. 52 @param tile The Shader tiling mode 53 */ RadialGradient(float x, float y, float radius, int color0, int color1, TileMode tile)54 public RadialGradient(float x, float y, float radius, 55 int color0, int color1, TileMode tile) { 56 if (radius <= 0) { 57 throw new IllegalArgumentException("radius must be > 0"); 58 } 59 // FIXME Implement shader 60 } 61 } 62 63