/*
* 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.
*/
{
int tag;
int hints;
int availinfo;
boolean forceCMhint;
int sstride;
boolean isDefaultBI = false;
boolean isSameCM = false;
private native static void initIDs();
static {
/* ensure that the necessary native libraries are loaded */
initIDs();
}
/**
* Create an ImageRepresentation for the given Image. The
* width and height are unknown at this point. The color
* model is a hint as to the color model to use when creating
* the buffered image. If null, the src color model will
* be used.
*/
forceCMhint) {
}
this.forceCMhint = forceCMhint;
}
/* REMIND: Only used for Frame.setIcon - should use ImageWatcher instead */
}
numWaiters++;
try {
missinginfo != 0)
{
try {
wait();
} catch (InterruptedException e) {
return;
}
}
} finally {
}
}
}
public void setDimensions(int w, int h) {
}
image.setDimensions(w, h);
0, 0, w, h);
if (w <= 0 || h <= 0) {
return;
}
// dimension mismatch => trigger recreation of the buffer
}
width = w;
height = h;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
return cmodel;
}
return bimage;
}
/**
* Returns the BufferedImage that will be used as the representation of
* the pixel data. Subclasses can override this method to return
* platform specific subclasses of BufferedImage that may or may not be
* accelerated.
*
* It is subclass' responsibility to propagate acceleration priority
* to the newly created image.
*/
boolean isRasterPremultiplied,
{
return bi;
}
}
}
}
// Check to see if model is INT_RGB
if (model instanceof IndexColorModel) {
// REMIND:
// Probably need to composite anyway so force ARGB
}
else {
}
}
else {
}
else if (model instanceof DirectColorModel) {
// If it is INT_RGB or INT_ARGB, use the model
}
}
}
}
void createBufferedImage() {
// REMIND: Be careful! Is this called everytime there is a
// startProduction? We only want to call it if it is new or
// there is an error
isDefaultBI = false;
try {
} catch (Exception e) {
// Create a default image
}
isDefaultBI = true;
}
else if (cmodel instanceof DirectColorModel) {
isDefaultBI = true;
}
}
}
private void convertToRGB() {
int size = w*h;
// Note that stealData() requires a markDirty() afterwards
// since we modify the data in it.
if (cmodel instanceof IndexColorModel &&
biRaster instanceof ByteComponentRaster &&
{
for (int i=0; i < size; i++) {
}
}
else {
int off=0;
for (int y=0; y < h; y++) {
for (int x=0; x < w; x++) {
}
}
}
// We modified the data array directly above so mark it as dirty now...
isSameCM = false;
int bandMasks[] = {0x00ff0000,
0x0000ff00,
0x000000ff,
0xff000000};
isDefaultBI = true;
}
public void setHints(int h) {
}
hints = h;
}
static boolean s_useNative = true;
public void setPixels(int x, int y, int w, int h,
int poff;
}
// REMIND: What if the model doesn't fit in default color model?
synchronized (this) {
}
}
if (w <= 0 || h <= 0) {
return;
}
int x1 = x+w; // Overflow protection below
int y1 = y+h; // Overflow protection below
if (x < 0) {
off -= x;
x = 0;
} else if (x1 < 0) {
}
if (y < 0) {
y = 0;
} else if (y1 < 0) {
}
}
}
return;
}
// x,y,x1,y1 are all >= 0, so w,h must be >= 0
w = x1-x;
h = y1-y;
// off is first pixel read so it must be in bounds
// They overflowed their own array
throw new ArrayIndexOutOfBoundsException("Data offset out of bounds.");
}
// pix.length and off are >= 0 so remainder >= 0
if (remainder < w) {
// They overflowed their own array
throw new ArrayIndexOutOfBoundsException("Data array is too short.");
}
int num;
if (scansize < 0) {
} else if (scansize > 0) {
} else {
num = h;
}
if (h > num) {
// They overflowed their own array.
throw new ArrayIndexOutOfBoundsException("Data array is too short.");
}
(model instanceof IndexColorModel) &&
(biRaster instanceof ByteComponentRaster))
{
convertToRGB();
}
else {
// Note that setDiffICM modified the raster directly
// so we must mark it as changed
if (srcLUTtransIndex != -1) {
hasAlpha = true;
}
0, hasAlpha,
(nbits > 8
: DataBuffer.TYPE_BYTE));
}
return;
}
}
if (isDefaultBI) {
int pixel;
// Fill in the new lut
}
if (s_useNative) {
// Note that setICMpixels modifies the raster directly
// so we must mark it as changed afterwards
iraster))
{
} else {
abort();
return;
}
}
else {
int[] storage = new int[w*h];
int soff = 0;
// It is an IndexColorModel
for (int i=0; i < w; i++) {
}
}
}
}
else {
int[] storage = new int[w];
for (int i=0; i < w; i++) {
}
}
}
}
(biRaster instanceof ByteComponentRaster) &&
}
else {
byte[] bpix = new byte[w];
}
}
}
else {
}
}
}
}
}
}
{
int poff;
}
// REMIND: What if the model doesn't fit in default color model?
synchronized (this) {
}
}
int[] storage = new int[w];
int yoff;
int pixel;
if (cmodel instanceof IndexColorModel) {
// REMIND: Right now we don't support writing back into ICM
// images.
convertToRGB();
}
(biRaster instanceof IntegerComponentRaster)) {
}
else {
// Need to pack the data
}
}
}
else {
convertToRGB();
}
if (isDefaultBI) {
}
// Note: manual modification of pixels, mark the
// raster as changed
}
else {
for (int i=0; i < w; i++) {
}
}
}
}
else {
}
}
}
}
}
// the region
}
}
int size = w * h;
// Note that we steal the data array here, but only for reading...
for (int i = 0; i < size; i++) {
return bimage;
}
}
0x00ff0000,
0x0000ff00,
0x000000ff);
null);
try {
false, null);
return opImage;
} catch (Exception e) {
return bimage;
}
}
return bimage;
}
private boolean consuming = false;
}
boolean done;
int info;
switch (status) {
default:
case ImageConsumer.IMAGEABORTED:
done = true;
break;
case ImageConsumer.IMAGEERROR:
done = true;
dispose();
break;
case ImageConsumer.STATICIMAGEDONE:
done = true;
break;
case ImageConsumer.SINGLEFRAMEDONE:
done = false;
break;
}
synchronized (this) {
if (done) {
consuming = false;
bimage = getOpaqueRGBImage();
}
}
notifyAll();
}
}
if (!consuming) {
consuming = true;
}
}
private int numWaiters;
private synchronized void checkConsumption() {
{
dispose();
}
}
public synchronized void notifyWatcherListEmpty() {
}
private synchronized void decrementWaiters() {
--numWaiters;
}
}
-1, -1, -1, -1);
}
return false;
}
if (!done) {
addWatcher(iw);
// Some producers deliver image data synchronously
}
return done;
}
}
addWatcher(iw);
}
return availinfo;
}
ImageObserver iw) {
}
-1, -1, -1, -1);
}
return false;
}
addWatcher(iw);
// Some producers deliver image data synchronously
}
}
return done;
}
int x, int y, int w, int h,
}
-1, -1, -1, -1);
}
return false;
}
addWatcher(iw);
// Some producers deliver image data synchronously
}
}
return done;
}
}
-1, -1, -1, -1);
}
return false;
}
addWatcher(iw);
// Some producers deliver image data synchronously
}
}
return done;
}
{
}
-1, -1, -1, -1);
}
return false;
}
addWatcher(iw);
// Some producers deliver image data synchronously
}
}
return done;
}
synchronized void abort() {
consuming = false;
isDefaultBI = false;
isSameCM = false;
| ImageObserver.ERROR);
}
synchronized void dispose() {
consuming = false;
| ImageObserver.ALLBITS);
}
}
}
}