本文整理汇总了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);
}
}
}