Android: 如何将 Bitmap 数组转换为 Int 数组?
Android: How can i convert a Bitmap array to Int array?
我正在剪切一些 int 数组的图像...
int[] imagenes_originales = new int[] {
R.drawable.image1,
R.drawable.image2,
R.drawable.image3,
R.drawable.image4
}
int[] new_images;
for (a = 0; a <= 3; a++) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), imagenes_originales[a]);
int x = bitmap.getWidth(), y = bitmap.getHeight();
int escalax = getWindowManager().getDefaultDisplay().getWidth();
Bitmap recorte = Bitmap.createBitmap(bitmap, 0, y / 2, escalax, 100);
}
如何转换我的 new_images[]
变量中的位图图像?
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), imagenes_originales[a]);
int x = bitmap.getWidth();
int y = bitmap.getHeight();
int[] intArray = new int[x * y];
bitmap.getPixels(intArray, 0, x, 0, 0, x, y);
您的位图到 int 数组现在位于 intArray
/
我正在剪切一些 int 数组的图像...
int[] imagenes_originales = new int[] {
R.drawable.image1,
R.drawable.image2,
R.drawable.image3,
R.drawable.image4
}
int[] new_images;
for (a = 0; a <= 3; a++) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), imagenes_originales[a]);
int x = bitmap.getWidth(), y = bitmap.getHeight();
int escalax = getWindowManager().getDefaultDisplay().getWidth();
Bitmap recorte = Bitmap.createBitmap(bitmap, 0, y / 2, escalax, 100);
}
如何转换我的 new_images[]
变量中的位图图像?
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), imagenes_originales[a]);
int x = bitmap.getWidth();
int y = bitmap.getHeight();
int[] intArray = new int[x * y];
bitmap.getPixels(intArray, 0, x, 0, 0, x, y);
您的位图到 int 数组现在位于 intArray
/