public void onDraw(Canvas canvas) 에서





Sepia



Paint paint = new Paint();

paint.setAntiAlias(true);


ColorMatrix cm = new ColorMatrix(

new float[] { 0.3930000066757202f, 0.7689999938011169f,

0.1889999955892563f, 0, 0, 0.3490000069141388f,

0.6859999895095825f, 0.1679999977350235f, 0, 0,

0.2720000147819519f, 0.5339999794960022f,

0.1309999972581863f, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 });



paint.setColorFilter(new ColorMatrixColorFilter(cm));

canvas.drawBitmap( ... );





Gray Scale



cm = new ColorMatrix(


new float[] { 0.299f, 0.587f, 0.114f, 0, 0, 0.299f, 0.587f, 0.114f,

0, 0, 0.299f, 0.587f, 0.114f, 0, 0, 0, 0, 0, 1, 0 });





Reverse



cm = new ColorMatrix(


new float[] { -1, 0, 0, 0, 255, 0, -1, 0, 0, 255, 0, 0, -1, 0, 255,

0, 0, 0, 1, 0 });




Adjust Contrast


ColorMatrix cm = new ColorMatrix(); float contrast = 2;
cm.set(new float[] {

contrast, 0, 0, 0, 0, 0, contrast, 0, 0, 0, 0, 0, contrast, 0, 0, 0, 0, 0, 1, 0 });

paint.setColorFilter(new ColorMatrixColorFilter(cm)); 




Adjust Brightness


ColorMatrix cm = new ColorMatrix(); float brightness = -25;
cm.set(new float[] {

1, 0, 0, 0, brightness, 0, 1, 0, 0, brightness, 0, 0, 1, 0, brightness, 0, 0, 0, 1, 0 });

paint.setColorFilter(new ColorMatrixColorFilter(cm)); 




Adjust saturation


ColorMatrix cm = new ColorMatrix(); cm.setSaturation(.5f);
paint.setColorFilter(new ColorMatrixColorFilter(cm));

1보다 큰 값을 넘겨주면 채도가 늘어난다. 영(0)1 사이의 값이라면 채도는 줄어든다.








Posted by tenn
,

[JAVA] Hashmap for loop

JAVA 2012. 10. 18. 11:22


for (Iterator iter = noteIDs.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String key = (String)entry.getKey(); String value = (String)entry.getValue(); }

Posted by tenn
,

< 인텐트필터 개념 참조 >




어플리케이션을 실행시킬 html 페이지의 링크


<a href = "testapp://test"> 실행 </a>





Manifest의 실행시키고 싶은 액티비티에 intent-filter 추가



           <intent-filter>

                <action android:name="android.intent.action.VIEW" />


                <category android:name="android.intent.category.LAUNCHER" />

                <category android:name="android.intent.category.BROWSABLE" />

                <category android:name="android.intent.category.DEFAULT" />


                <data

                    android:host="test"

                    android:scheme="testapp" />

            </intent-filter>





시작 액티비티 실행시키기



            <intent-filter>   메인액티비티 인텐트 필터

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

            <intent-filter>

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.BROWSABLE" />

                <category android:name="android.intent.category.DEFAULT" />

                <data

                    android:host="test"

                    android:scheme="testapp" />

            </intent-filter>





Posted by tenn
,