當前位置: 首頁>>代碼示例>>Java>>正文


Java TextPaint.setDither方法代碼示例

本文整理匯總了Java中android.text.TextPaint.setDither方法的典型用法代碼示例。如果您正苦於以下問題:Java TextPaint.setDither方法的具體用法?Java TextPaint.setDither怎麽用?Java TextPaint.setDither使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.text.TextPaint的用法示例。


在下文中一共展示了TextPaint.setDither方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import android.text.TextPaint; //導入方法依賴的package包/類
private void init() {
    circlePaint = new Paint();
    circlePaint.setAntiAlias(true);
    circlePaint.setDither(true);
    circlePaint.setColor(backgroundColor);
    circlePaint.setStyle(Paint.Style.FILL);

    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setDither(true);
    textPaint.setColor(textColor);
    textPaint.setTextSize(textSize);
    textPaint.setTextAlign(Paint.Align.CENTER);

    borderPaint = new Paint();
    borderPaint.setAntiAlias(true);
    borderPaint.setDither(true);
    borderPaint.setColor(borderColor);
    borderPaint.setStrokeWidth(borderWidth);
    borderPaint.setStyle(Paint.Style.STROKE);

    int textWidth = (int) textPaint.measureText(text.substring(0, (text.length() + 1) / 2));
    staticLayout = new StaticLayout(text, textPaint, textWidth, Layout.Alignment.ALIGN_NORMAL, 1F, 0, false);
}
 
開發者ID:ruiqiao2017,項目名稱:Renrentou,代碼行數:25,代碼來源:CountDownView.java

示例2: initPaint

import android.text.TextPaint; //導入方法依賴的package包/類
private void initPaint() {
    mPaint = new TextPaint();
    mPaint.setTextSize(mTextSize);
    mPaint.setColor(mTextColor);
    mPaint.setTypeface(Typeface.DEFAULT);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
}
 
開發者ID:JackWHLiu,項目名稱:jackknife,代碼行數:9,代碼來源:LetterView.java

示例3: initPaint

import android.text.TextPaint; //導入方法依賴的package包/類
private void initPaint() {
    mTextPaint = new TextPaint();
    mTextPaint.setDither(true);
    mTextPaint.setAntiAlias(true);
    switch (mTextAlign) {
        case LEFT:
            mTextPaint.setTextAlign(Paint.Align.LEFT);
            break;
        case CENTER:
            mTextPaint.setTextAlign(Paint.Align.CENTER);
            break;
        case RIGHT:
            mTextPaint.setTextAlign(Paint.Align.RIGHT);
            break;
    }

    mBtnPlayPaint = new Paint();
    mBtnPlayPaint.setDither(true);
    mBtnPlayPaint.setAntiAlias(true);
    mBtnPlayPaint.setColor(mBtnColor);
    mBtnPlayPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mBtnPlayPaint.setAlpha(128);

    mLinePaint = new Paint();
    mLinePaint.setDither(true);
    mLinePaint.setAntiAlias(true);
    mLinePaint.setColor(mLineColor);
    mLinePaint.setAlpha(64);
    mLinePaint.setStrokeWidth(1.0f);
    mLinePaint.setStyle(Paint.Style.STROKE);

    mTimerPaint = new Paint();
    mTimerPaint.setDither(true);
    mTimerPaint.setAntiAlias(true);
    mTimerPaint.setColor(Color.WHITE);
    mTimerPaint.setTextAlign(Paint.Align.RIGHT);
    mTimerPaint.setTextSize(getRawSize(TypedValue.COMPLEX_UNIT_SP, INDICATOR_TIME_TEXT_SIZE));


}
 
開發者ID:Zackratos,項目名稱:PureMusic,代碼行數:41,代碼來源:LyricView.java

示例4: buildSrcFromName

