当前位置: 首页>>代码示例>>Java>>正文


Java ImageObserver.ABORT属性代码示例

本文整理汇总了Java中java.awt.image.ImageObserver.ABORT属性的典型用法代码示例。如果您正苦于以下问题:Java ImageObserver.ABORT属性的具体用法?Java ImageObserver.ABORT怎么用?Java ImageObserver.ABORT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.image.ImageObserver的用法示例。


在下文中一共展示了ImageObserver.ABORT属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitFor

public synchronized boolean waitFor()
{
  Toolkit tk = Toolkit.getDefaultToolkit();

  _status |= tk.checkImage(_image, -1, -1, this);

  while ((_status &
          (ImageObserver.ALLBITS   |
           ImageObserver.FRAMEBITS |
           ImageObserver.ERROR     |
           ImageObserver.ABORT)) == 0)
  {
    try
    {
      wait();
    }
    catch (InterruptedException e)
    {
      Thread.currentThread().interrupt();
      return false;
    }
  }

  return ((_status & (ImageObserver.ALLBITS |
                      ImageObserver.FRAMEBITS)) != 0);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:ImageLoader.java

示例2: imageUpdate

public synchronized boolean imageUpdate(
  Image img,
  int infoflags,
  int x,
  int y,
  int width,
  int height
  )
{
  _status |= infoflags;

  if ((infoflags &
        (ImageObserver.ALLBITS |
         ImageObserver.FRAMEBITS |
         ImageObserver.ERROR   |
         ImageObserver.ABORT)) != 0)
  {
    notifyAll();
    return false;
  }

  return true;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:ImageLoader.java

示例3: OctreeQuantizer

/**
 * Create a new octree and insert image data. This constructor is mostly
 * used by OctreeFilter.
 * @param im The image that provides pixel data to construct the tree
 */
public OctreeQuantizer(Image im)
{
  this();

  // first retrieve the pixels
  ImageLoader il = new ImageLoader(im);
  il.start();
  if(!il.waitFor()){
    throw new IllegalArgumentException(_LOG.getMessage(
      "PROBLEM_LOADING"));
  }
  int width = im.getWidth(il);
  int height = im.getHeight(il);
  int[] pixels = new int[width*height]; // going to hold all
  // the image's pixels
  
  PixelGrabber grabber = new PixelGrabber(im.getSource(), 0, 0,
                                          width, height,
                                          pixels, 0, width);
  try // get the pixels
  { 
    grabber.grabPixels();
  } 
  catch (InterruptedException e) 
  {
    throw new IllegalArgumentException(_LOG.getMessage(
      "GRABBING_PIXELS"));
  } 
  if ((grabber.getStatus() & ImageObserver.ABORT) != 0) 
  {
    throw new IllegalArgumentException(_LOG.getMessage(
      "ERROR_FETCHING_IMAGE", new Object[]{pixels.length,width,height}));
  }

  // add all pixels to the tree.
  for (int i = 0; i < pixels.length; i++)
    addColor(pixels[i]);

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:44,代码来源:OctreeQuantizer.java

示例4: drawToBufImage

public boolean drawToBufImage(Graphics g, ToolkitImage img,
                              int x, int y, Color bg,
                              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);
    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))) {
        g.drawImage (bimage, x, y, bg, null);
    }

    return done;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:ImageRepresentation.java

示例5: testToolkitImageObserver

static void testToolkitImageObserver(final Image image) {

        ImageObserver observer = new ImageObserver() {

            @Override
            public boolean imageUpdate(Image img, int infoflags, int x, int y,
                int width, int height) {

                if (img != image) {
                    throw new RuntimeException("Wrong image in observer");
                }

                if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT))
                    != 0) {
                    throw new RuntimeException("Error during image loading");
                }

                return (infoflags & ImageObserver.ALLBITS) == 0;

            }
        };

        final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
            2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
        setImageScalingHint(g2x, true);

        g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0,
            IMAGE_WIDTH, IMAGE_HEIGHT, observer);

    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:MultiResolutionImageTest.java

示例6: getPixels

public static int[] getPixels(Image img, int x, int y, int w, int h) {
    int[] pixels = new int[w * h]; // PixelGrabber does the work of getting
                                   // actual RGB pixel values for // us from
                                   // the image.
    PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
    try {
        pg.grabPixels();
    } catch (InterruptedException e) {
        System.err.println("interrupted waiting for pixels!");
    }

    if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
        System.err.println("image fetch aborted or errored");
    }
    return pixels;
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:16,代码来源:TabUtilities.java

示例7: imageUpdate

public boolean imageUpdate (Image img, int infoflags, int x, int y, int width, int height) {
//            System.out.println ("INFO: " + infoflags);
            setImageCore (image);
            getScene ().validate ();
            return (infoflags & (ImageObserver.ABORT | ImageObserver.ERROR)) == 0;
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ImageWidget.java

示例8: imageComplete

public void imageComplete(int status) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    boolean done;
    int info;
    switch (status) {
    default:
    case ImageConsumer.IMAGEABORTED:
        done = true;
        info = ImageObserver.ABORT;
        break;
    case ImageConsumer.IMAGEERROR:
        image.addInfo(ImageObserver.ERROR);
        done = true;
        info = ImageObserver.ERROR;
        dispose();
        break;
    case ImageConsumer.STATICIMAGEDONE:
        done = true;
        info = ImageObserver.ALLBITS;
        break;
    case ImageConsumer.SINGLEFRAMEDONE:
        done = false;
        info = ImageObserver.FRAMEBITS;
        break;
    }
    synchronized (this) {
        if (done) {
            image.getSource().removeConsumer(this);
            consuming = false;
            newbits = null;

            if (bimage != null) {
                bimage = getOpaqueRGBImage();
            }
        }
        availinfo |= info;
        notifyAll();
    }

    newInfo(image, info, 0, 0, width, height);

    image.infoDone(status);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:ImageRepresentation.java

示例9: testToolkitImageObserver

static void testToolkitImageObserver(final Image image) {

        ImageObserver observer = new ImageObserver() {

            @Override
            public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {

                if (img != image) {
                    throw new RuntimeException("Wrong image in observer");
                }

                if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT)) != 0) {
                    throw new RuntimeException("Error during image loading");
                }

                return (infoflags & ImageObserver.ALLBITS) == 0;

            }
        };

        final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
                2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
        setImageScalingHint(g2x, true);

        g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, observer);

    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:MultiResolutionImageTest.java


注:本文中的java.awt.image.ImageObserver.ABORT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。