本文整理匯總了Java中java.awt.image.ImageObserver類的典型用法代碼示例。如果您正苦於以下問題:Java ImageObserver類的具體用法?Java ImageObserver怎麽用?Java ImageObserver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ImageObserver類屬於java.awt.image包,在下文中一共展示了ImageObserver類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawImage
import java.awt.image.ImageObserver; //導入依賴的package包/類
public boolean drawImage(Image img, int x, int y,
Color bgcolor,
ImageObserver observer) {
if (img == null) {
return true;
}
boolean result;
int srcWidth = img.getWidth(null);
int srcHeight = img.getHeight(null);
if (srcWidth < 0 || srcHeight < 0) {
result = false;
} else {
result = drawImage(img, x, y, srcWidth, srcHeight, bgcolor, observer);
}
return result;
}
示例2: abort
import java.awt.image.ImageObserver; //導入依賴的package包/類
synchronized void abort() {
image.getSource().removeConsumer(this);
consuming = false;
newbits = null;
bimage = null;
biRaster = null;
cmodel = null;
srcLUT = null;
isDefaultBI = false;
isSameCM = false;
newInfo(image, ImageObserver.ABORT, -1, -1, -1, -1);
availinfo &= ~(ImageObserver.SOMEBITS
| ImageObserver.FRAMEBITS
| ImageObserver.ALLBITS
| ImageObserver.ERROR);
}
示例3: copyImage
import java.awt.image.ImageObserver; //導入依賴的package包/類
public boolean copyImage(SunGraphics2D sg, Image img,
int dx, int dy, int sx, int sy, int w, int h,
Color bgColor,
ImageObserver observer) {
if (!(img instanceof ToolkitImage)) {
return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
} else {
ToolkitImage sunimg = (ToolkitImage)img;
if (!imageReady(sunimg, observer)) {
return false;
}
ImageRepresentation ir = sunimg.getImageRep();
return ir.drawToBufImage(sg, sunimg,
dx, dy, (dx + w), (dy + h),
sx, sy, (sx + w), (sy + h),
bgColor, observer);
}
}
示例4: prepare
import java.awt.image.ImageObserver; //導入依賴的package包/類
public boolean prepare(ImageObserver iw) {
if (src != null) {
src.checkSecurity(null, false);
}
if ((availinfo & ImageObserver.ERROR) != 0) {
if (iw != null) {
iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
-1, -1, -1, -1);
}
return false;
}
boolean done = ((availinfo & ImageObserver.ALLBITS) != 0);
if (!done) {
addWatcher(iw);
startProduction();
// Some producers deliver image data synchronously
done = ((availinfo & ImageObserver.ALLBITS) != 0);
}
return done;
}
示例5: reconstruct
import java.awt.image.ImageObserver; //導入依賴的package包/類
private synchronized void reconstruct(int flags) {
if ((flags & ~availinfo) != 0) {
if ((availinfo & ImageObserver.ERROR) != 0) {
return;
}
ImageRepresentation ir = getImageRep();
ir.startProduction();
while ((flags & ~availinfo) != 0) {
try {
wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
if ((availinfo & ImageObserver.ERROR) != 0) {
return;
}
}
}
}
示例6: ensureLoaded
import java.awt.image.ImageObserver; //導入依賴的package包/類
private static void ensureLoaded(Image image) {
if (
(Toolkit.getDefaultToolkit().checkImage(image, -1, -1, null) &
(ImageObserver.ALLBITS | ImageObserver.FRAMEBITS)) != 0
) {
return;
}
synchronized (tracker) {
int id = ++mediaTrackerID;
tracker.addImage(image, id);
try {
tracker.waitForID(id, 0);
} catch (InterruptedException e) {
System.out.println("INTERRUPTED while loading Image");
}
// #262804 assertation disabled because of error, when using ImageFilter
// assert (tracker.statusID(id, false) == MediaTracker.COMPLETE) : "Image loaded";
tracker.removeImage(image, id);
}
}
示例7: reconstruct
import java.awt.image.ImageObserver; //導入依賴的package包/類
public synchronized void reconstruct(int flags) {
if (src != null) {
src.checkSecurity(null, false);
}
int missinginfo = flags & ~availinfo;
if ((availinfo & ImageObserver.ERROR) == 0 && missinginfo != 0) {
numWaiters++;
try {
startProduction();
missinginfo = flags & ~availinfo;
while ((availinfo & ImageObserver.ERROR) == 0 &&
missinginfo != 0)
{
try {
wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
missinginfo = flags & ~availinfo;
}
} finally {
decrementWaiters();
}
}
}
示例8: prepareImage
import java.awt.image.ImageObserver; //導入依賴的package包/類
/**
* Maps {@code Component.prepareImage(Image, int, int, ImageObserver)}
* through queue
*/
public boolean prepareImage(final Image image, final int i, final int i1, final ImageObserver imageObserver) {
return (runMapping(new MapBooleanAction("prepareImage") {
@Override
public boolean map() {
return getSource().prepareImage(image, i, i1, imageObserver);
}
}));
}
示例9: drawToBufImage
import java.awt.image.ImageObserver; //導入依賴的package包/類
public boolean drawToBufImage(Graphics g, ToolkitImage img,
AffineTransform xform,
ImageObserver iw)
{
Graphics2D g2 = (Graphics2D) g;
if (src != null) {
src.checkSecurity(null, false);
}
if ((availinfo & ImageObserver.ERROR) != 0) {
if (iw != null) {
iw.imageUpdate(image, ImageObserver.ERROR|ImageObserver.ABORT,
-1, -1, -1, -1);
}
return false;
}
boolean done = ((availinfo & ImageObserver.ALLBITS) != 0);
boolean abort = ((availinfo & ImageObserver.ABORT) != 0);
if (!done && !abort) {
addWatcher(iw);
startProduction();
// Some producers deliver image data synchronously
done = ((availinfo & ImageObserver.ALLBITS) != 0);
}
if (done || (0 != (availinfo & ImageObserver.FRAMEBITS))) {
g2.drawImage (bimage, xform, null);
}
return done;
}
示例10: preload
import java.awt.image.ImageObserver; //導入依賴的package包/類
public void preload(ImageObserver iw) {
if (src != null) {
src.checkSecurity(null, false);
}
if ((availinfo & ImageObserver.ALLBITS) == 0) {
addWatcher(iw, true);
}
}
示例11: drawImage
import java.awt.image.ImageObserver; //導入依賴的package包/類
/**
* Draws an image at x,y in nonblocking mode with a solid background
* color and a callback object.
*/
public boolean drawImage(Image img, int x, int y, Color bg,
ImageObserver observer) {
if (img == null) {
return true;
}
if (isHiDPIImage(img)) {
final int imgW = img.getWidth(null);
final int imgH = img.getHeight(null);
return drawHiDPIImage(img, x, y, x + imgW, y + imgH, 0, 0, imgW,
imgH, bg, observer);
}
try {
return imagepipe.copyImage(this, img, x, y, bg, observer);
} catch (InvalidPipeException e) {
try {
revalidateAll();
return imagepipe.copyImage(this, img, x, y, bg, observer);
} catch (InvalidPipeException e2) {
// Still catching the exception; we are not yet ready to
// validate the surfaceData correctly. Fail for now and
// try again next time around.
return false;
}
} finally {
surfaceData.markDirty();
}
}
示例12: scaleImage
import java.awt.image.ImageObserver; //導入依賴的package包/類
public boolean scaleImage(SunGraphics2D sg, Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
Color bgColor,
ImageObserver observer) {
return false;
}
示例13: infoDone
import java.awt.image.ImageObserver; //導入依賴的package包/類
synchronized void infoDone(int status) {
if (status == ImageConsumer.IMAGEERROR ||
((~availinfo) & (ImageObserver.WIDTH |
ImageObserver.HEIGHT)) != 0) {
addInfo(ImageObserver.ERROR);
} else if ((availinfo & ImageObserver.PROPERTIES) == 0) {
setProperties(null);
}
}
示例14: draw
import java.awt.image.ImageObserver; //導入依賴的package包/類
public void draw(Graphics g, int x, int y, double scale, ImageObserver obs) {
if (srcOp == null || scale <= 0) return;
final BufferedImage img;
if (scale == 1.0) {
img = srcOp.getImage();
}
else {
if (scaleOp == null || scaleOp.getScale() != scale) {
scaleOp = Op.scale(srcOp, scale);
}
img = scaleOp.getImage();
}
if (img == null) return;
g.drawImage(img, x, y, obs);
}
示例15: paintOverlay
import java.awt.image.ImageObserver; //導入依賴的package包/類
@Override
public void paintOverlay(Graphics2D g2d, ImageRegion imageRegion, double downsampleFactor, ImageObserver observer, boolean paintCompletely) {
if (trackerFeatures != null) {
if (doPaintBoundsHeatmap.get()) {
paintBoundsHeatmap(g2d);
}
if (doPaintCursorHeatmap.get()) {
paintCursorHeatmap(g2d);
}
if (doPaintEyeHeatmap.get()) {
paintEyeHeatmap(g2d);
}
}
}