Android:如何将位图数组转换为 Int 数组?

Dan*_*908 2 arrays int android bitmap drawable

我正在切割一些 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);
}
Run Code Online (Sandbox Code Playgroud)

如何在我的new_images[]变量中转换位图图像?

Won*_*res 5

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);
Run Code Online (Sandbox Code Playgroud)

您到 int 数组的位图现在位于intArray/