• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 LinearGradient extends Gradient {
LinearGradient(float x0, float y0, float x1, float y1, int[] colors, float[] pos, TileMode tm, @Nullable Matrix localMatrix)14     public LinearGradient(float x0, float y0, float x1, float y1, int[] colors,
15                           float[] pos, TileMode tm,
16                           @Nullable Matrix localMatrix) throws IllegalArgumentException {
17         super(colors, pos, tm, localMatrix,
18             (c, p, t, m) -> nMakeLinear(x0, y0, x1, y1, c, p, t, m));
19     }
20 
LinearGradient(float x0, float y0, float x1, float y1, int[] colors, float[] pos, TileMode tm)21     public LinearGradient(float x0, float y0, float x1, float y1, int[] colors,
22                           float[] pos, TileMode tm) throws IllegalArgumentException {
23         this(x0, y0, x1, y1, colors, pos, tm, null);
24     }
25 
LinearGradient(float x0, float y0, float x1, float y1, float[] colors, float[] pos, TileMode tm, @Nullable Matrix localMatrix)26     public LinearGradient(float x0, float y0, float x1, float y1, float[] colors,
27                           float[] pos, TileMode tm,
28                           @Nullable Matrix localMatrix) throws IllegalArgumentException {
29         super(colors, pos, tm, localMatrix,
30             (c, p, t, m) -> nMakeLinear(x0, y0, x1, y1, c, p, t, m));
31     }
32 
LinearGradient(float x0, float y0, float x1, float y1, float[] colors, float[] pos, TileMode tm)33     public LinearGradient(float x0, float y0, float x1, float y1, float[] colors,
34                           float[] pos, TileMode tm) throws IllegalArgumentException {
35         this(x0, y0, x1, y1, colors, pos, tm, null);
36     }
37 
nMakeLinear(float x0, float y0, float x1, float y1, float[] colors, float[] pos, int tilemode, long nativeLocalMatrix)38     private static native long nMakeLinear(float x0, float y0, float x1, float y1,
39                                            float[] colors, float[] pos, int tilemode,
40                                            long nativeLocalMatrix);
41 }