当前位置: 首页>>代码示例>>Java>>正文


Java Paint.clearShadowLayer方法代码示例

本文整理汇总了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;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:24,代码来源:WidgetPreviewLoader.java

示例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();

}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:26,代码来源:ShadowBox.java

示例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);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:28,代码来源:MainKeyboardView.java

示例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);


    }


}
 
开发者ID:fanxiaole,项目名称:SVG_taiwan_View,代码行数:40,代码来源:CountyItem.java


注:本文中的android.graphics.Paint.clearShadowLayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。