import android.text.TextPaint; //導入方法依賴的package包/類
@SuppressWarnings("ResourceAsColor")
private Bitmap buildSrcFromName(final String firstChar, int w, int h) {
    if (w == Target.SIZE_ORIGINAL || w <= 0)
        w = 80;
    if (h == Target.SIZE_ORIGINAL || h <= 0)
        h = 80;

    final int size = Math.max(Math.min(Math.min(w, h), 220), 64);
    final float fontSize = size * 0.4f;
    log("firstChar:" + firstChar + " size:" + size + " fontSize:" + fontSize);

    Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.RGB_565);

    TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    paint.setAntiAlias(true);
    paint.setDither(true);
    paint.setColor(Color.WHITE);
    paint.setTextAlign(Paint.Align.CENTER);
    paint.setTextSize(fontSize);
    paint.setTypeface(Typeface.SANS_SERIF);

    // check ASCII
    final int charNum = Character.getNumericValue(firstChar.charAt(0));
    if (charNum > 0 && charNum < 177) {
        Typeface typeface = getFont(getContext(), "Numans-Regular.otf");
        if (typeface != null)
            paint.setTypeface(typeface);
    }

    Rect rect = new Rect();
    paint.getTextBounds(firstChar, 0, 1, rect);
    int fontHeight = rect.height();
    log(rect.toString());

    int fontHalfH = fontHeight >> 1;
    int centerX = bitmap.getWidth() >> 1;
    int centerY = bitmap.getHeight() >> 1;

    Canvas canvas = new Canvas(bitmap);
    canvas.drawColor(getBackgroundColor(firstChar));
    canvas.drawText(firstChar, centerX, centerY + fontHalfH, paint);

    return bitmap;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:45,代碼來源:PortraitView.java

示例5: initPaint

import android.text.TextPaint; //導入方法依賴的package包/類
private void initPaint() {
    mTextPaint = new TextPaint();
    mTextPaint.setDither(true);
    mTextPaint.setAntiAlias(true);
    Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/circular_std_book.otf");
    mTextPaint.setTypeface(typeface);

    switch (mTextAlign) {
        case LEFT:
            mTextPaint.setTextAlign(Paint.Align.LEFT);
            break;
        case CENTER:
            mTextPaint.setTextAlign(Paint.Align.CENTER);
            break;
        case RIGHT:
            mTextPaint.setTextAlign(Paint.Align.RIGHT);
            break;
    }

    mBtnPlayPaint = new Paint();
    mBtnPlayPaint.setDither(true);
    mBtnPlayPaint.setAntiAlias(true);
    mBtnPlayPaint.setColor(mBtnColor);
    mBtnPlayPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mBtnPlayPaint.setAlpha(128);

    mLinePaint = new Paint();
    mLinePaint.setDither(true);
    mLinePaint.setAntiAlias(true);
    mLinePaint.setColor(mLineColor);
    mLinePaint.setAlpha(64);
    mLinePaint.setStrokeWidth(1.0f);
    mLinePaint.setStyle(Paint.Style.STROKE);

    mTimerPaint = new Paint();
    mTimerPaint.setDither(true);
    mTimerPaint.setAntiAlias(true);
    mTimerPaint.setColor(Color.WHITE);
    mTimerPaint.setTextAlign(Paint.Align.RIGHT);
    mTimerPaint.setTextSize(getRawSize(TypedValue.COMPLEX_UNIT_SP, INDICATOR_TIME_TEXT_SIZE));


}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:44,代碼來源:LyricView.java

示例6: initPaints

import android.text.TextPaint; //導入方法依賴的package包/類
private void initPaints() {

        mImagePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        mImagePaint.setFilterBitmap(true);
        mImagePaint.setDither(true);



        //mImagePaint.setColor(Color.YELLOW);
    }
 
開發者ID:suragch,項目名稱:mongol-library,代碼行數:11,代碼來源:KeyImage.java


注:本文中的android.text.TextPaint.setDither方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。