/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/** This class is the Java Image IO plugin reader for WBMP images.
* It may subsample the image, clip the image,
* and shift the decoded image origin if the proper decoding parameter
* are set in the provided <code>WBMPImageReadParam</code>.
*/
/** The input stream where reads from */
/** Indicates whether the header is read. */
private boolean gotHeader = false;
/** The original image width. */
private int width;
/** The original image height. */
private int height;
private int wbmpType;
/** Constructs <code>WBMPImageReader</code> from the provided
* <code>ImageReaderSpi</code>.
*/
super(originator);
}
/** Overrides the method defined in the superclass. */
boolean seekForwardOnly,
boolean ignoreMetadata) {
gotHeader = false;
}
/** Overrides the method defined in the superclass. */
}
if (seekForwardOnly && allowSearch) {
}
return 1;
}
readHeader();
return width;
}
readHeader();
return height;
}
return true;
}
if (imageIndex != 0) {
}
}
if (gotHeader)
return;
throw new IllegalStateException("Input source not set!");
}
metadata = new WBMPMetadata();
// check for valid wbmp image
if (fixHeaderField != 0
|| !isValidWbmpType(wbmpType))
{
}
// Read image width
// Read image height
gotHeader = true;
}
throws IOException {
readHeader();
}
return new ImageReadParam();
}
throws IOException {
readHeader();
}
return metadata;
}
return null;
}
throws IOException {
}
param = getDefaultReadParam();
//read header
readHeader();
// If the destination is provided, then use it. Otherwise, create new one
boolean noTransform =
// Get the image data.
// Get the SampleModel.
if (noTransform) {
if (abortRequested()) {
return bi;
}
// If noTransform is necessary, read the data.
0, 0,
new int[]{0});
processImageProgress(100.0F);
} else {
// cache the values to avoid duplicated computation
i++, j++, x += scaleX) {
srcPos[j] = x >> 3;
destPos[j] = i >> 3;
}
for (int j = 0, y = sourceRegion.y,
k = destinationRegion.y * lineStride;
if (abortRequested())
break;
//get the bit and assign to the data buffer of the raster
}
k += lineStride;
0, j,
new int[]{0});
}
}
if (abortRequested())
else
return bi;
}
public boolean canReadRaster() {
return true;
}
}
public void reset() {
super.reset();
gotHeader = false;
}
/*
* This method verifies that given byte is valid wbmp type marker.
* At the moment only 0x0 marker is described by wbmp spec.
*/
return type == 0;
}
}