Methods Summary |
---|
public final void | addValidCache(java.lang.Object cache)
validCaches.add(cache);
|
protected final void | clearValidCaches()
validCaches.clear();
|
public abstract void | dispose()Dispose Native Surface data
|
protected void | finalize()
dispose();
|
public abstract java.awt.image.ColorModel | getColorModel()
|
public java.lang.Object | getData()If Surface has Raster, this method returns data array of Raster's DataBuffer
return null;
|
public int | getHeight()
return height;
|
public static org.apache.harmony.awt.gl.Surface | getImageSurface(java.awt.Image image)
return AwtImageBackdoorAccessor.getInstance().getImageSurface(image);
|
public abstract org.apache.harmony.awt.gl.Surface | getImageSurface()
|
public abstract java.awt.image.WritableRaster | getRaster()
|
public long | getSurfaceDataPtr()
// Syrface type. It is equal
// BufferedImge type
return surfaceDataPtr;
|
public abstract int | getSurfaceType()
|
public int | getTransparency()
return transparency;
|
public static int | getType(java.awt.image.ColorModel cm, java.awt.image.WritableRaster raster)Computation type of BufferedImage or Surface
int transferType = cm.getTransferType();
boolean hasAlpha = cm.hasAlpha();
ColorSpace cs = cm.getColorSpace();
int csType = cs.getType();
SampleModel sm = raster.getSampleModel();
if(csType == ColorSpace.TYPE_RGB){
if(cm instanceof DirectColorModel){
DirectColorModel dcm = (DirectColorModel) cm;
switch (transferType) {
case DataBuffer.TYPE_INT:
if (dcm.getRedMask() == RED_MASK &&
dcm.getGreenMask() == GREEN_MASK &&
dcm.getBlueMask() == BLUE_MASK) {
if (!hasAlpha) {
return BufferedImage.TYPE_INT_RGB;
}
if (dcm.getAlphaMask() == ALPHA_MASK) {
if (dcm.isAlphaPremultiplied()) {
return BufferedImage.TYPE_INT_ARGB_PRE;
}
return BufferedImage.TYPE_INT_ARGB;
}
return BufferedImage.TYPE_CUSTOM;
} else if (dcm.getRedMask() == RED_BGR_MASK &&
dcm.getGreenMask() == GREEN_BGR_MASK &&
dcm.getBlueMask() == BLUE_BGR_MASK) {
if (!hasAlpha) {
return BufferedImage.TYPE_INT_BGR;
}
} else {
return BufferedImage.TYPE_CUSTOM;
}
case DataBuffer.TYPE_USHORT:
if (dcm.getRedMask() == RED_555_MASK &&
dcm.getGreenMask() == GREEN_555_MASK &&
dcm.getBlueMask() == BLUE_555_MASK && !hasAlpha) {
return BufferedImage.TYPE_USHORT_555_RGB;
} else if (dcm.getRedMask() == RED_565_MASK &&
dcm.getGreenMask() == GREEN_565_MASK &&
dcm.getBlueMask() == BLUE_565_MASK) {
return BufferedImage.TYPE_USHORT_565_RGB;
}
default:
return BufferedImage.TYPE_CUSTOM;
}
}else if(cm instanceof IndexColorModel){
IndexColorModel icm = (IndexColorModel) cm;
int pixelBits = icm.getPixelSize();
if(transferType == DataBuffer.TYPE_BYTE){
if(sm instanceof MultiPixelPackedSampleModel && !hasAlpha &&
pixelBits < 5){
return BufferedImage.TYPE_BYTE_BINARY;
}else if(pixelBits == 8){
return BufferedImage.TYPE_BYTE_INDEXED;
}
}
return BufferedImage.TYPE_CUSTOM;
}else if(cm instanceof ComponentColorModel){
ComponentColorModel ccm = (ComponentColorModel) cm;
if(transferType == DataBuffer.TYPE_BYTE &&
sm instanceof ComponentSampleModel){
ComponentSampleModel csm =
(ComponentSampleModel) sm;
int[] offsets = csm.getBandOffsets();
int[] bits = ccm.getComponentSize();
boolean isCustom = false;
for (int i = 0; i < bits.length; i++) {
if (bits[i] != 8 ||
offsets[i] != offsets.length - 1 - i) {
isCustom = true;
break;
}
}
if (!isCustom) {
if (!ccm.hasAlpha()) {
return BufferedImage.TYPE_3BYTE_BGR;
} else if (ccm.isAlphaPremultiplied()) {
return BufferedImage.TYPE_4BYTE_ABGR_PRE;
} else {
return BufferedImage.TYPE_4BYTE_ABGR;
}
}
}
return BufferedImage.TYPE_CUSTOM;
}
return BufferedImage.TYPE_CUSTOM;
}else if(cs == LUTColorConverter.LINEAR_GRAY_CS){
if(cm instanceof ComponentColorModel &&
cm.getNumComponents() == 1){
int bits[] = cm.getComponentSize();
if(transferType == DataBuffer.TYPE_BYTE &&
bits[0] == 8){
return BufferedImage.TYPE_BYTE_GRAY;
}else if(transferType == DataBuffer.TYPE_USHORT &&
bits[0] == 16){
return BufferedImage.TYPE_USHORT_GRAY;
}else{
return BufferedImage.TYPE_CUSTOM;
}
}
return BufferedImage.TYPE_CUSTOM;
}
return BufferedImage.TYPE_CUSTOM;
|
public int | getWidth()
return width;
|
public void | invalidate()
|
public boolean | invalidated()
return true;
|
public final boolean | isCaheValid(java.lang.Object cache)
return validCaches.contains(cache);
|
public static boolean | isGrayPallete(java.awt.image.IndexColorModel icm)
return AwtImageBackdoorAccessor.getInstance().isGrayPallete(icm);
|
public boolean | isNativeDrawable()Returns could or coldn't the Surface be blit by Native blitter
return true;
|
public abstract long | lock()Lock Native Surface data
|
public abstract void | unlock()Unlock Native Surface data
|
public void | validate()
|