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


Java BlurMaskFilter.Blur方法代碼示例

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


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

示例1: onCreate

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_blur_mask_filter);

  LinearLayout container = (LinearLayout) findViewById(R.id.container);
  for (BlurMaskFilter.Blur style : BlurMaskFilter.Blur.values()) {
    TextView textView = new TextView(this);
    textView.setTextAppearance(this, R.style.TextAppearance_Huge_Green);
    applyFilter(textView, style);

    LinearLayout.LayoutParams params =  new LinearLayout.LayoutParams(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;
    container.addView(textView, params);
  }
}
 
開發者ID:chiuki,項目名稱:android-graphics-demo,代碼行數:19,代碼來源:BlurMaskFilterActivity.java

示例2: init

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
/**
 * 初始化對象
 */
private void init(Context context) {
    tipBitmaps = new ArrayList<>();
    targetViews = new ArrayList<>();
    rootView = ((Activity) getContext()).findViewById(android.R.id.content);
    // 實例化畫筆並開啟其抗鋸齒和抗抖動
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
    // 設置畫筆透明度為0是關鍵!
    mPaint.setARGB(0, 255, 0, 0);
    // 設置混合模式為DST_IN
    mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    BlurMaskFilter.Blur blurStyle = null;
    switch (maskblurstyle) {
        case MASKBLURSTYLE_SOLID:
            blurStyle = BlurMaskFilter.Blur.SOLID;
            break;
        case MASKBLURSTYLE_NORMAL:
            blurStyle = BlurMaskFilter.Blur.NORMAL;
            break;
    }
    mPaint.setMaskFilter(new BlurMaskFilter(15, blurStyle));
    // 生成前景圖Bitmap
    fgBitmap = Bitmap.createBitmap(screenW, screenH, Bitmap.Config.ARGB_4444);
    // 將其注入畫布
    mCanvas = new Canvas(fgBitmap);
    // 繪製前景畫布顏色
    mCanvas.drawColor(maskColor);
    // 實例化箭頭圖片
    jtDownRight = BitmapFactory.decodeResource(getResources(), R.drawable.jt_down_right);
    jtDownLeft = BitmapFactory.decodeResource(getResources(), R.drawable.jt_down_left);
    jtUpLeft = BitmapFactory.decodeResource(getResources(), R.drawable.jt_up_left);
    jtUpRight = BitmapFactory.decodeResource(getResources(), R.drawable.jt_up_right);
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:36,代碼來源:HighLightGuideView.java

示例3: blur

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
/**
 * @see BlurMaskFilter#BlurMaskFilter(float, BlurMaskFilter.Blur)
 */
public static Span blur(final float radius, @NonNull final BlurMaskFilter.Blur style) {
    return new Span(new SpanBuilder() {
        @Override
        public Object build() {
            return new MaskFilterSpan(new BlurMaskFilter(radius, style));
        }
    });
}
 
開發者ID:neworld,項目名稱:spanner,代碼行數:12,代碼來源:Spans.java

示例4: blur

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
public TextDecorator blur(final float radius, final BlurMaskFilter.Blur style, final String... texts) {
  int index;

  for (String text : texts) {
    if (content.contains(text)) {
      index = content.indexOf(text);
      decoratedContent.setSpan(new MaskFilterSpan(new BlurMaskFilter(radius, style)), index, index + text.length(), flags);
    }
  }

  return this;
}
 
開發者ID:nntuyen,項目名稱:text-decorator,代碼行數:13,代碼來源:TextDecorator.java

示例5: applyFilter

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
private void applyFilter(
    TextView textView, BlurMaskFilter.Blur style) {
  if (Build.VERSION.SDK_INT >= 11) {
    ViewUtil.setSoftwareLayerType(textView);
  }
  textView.setText(style.name());
  BlurMaskFilter filter = new BlurMaskFilter(textView.getTextSize() / 10, style);
  textView.getPaint().setMaskFilter(filter);
}
 
開發者ID:chiuki,項目名稱:android-graphics-demo,代碼行數:10,代碼來源:BlurMaskFilterActivity.java

示例6: addMaskFilterSpan

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
/**
 * @param density
 * @param style   BlurMaskFilter.Blur.NORMAL
 * @return
 */
public SpanOptions addMaskFilterSpan(float density, BlurMaskFilter.Blur style) {
    MaskFilterSpan span = new MaskFilterSpan(new BlurMaskFilter(density, style));
    listSpan.add(span);
    return this;
}
 
開發者ID:xujinyang,項目名稱:AndroidSpan,代碼行數:11,代碼來源:SpanOptions.java

示例7: setBlur

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
/**
 * 設置模糊
 * <p>尚存bug,其他地方存在相同的字體的話,相同字體出現在之前的話那麽就不會模糊,出現在之後的話那會一起模糊</p>
 * <p>推薦還是把所有字體都模糊這樣使用</p>
 *
 * @param radius 模糊半徑(需大於0)
 * @param style  模糊樣式<ul>
 *               <li>{@link BlurMaskFilter.Blur#NORMAL}</li>
 *               <li>{@link BlurMaskFilter.Blur#SOLID}</li>
 *               <li>{@link BlurMaskFilter.Blur#OUTER}</li>
 *               <li>{@link BlurMaskFilter.Blur#INNER}</li>
 *               </ul>
 * @return {@link Builder}
 */
public Builder setBlur(float radius, BlurMaskFilter.Blur style) {
    this.blurRadius = radius;
    this.style = style;
    this.isBlur = true;
    return this;
}
 
開發者ID:hoangkien0705,項目名稱:Android-UtilCode,代碼行數:21,代碼來源:SpannableStringUtils.java

示例8: drawMaskFilterSpan

import android.graphics.BlurMaskFilter; //導入方法依賴的package包/類
/**
 * 模糊效果
 *
 * @param text
 * @param density
 * @param style   BlurMaskFilter.Blur.NORMAL
 * @return
 */
public AndroidSpan drawMaskFilterSpan(String text, float density, BlurMaskFilter.Blur style) {
    MaskFilterSpan span = new MaskFilterSpan(new BlurMaskFilter(density, style));
    drawSpan(text, span);
    return this;
}
 
開發者ID:xujinyang,項目名稱:AndroidSpan,代碼行數:14,代碼來源:AndroidSpan.java


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