@Override
    public byte[] getMatrix() {
        int    width  = getWidth();
        int    height = getHeight();
        int    area   = width * height;
        byte[] matrix = new byte[area];
        // The underlying raster of image consists of area bytes with the luminance values
        image.getRaster().getDataElements(left, top, width, height, matrix);
        return matrix;
    }
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