use of android.graphics.Shader in project android_packages_apps_Gallery2 by LineageOS.
the class ColorValueView method updatePaint.
private void updatePaint() {
float[] hsv = new float[] { mHSVO[0], mHSVO[1], 0f };
int color1 = Color.HSVToColor(hsv);
hsv[2] = 1;
int color2 = Color.HSVToColor(hsv);
Shader sg = new LinearGradient(mBorder, mBorder, mBorder, mHeight - mBorder, color1, color2, Shader.TileMode.CLAMP);
mBarPaint1.setShader(sg);
}
use of android.graphics.Shader in project incubator-weex by apache.
the class WXResourceUtilsTest method testGetShader.
@Test
public void testGetShader() throws Exception {
Shader shader = WXResourceUtils.getShader("linear-gradient(to bottom,#a80077,blue)", 100, 100);
assertNotNull(shader);
shader = WXResourceUtils.getShader("linear-gradient(to bottom,#a80077,rgb(255,255,0))", 100, 100);
assertNotNull(shader);
shader = WXResourceUtils.getShader("linear-gradient(to bottom,#a80077,rgba(255,255,0,0.5))", 100, 100);
assertNotNull(shader);
shader = WXResourceUtils.getShader("gradient", 100, 100);
assertNull(shader);
}
use of android.graphics.Shader in project incubator-weex by apache.
the class WXComponent method setBackgroundImage.
public void setBackgroundImage(@NonNull String bgImage) {
if ("".equals(bgImage.trim())) {
getOrCreateBorder().setImage(null);
} else {
Shader shader = WXResourceUtils.getShader(bgImage, mDomObj.getLayoutWidth(), mDomObj.getLayoutHeight());
getOrCreateBorder().setImage(shader);
}
}
use of android.graphics.Shader in project incubator-weex by apache.
the class BorderDrawable method preparePaint.
private void preparePaint(@BorderWidthStyleColorType int side) {
float borderWidth = getBorderWidth(side);
int color = WXViewUtils.multiplyColorAlpha(getBorderColor(side), mAlpha);
BorderStyle borderStyle = BorderStyle.values()[getBorderStyle(side)];
Shader shader = borderStyle.getLineShader(borderWidth, color, side);
mPaint.setShader(shader);
mPaint.setColor(color);
mPaint.setStrokeCap(Paint.Cap.ROUND);
}
use of android.graphics.Shader in project material-hijri-calendarview by eltohamy.
the class DayView method generateCircleDrawable.
private static Drawable generateCircleDrawable(final int color) {
ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
drawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width, int height) {
return new LinearGradient(0, 0, 0, 0, color, color, Shader.TileMode.REPEAT);
}
});
return drawable;
}
Aggregations