ポラロイド
といっても単に画像を重ねたダケです。
// ポラロイド private Bitmap effectPolaroid( Bitmap bitmap, boolean flg ){ if( bitmap == null ){ bitmap = BitmapFactory.decodeResource( getResources( ), R.drawable.original ).copy( Bitmap.Config.ARGB_8888, true ); } if( bitmap == null ){ return bitmap; } if( bitmap.isMutable( ) != true ){ bitmap = bitmap.copy( Bitmap.Config.ARGB_8888, true ); } if( flg == true ){ int height = bitmap.getHeight( ); int width = bitmap.getWidth( ); int[] pixels = new int[( width * height )]; bitmap.getPixels( pixels, 0, width, 0, 0, width, height ); for( int YY = 0; YY < width; ++YY ){ for( int XX = 0; XX < height; ++XX ){ int bitmapColor = pixels[( YY + XX * width )]; int rr = Color.red( bitmapColor ); int gg = Color.green( bitmapColor ); int bb = Color.blue( bitmapColor ); // hsv[0] is Hue [0.0f .. 360.0f] // hsv[1] is Saturation [0.0f...1.0f] // hsv[2] is Value [0.0f...1.0.0f] float[] hsv = new float[3]; Color.RGBToHSV( rr, gg, bb, hsv ); hsv[1] *= 1.5f; hsv[2] -= 0.1f; if( 1 < hsv[1] ){ hsv[1] = 1.0f; } else if( hsv[1] < 0 ){ hsv[1] = 0.0f; } if( 1 < hsv[2] ){ hsv[2] = 1.0f; } else if ( hsv[2] < 0 ){ hsv[2] = 0.0f; } pixels[( YY + XX * width )] = Color.HSVToColor( hsv ); } } bitmap.setPixels( pixels, 0, width, 0, 0, width, height ); } bitmap = mergeBitmap( bitmap, BitmapFactory.decodeResource( getResources( ), R.drawable.polaroid ).copy( Bitmap.Config.ARGB_8888, true ) ); return bitmap; } // 画像を合成 private Bitmap mergeBitmap( Bitmap bitmap1, Bitmap bitmap2 ){ if( bitmap1 == null ){ return null; } if( bitmap2 == null ){ return bitmap1; } int height1 = bitmap1.getHeight( ); int width1 = bitmap1.getWidth( ); int height2 = bitmap2.getHeight( ); int width2 = bitmap2.getWidth( ); float scaleWidth = ( (float)width1 ) / width2; float scaleHeight = ( (float)height1 ) / height2; Matrix matrix = new Matrix( ); matrix.postScale( scaleWidth, scaleHeight ); Bitmap mergeBitmap = Bitmap.createBitmap( bitmap2, 0, 0, width2, height2, matrix, true ); Bitmap newBitmap = Bitmap.createBitmap( width1, height1, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( newBitmap ); canvas.drawBitmap( bitmap1, 0.0f, 0.0f, null ); canvas.drawBitmap( mergeBitmap, 0.0f, 0.0f, null ); return newBitmap; }
オリジナル:
ポラロイド台紙(詳細で見てください):
ポラロイド(調整無)(違いは詳細で見てください):
ポラロイド(調整有)(違いは詳細で見てください):
単なる画像の合成なのに合成する画像の作成に時間がかかって疲れた。。。慣れない事はするもんじゃないね。_| ̄|○
Photoshopのスキルが少しだけ上がったから良しとしたい。。。