本文整理汇总了Java中android.graphics.Paint.clearShadowLayer方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.clearShadowLayer方法的具体用法?Java Paint.clearShadowLayer怎么用?Java Paint.clearShadowLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Paint
的用法示例。
在下文中一共展示了Paint.clearShadowLayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawBoxWithShadow
import android.graphics.Paint; //导入方法依赖的package包/类
private RectF drawBoxWithShadow(Canvas c, Paint p, int width, int height) {
Resources res = mContext.getResources();
float shadowBlur = res.getDimension(R.dimen.widget_preview_shadow_blur);
float keyShadowDistance = res.getDimension(R.dimen.widget_preview_key_shadow_distance);
float corner = res.getDimension(R.dimen.widget_preview_corner_radius);
RectF bounds = new RectF(shadowBlur, shadowBlur,
width - shadowBlur, height - shadowBlur - keyShadowDistance);
p.setColor(Color.WHITE);
// Key shadow
p.setShadowLayer(shadowBlur, 0, keyShadowDistance,
ShadowGenerator.KEY_SHADOW_ALPHA << 24);
c.drawRoundRect(bounds, corner, corner, p);
// Ambient shadow
p.setShadowLayer(shadowBlur, 0, 0,
ColorUtils.setAlphaComponent(Color.BLACK, ShadowGenerator.AMBIENT_SHADOW_ALPHA));
c.drawRoundRect(bounds, corner, corner, p);
p.clearShadowLayer();
return bounds;
}
示例2: draw
import android.graphics.Paint; //导入方法依赖的package包/类
public void draw(Canvas g2, float x, float y) {
float th = thickness / 2;
box.draw(g2, x + space + thickness, y);
Paint st = AjLatexMath.getPaint();
float w = st.getStrokeWidth();
int c = st.getColor();
Style s = st.getStyle();
st.setStrokeWidth(thickness);
st.setStyle(Style.STROKE);
float penth = 0;// (float) Math.abs(1 / g2.getTransform().getScaleX());
g2.drawRect(x + th, y - height + th, x + th + width - shadowRule
- thickness, y + th + depth - shadowRule - thickness, st);
st.setStyle(Style.FILL);
g2.drawRect(x + shadowRule - penth, y + depth - shadowRule - penth, x
- penth + width, y + depth - penth, st);
g2.drawRect(x + width - shadowRule - penth, y - height + th
+ shadowRule, x + width - penth, y + shadowRule + depth - 2
* shadowRule, st);
st.setColor(c);
st.setStrokeWidth(w);
st.setStyle(s);
st.clearShadowLayer();
}
示例3: drawLanguageOnSpacebar
import android.graphics.Paint; //导入方法依赖的package包/类
private void drawLanguageOnSpacebar(final Key key, final Canvas canvas, final Paint paint) {
final Keyboard keyboard = getKeyboard();
if (keyboard == null) {
return;
}
final int width = key.getWidth();
final int height = key.getHeight();
paint.setTextAlign(Align.CENTER);
paint.setTypeface(Typeface.DEFAULT);
paint.setTextSize(mLanguageOnSpacebarTextSize);
final String language = layoutLanguageOnSpacebar(paint, keyboard.mId.mSubtype, width);
// Draw language text with shadow
final float descent = paint.descent();
final float textHeight = -paint.ascent() + descent;
final float baseline = height / 2 + textHeight / 2;
if (mLanguageOnSpacebarTextShadowRadius > 0.0f) {
paint.setShadowLayer(mLanguageOnSpacebarTextShadowRadius, 0, 0,
mLanguageOnSpacebarTextShadowColor);
} else {
paint.clearShadowLayer();
}
paint.setColor(mLanguageOnSpacebarTextColor);
paint.setAlpha(mLanguageOnSpacebarAnimAlpha);
canvas.drawText(language, width / 2, baseline - descent, paint);
paint.clearShadowLayer();
paint.setTextScaleX(1.0f);
}
示例4: draw
import android.graphics.Paint; //导入方法依赖的package包/类
/**
* 画每个县的方法
* @param canvas
* @param paint
* @param isSelect
*/
public void draw(Canvas canvas, Paint paint,boolean isSelect){
if (isSelect){
paint.setStrokeWidth(2);
paint.setStyle(Paint.Style.FILL);
paint.setShadowLayer(8,0,0, Color.WHITE);
canvas.drawPath(path,paint);
paint.clearShadowLayer();
paint.setColor(drawColor);
paint.setStyle(Paint.Style.FILL);
paint.setStrokeWidth(2);
canvas.drawPath(path,paint);
}else{
paint.clearShadowLayer();
paint.setStrokeWidth(1);
paint.setStyle(Paint.Style.FILL);
paint.setColor(drawColor);
canvas.drawPath(path,paint);
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.GRAY);
canvas.drawPath(path,paint);
}
}