BitmapRegionDecoder.decodeRegion(...) を使用して画像をトリミングしています。ただし、android 2.3.1 (api level 10) 以下では機能しません。これを達成する別の方法があれば教えてください。android-support-v4.jar ライブラリにもこのクラスは含まれていません。
1378 次
1 に答える
2
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)
画像のトリミングに使用できます。これは常に存在しているため、古い API の代替手段を提供します。
ドキュメントはかなり自明です:
ソース ビットマップの指定されたサブセットから不変のビットマップを返します。新しいビットマップは、ソースと同じオブジェクトであるか、コピーが作成されている可能性があります。元のビットマップと同じ密度で初期化されます。
パラメーター
source The bitmap we are subsetting x The x coordinate of the first pixel in source y The y coordinate of the first pixel in source width The number of pixels in each row height The number of rows
戻り値 ソース ビットマップのサブセットまたはソース ビットマップ自体のコピー。
于 2012-09-05T08:49:44.587 に答える