當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。