zoukankan      html  css  js  c++  java
  • Android开发

    学习api设计

    BlurMaskFilterView.java

    /**
     * Created by Jay on 2015/10/21 0021.
     */
    public class BlurMaskFilterView extends View{
    
        public BlurMaskFilterView(Context context) {
            super(context);
        }
    
        public BlurMaskFilterView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public BlurMaskFilterView(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }
    
        @Override
        protected void onDraw(Canvas canvas) {
    
            BlurMaskFilter bmf = null;
            Paint paint=new Paint();
            paint.setAntiAlias(true);          //抗锯齿
            paint.setColor(Color.RED);//画笔颜色
            paint.setStyle(Paint.Style.FILL);  //画笔风格
            paint.setTextSize(68);             //绘制文字大小,单位px
            paint.setStrokeWidth(5);           //画笔粗细
    
            bmf = new BlurMaskFilter(10f,BlurMaskFilter.Blur.NORMAL);
            paint.setMaskFilter(bmf);
            canvas.drawText("最喜欢看曹神日狗了~", 100, 100, paint);
            bmf = new BlurMaskFilter(10f,BlurMaskFilter.Blur.OUTER);
            paint.setMaskFilter(bmf);
            canvas.drawText("最喜欢看曹神日狗了~", 100, 200, paint);
            bmf = new BlurMaskFilter(10f,BlurMaskFilter.Blur.INNER);
            paint.setMaskFilter(bmf);
            canvas.drawText("最喜欢看曹神日狗了~", 100, 300, paint);
            bmf = new BlurMaskFilter(10f,BlurMaskFilter.Blur.SOLID);
            paint.setMaskFilter(bmf);
            canvas.drawText("最喜欢看曹神日狗了~", 100, 400, paint);
            
            setLayerType(View.LAYER_TYPE_SOFTWARE, null);     //关闭硬件加速
  • 相关阅读:
    Socket编程
    jdbc03 使用servlet实现
    el和jstl
    java03变量和基本数据类型
    java02
    ssh整合
    U1总结
    多线程
    spring07 JDBC
    cocos2dx中的三种基本的数据类型
  • 原文地址:https://www.cnblogs.com/wrx166/p/14911346.html
Copyright © 2011-2022 走看看