안드로이드

 

NORMAL Inner
SOLID outer

 

class FilterActivity
package com.example.choi.ex07_graphic;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

public class FilterActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new MyView(this));
    }


    class MyView extends View {

        public MyView(Context context) {
            super(context);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            canvas.drawColor(Color.LTGRAY);

            Paint paint =new Paint();
            paint.setAntiAlias(true);

            Bitmap cup = BitmapFactory.decodeResource(getContext().getResources()
                , R.drawable.cup);

            //필터 처리(targetSdkVersion을 13으로 테스트)
            //최신 에뮬레이터에서는 아직 적용되지 않음
            //실제 기계에서는 잘 테스트 됨

            BlurMaskFilter blur1 =new BlurMaskFilter(30, BlurMaskFilter.Blur.NORMAL);
            BlurMaskFilter blur2 =new BlurMaskFilter(30, BlurMaskFilter.Blur.SOLID);
            BlurMaskFilter blur3 =new BlurMaskFilter(30, BlurMaskFilter.Blur.INNER);
            BlurMaskFilter blur4 =new BlurMaskFilter(30, BlurMaskFilter.Blur.OUTER);
            paint.setMaskFilter(blur4); //필터 적용


            canvas.drawBitmap(cup, 30, 30, paint);

        }

    }




}

 

 

 

android

 

about author

PHRASE

Level 60  머나먼나라

결코 양보하지 말라. 결코 굴하지 말라, 결코 ,결코, 결코, 위대한 것이든 사소한 것이든, 커다란 것이든 시시한 것이든 결코 굴복하지 말라. -윈스턴 처칠

댓글 ( 4)

댓글 남기기

작성