< prev index next >
src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 293,303 ****
bandOffsets[i] = i;
}
noTransform &= bgrOrder;
! int sampleSize[] = sampleModel.getSampleSize();
//XXX: check more
// Number of bytes that a scanline for the image written out will have.
int destScanlineBytes = w * numBands;
--- 293,303 ----
bandOffsets[i] = i;
}
noTransform &= bgrOrder;
! int[] sampleSize = sampleModel.getSampleSize();
//XXX: check more
// Number of bytes that a scanline for the image written out will have.
int destScanlineBytes = w * numBands;
*** 320,330 ****
if (!canEncodeImage(compressionType, colorModel, sampleModel)) {
throw new IOException("Image can not be encoded with compression type "
+ BMPCompressionTypes.getName(compressionType));
}
! byte r[] = null, g[] = null, b[] = null, a[] = null;
if (compressionType == BI_BITFIELDS) {
bitsPerPixel =
DataBuffer.getDataTypeSize(sampleModel.getDataType());
--- 320,330 ----
if (!canEncodeImage(compressionType, colorModel, sampleModel)) {
throw new IOException("Image can not be encoded with compression type "
+ BMPCompressionTypes.getName(compressionType));
}
! byte[] r = null, g = null, b = null, a = null;
if (compressionType == BI_BITFIELDS) {
bitsPerPixel =
DataBuffer.getDataTypeSize(sampleModel.getDataType());
*** 750,760 ****
stream.flushBefore(stream.getStreamPosition());
}
}
private void writePixels(int l, int scanlineBytes, int bitsPerPixel,
! int pixels[],
int padding, int numBands,
IndexColorModel icm) throws IOException {
int pixel = 0;
int k = 0;
switch (bitsPerPixel) {
--- 750,760 ----
stream.flushBefore(stream.getStreamPosition());
}
}
private void writePixels(int l, int scanlineBytes, int bitsPerPixel,
! int[] pixels,
int padding, int numBands,
IndexColorModel icm) throws IOException {
int pixel = 0;
int k = 0;
switch (bitsPerPixel) {
*** 865,877 ****
stream.write(bpixels, 0, scanlineBytes);
} else {
// Case where IndexColorModel had > 256 colors.
int entries = icm.getMapSize();
! byte r[] = new byte[entries];
! byte g[] = new byte[entries];
! byte b[] = new byte[entries];
icm.getReds(r);
icm.getGreens(g);
icm.getBlues(b);
int index;
--- 865,877 ----
stream.write(bpixels, 0, scanlineBytes);
} else {
// Case where IndexColorModel had > 256 colors.
int entries = icm.getMapSize();
! byte[] r = new byte[entries];
! byte[] g = new byte[entries];
! byte[] b = new byte[entries];
icm.getReds(r);
icm.getGreens(g);
icm.getBlues(b);
int index;
< prev index next >