public final BufferedImage filter(BufferedImage src, BufferedImage dst)
AndroidでAffineTransformOp.filterと同様の操作を実行するにはどうすればよいですか?
は、私は、Java 1.6で次のコードを持っていたソース
BufferedImage
を変換し、その結果をデスティネーションBufferedImage
で を格納します。
2つのイメージのカラーモデルが一致しない場合は、 のカラーモデルへの変換が実行されます。 宛先イメージがnull
の場合、ソースがColorModel
のBufferedImage
が作成されます。getBounds2D(BufferedImage)
によって返される矩形の座標は、このメソッドによって返されたBufferedImage
の座標と必ずしも同じではありません。矩形の左上隅の座標 が負の場合、矩形のこの部分は描画されません。 矩形の左上隅の座標が正の場合、フィルタリングされた画像は、宛先のその位置に描画された
です。BufferedImage
、私が代わりのAffineTransformのマトリックスを使用しているアンドロイドで//Make image always std_height tall double scaleAmount = (double) std_height/(double) characterImage.getHeight(); AffineTransform tx = new AffineTransform(); tx.scale(scaleAmount, scaleAmount); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); characterImage = op.filter(characterImage, null);
:
//Make image always std_width wide
float scaleAmount = (float) std_width/(float) characterImage.getWidth();
//AffineTransform tx = new AffineTransform();
//tx.scale(scaleAmount, scaleAmount);
Matrix mx = new Matrix();
mx.setScale(scaleAmount, scaleAmount);
//AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR); //Can't use this on Android
//characterImage = op.filter(characterImage, null); //Can't use this on Android
私の問題は、最後の二つでありますコメント行。 Androidのようなことをすることはできますか?ありがとう。