mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
This reverts commit 365dad7cc7.
This commit is contained in:
committed by
Svetoslav
parent
365dad7cc7
commit
3170b8696f
@@ -6,7 +6,6 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.BitmapShader;
|
import android.graphics.BitmapShader;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.LinearGradient;
|
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
@@ -50,7 +49,6 @@ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
|
|||||||
private int backgroundColor;
|
private int backgroundColor;
|
||||||
private String backgroundImage;
|
private String backgroundImage;
|
||||||
private Bitmap backgroundBitmap;
|
private Bitmap backgroundBitmap;
|
||||||
private LinearGradientDefinition backgroundGradient;
|
|
||||||
private String backgroundRepeat;
|
private String backgroundRepeat;
|
||||||
private String backgroundPosition;
|
private String backgroundPosition;
|
||||||
private CSSValue[] backgroundPositionParsedCSSValues;
|
private CSSValue[] backgroundPositionParsedCSSValues;
|
||||||
@@ -151,8 +149,6 @@ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
|
|||||||
return backgroundBitmap;
|
return backgroundBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinearGradientDefinition getBackgroundGradient() { return backgroundGradient; }
|
|
||||||
|
|
||||||
public String getBackgroundRepeat() {
|
public String getBackgroundRepeat() {
|
||||||
return backgroundRepeat;
|
return backgroundRepeat;
|
||||||
}
|
}
|
||||||
@@ -227,7 +223,6 @@ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
|
|||||||
int backgroundColor,
|
int backgroundColor,
|
||||||
String backgroundImageUri,
|
String backgroundImageUri,
|
||||||
Bitmap backgroundBitmap,
|
Bitmap backgroundBitmap,
|
||||||
LinearGradientDefinition backgroundGradient,
|
|
||||||
Context context,
|
Context context,
|
||||||
String backgroundRepeat,
|
String backgroundRepeat,
|
||||||
String backgroundPosition,
|
String backgroundPosition,
|
||||||
@@ -255,7 +250,6 @@ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
|
|||||||
this.backgroundColor = backgroundColor;
|
this.backgroundColor = backgroundColor;
|
||||||
this.backgroundImage = backgroundImageUri;
|
this.backgroundImage = backgroundImageUri;
|
||||||
this.backgroundBitmap = backgroundBitmap;
|
this.backgroundBitmap = backgroundBitmap;
|
||||||
this.backgroundGradient = backgroundGradient;
|
|
||||||
this.backgroundRepeat = backgroundRepeat;
|
this.backgroundRepeat = backgroundRepeat;
|
||||||
this.backgroundPosition = backgroundPosition;
|
this.backgroundPosition = backgroundPosition;
|
||||||
this.backgroundPositionParsedCSSValues = backgroundPositionParsedCSSValues;
|
this.backgroundPositionParsedCSSValues = backgroundPositionParsedCSSValues;
|
||||||
@@ -367,24 +361,6 @@ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.backgroundGradient != null) {
|
|
||||||
LinearGradientDefinition def = this.backgroundGradient;
|
|
||||||
Paint backgroundGradientPaint = new Paint();
|
|
||||||
LinearGradient shader = new LinearGradient(
|
|
||||||
def.getStartX() * width, def.getStartY() * height,
|
|
||||||
def.getEndX() * width, def.getEndY() * height,
|
|
||||||
def.getColors(), def.getStops(), Shader.TileMode.MIRROR);
|
|
||||||
backgroundGradientPaint.setAntiAlias(true);
|
|
||||||
backgroundGradientPaint.setFilterBitmap(true);
|
|
||||||
backgroundGradientPaint.setShader(shader);
|
|
||||||
|
|
||||||
if (this.clipPath != null && !this.clipPath.isEmpty()) {
|
|
||||||
drawClipPath(this.clipPath, canvas, backgroundGradientPaint, backgroundBoundsF, this.density);
|
|
||||||
} else {
|
|
||||||
canvas.drawPath(backgroundPath, backgroundGradientPaint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw border
|
// draw border
|
||||||
if (this.clipPath != null && !this.clipPath.isEmpty()) {
|
if (this.clipPath != null && !this.clipPath.isEmpty()) {
|
||||||
float borderWidth = this.getUniformBorderWidth();
|
float borderWidth = this.getUniformBorderWidth();
|
||||||
@@ -410,7 +386,7 @@ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
|
|||||||
float[] borderOuterRadii = {
|
float[] borderOuterRadii = {
|
||||||
borderTopLeftRadius, borderTopLeftRadius,
|
borderTopLeftRadius, borderTopLeftRadius,
|
||||||
borderTopRightRadius, borderTopRightRadius,
|
borderTopRightRadius, borderTopRightRadius,
|
||||||
borderBottomRightRadius, borderBottomRightRadius,
|
borderBottomRightRadius, borderBottomRightRadius,
|
||||||
borderBottomLeftRadius, borderBottomLeftRadius
|
borderBottomLeftRadius, borderBottomLeftRadius
|
||||||
};
|
};
|
||||||
borderPath.addRoundRect(borderOuterRect, borderOuterRadii, Path.Direction.CW);
|
borderPath.addRoundRect(borderOuterRect, borderOuterRadii, Path.Direction.CW);
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
package org.nativescript.widgets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Vultix on 3/12/2018.
|
|
||||||
*/
|
|
||||||
public class LinearGradientDefinition {
|
|
||||||
private float startX;
|
|
||||||
private float startY;
|
|
||||||
private float endX;
|
|
||||||
private float endY;
|
|
||||||
private int[] colors;
|
|
||||||
private float[] stops;
|
|
||||||
|
|
||||||
public float getStartX() { return startX; }
|
|
||||||
public float getStartY() { return startY; }
|
|
||||||
public float getEndX() { return endX; }
|
|
||||||
public float getEndY() { return endY; }
|
|
||||||
public int[] getColors() { return colors; }
|
|
||||||
public float[] getStops() { return stops; }
|
|
||||||
|
|
||||||
public LinearGradientDefinition(float startX, float startY, float endX, float endY, int[] colors, float[] stops) {
|
|
||||||
this.startX = startX;
|
|
||||||
this.startY = startY;
|
|
||||||
this.endX = endX;
|
|
||||||
this.endY = endY;
|
|
||||||
this.colors = colors;
|
|
||||||
this.stops = stops;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user