@Override
    public byte[] getRow(int y, byte[] row) {
        if (y < 0 || y >= getHeight()) {
            throw new IllegalArgumentException("Requested row is outside the image: " + y);
        }
        int width = getWidth();
        if (row == null || row.length < width) {
            row = new byte[width];
        }
        // The underlying raster of image consists of bytes with the luminance values
        image.getRaster().getDataElements(left, top + y, width, 1, row);
        return row;
    }
This LuminanceSource implementation is meant for J2SE clients and our blackbox unit tests.

@author dswitkin@google.com (Daniel Switkin)
@author Sean Owen
@author code@elektrowolle.de (Wolfgang Jung)
src/main/java/io/github/biezhi/wechat/utils/BufferedImageLuminanceSource.java