3909N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A/* Parse the buffered image. All of the raster information is returned in the 0N/A * imagePP structure. 0N/A * The handleCustom parameter specifies whether or not the caller 0N/A * can use custom channels. If it is false and a custom channel 0N/A * is encountered, the returned value will be 0 and all structures 0N/A * will be deallocated. 0N/A /* Make sure the image exists */ 0N/A /* Retrieve the raster */ 0N/A /* Retrieve the image type */ 0N/A /* Parse the raster */ 0N/A /* Retrieve the color model */ 0N/A /* Parse the color model */ 5708N/A/* Verifies whether the channel offsets are sane and correspond to the type of 5708N/A * 0: Failure: channel offsets are invalid 5708N/A // an overflow, or insufficient buffer capacity 5708N/A // NB:caller does not support the banded rasters yet, 5708N/A // so this branch of the code must be re-defined in 5708N/A // order to provide valid criteria for the data offsets 5708N/A // verification, when/if banded rasters will be supported. 5708N/A // At the moment, we prohibit banded rasters as well. 5708N/A // PACKED_RASTER_TYPE: does not support channel offsets 5708N/A // UNKNOWN_RASTER_TYPE: should not be used, likely indicates an error 0N/A/* Parse the raster. All of the raster information is returned in the 0N/A * rasterP structure. 0N/A * 0: Can't do it (Custom channel) 5708N/A // make sure that the raster type is initialized 0N/A * we can't handle such kind of rasters due to limitations 5708N/A // do basic validation of the raster structure 5708N/A // get channel (data) offsets 5708N/A // unable to verify the raster 5708N/A // verify whether channel offsets look sane 5708N/A ;
// PACKED_RASTER_TYPE does not use the channel offsets. 5708N/A /* additional check for sppsm fields validity: make sure that 5708N/A * size of raster samples doesn't exceed the data type capacity. 6378N/A // invalid number of components? 6378N/A /* look for standard cases */ 0N/A /* Figure out if this is the default CM */ 0N/A "Unable to find default CM");
6378N/A /* check whether image attributes correspond to default cm */ 6378N/A /* Get index color model attributes */ 0N/A /* Need to find the transparent index */ 0N/A if ((
rgb[i]&
0xff000000) == 0) {
0N/A /* Now what? No transparent pixel... */ 0N/A /* Free the raster */ 6378N/A // check whether raster and color model are compatible 0N/A /* These hints are #bytes */ 0N/A /* Figure out if it is interleaved */ 0N/A /* Overlapping samples */ 0N/A /* Could just copy */ 0N/A /* Ignore the case if bands are overlapping */ 0N/A /* Don't handle any other case */ 0N/A /* REMIND: Not necessarily correct */ 5710N/A /* do some sanity check first: make sure that 5710N/A * - sample model is SinglePixelPackedSampleModel 5710N/A * - number of bands in the raster corresponds to the number 5710N/A * of color components in the color model 5710N/A /* given raster is not compatible with the color model, 5710N/A * so the operation has to be aborted. 0N/A /* Don't know what it is */ 0N/A /* REMIND: Need to handle more cases */ 0N/A * This routine will fill in a buffer of data for either 1 band or all 0N/A * bands (if band == -1). 0N/A /* Here is the generic code */ 0N/A for (y=0; y < h; ) {
0N/A for (y=0; y < h; ) {
0N/A /* Here is the generic code */ 0N/A /* Here is the generic code */ 0N/A /* Here is the generic code */