ImageLoadingDialog.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:WorldOfMoreWires 作者:
private static int[][] getPixels(Image image) throws IOException {
    int w = image.getWidth(null);
    int h = image.getHeight(null);
    int pix[] = new int[w * h];
    PixelGrabber grabber = new PixelGrabber(image, 0, 0, w, h, pix, 0, w);

    try {
        if (!grabber.grabPixels()) {
            throw new IOException("Grabber returned false: " + grabber.status());
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    int pixels[][] = new int[w][h];
    for (int x = w; x-- > 0; ) {
        for (int y = h; y-- > 0; ) {
            pixels[x][y] = pix[y * w + x];
        }
    }

    return pixels;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号