use of ar.com.hjg.pngj.ImageLineSetDefault in project J2ME-Loader by nikita36078.
the class PNGUtils method fixPNG.
private static Bitmap fixPNG(InputStream stream) throws IOException {
PngReaderInt reader = new PngReaderInt(stream);
reader.setCrcCheckDisabled();
ImageInfo imageInfo = reader.imgInfo;
int width = imageInfo.cols;
int height = imageInfo.rows;
PngChunkTRNS trns = reader.getMetadata().getTRNS();
PngChunkPLTE plte = reader.getMetadata().getPLTE();
ImageLineSetDefault<ImageLineInt> lineSet = (ImageLineSetDefault) reader.readRows();
int[] pix = new int[width * height];
int[] buf = new int[width];
for (int i = 0; i < height; i++) {
ImageLineInt lineInt = lineSet.getImageLine(i);
ImageLineHelper.scaleUp(lineInt);
int[] r = lineToARGB32(lineInt, plte, trns, buf);
for (int j = 0; j < width; j++) {
pix[i * width + j] = r[j];
}
}
reader.end();
return Bitmap.createBitmap(pix, width, height, Bitmap.Config.ARGB_8888);
}
Aggregations