1 /* 2 * Copyright 2021 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 package org.skia.androidkit; 9 10 import android.support.annotation.Nullable; 11 import java.lang.IllegalArgumentException; 12 13 public class SweepGradient extends Gradient { SweepGradient(float x, float y, float startAngle, float endAngle, int[] colors, float[] pos, TileMode tm, @Nullable Matrix localMatrix)14 public SweepGradient(float x, float y, float startAngle, float endAngle, 15 int[] colors, float[] pos, TileMode tm, 16 @Nullable Matrix localMatrix) throws IllegalArgumentException { 17 super(colors, pos, tm, localMatrix, 18 (c, p, t, m) -> nMakeSweep(x, y, startAngle, endAngle, c, p, t, m)); 19 } 20 SweepGradient(float x, float y, float startAngle, float endAngle, int[] colors, float[] pos, TileMode tm)21 public SweepGradient(float x, float y, float startAngle, float endAngle, 22 int[] colors, float[] pos, TileMode tm) throws IllegalArgumentException { 23 this(x, y, startAngle, endAngle, colors, pos, tm, null); 24 } 25 SweepGradient(float x, float y, int[] colors, float[] pos)26 public SweepGradient(float x, float y, int[] colors, 27 float[] pos) throws IllegalArgumentException { 28 this(x, y, 0, 360, colors, pos, TileMode.CLAMP, null); 29 } 30 SweepGradient(float x, float y, float startAngle, float endAngle, float[] colors, float[] pos, TileMode tm, @Nullable Matrix localMatrix)31 public SweepGradient(float x, float y, float startAngle, float endAngle, 32 float[] colors, float[] pos, TileMode tm, 33 @Nullable Matrix localMatrix) throws IllegalArgumentException { 34 super(colors, pos, tm, localMatrix, 35 (c, p, t, m) -> nMakeSweep(x, y, startAngle, endAngle, c, p, t, m)); 36 } 37 SweepGradient(float x, float y, float startAngle, float endAngle, float[] colors, float[] pos, TileMode tm)38 public SweepGradient(float x, float y, float startAngle, float endAngle, 39 float[] colors, float[] pos, TileMode tm) throws IllegalArgumentException { 40 this(x, y, startAngle, endAngle, colors, pos, tm, null); 41 } 42 SweepGradient(float x, float y, float[] colors, float[] pos)43 public SweepGradient(float x, float y, float[] colors, 44 float[] pos) throws IllegalArgumentException { 45 this(x, y, 0, 360, colors, pos, TileMode.CLAMP, null); 46 } 47 nMakeSweep(float x, float y, float sa, float ea, float[] colors, float[] pos, int tilemode, long nativeLocalMatrix)48 private static native long nMakeSweep(float x, float y, float sa, float ea, 49 float[] colors, float[] pos, 50 int tilemode, long nativeLocalMatrix); 51 } 52