2 * Copyright 2021 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 package org.skia.androidkit;
10 import android.support.annotation.Nullable;
11 import java.lang.IllegalArgumentException;
13 public class LinearGradient extends Gradient {
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));
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);
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));
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);
38 private static native long nMakeLinear(float x0, float y0, float x1, float y1,
39 float[] colors, float[] pos, int tilemode,
40 long nativeLocalMatrix);