當前位置: 首頁>>代碼示例>>Java>>正文


Java MediaTracker.removeImage方法代碼示例

本文整理匯總了Java中java.awt.MediaTracker.removeImage方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaTracker.removeImage方法的具體用法?Java MediaTracker.removeImage怎麽用?Java MediaTracker.removeImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.MediaTracker的用法示例。


在下文中一共展示了MediaTracker.removeImage方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testToolkitMultiResolutionImageLoad

import java.awt.MediaTracker; //導入方法依賴的package包/類
static void testToolkitMultiResolutionImageLoad(Image image) throws Exception {

        MediaTracker tracker = new MediaTracker(new JPanel());
        tracker.addImage(image, 0);
        tracker.waitForID(0);
        if (tracker.isErrorAny()) {
            throw new RuntimeException("Error during image loading");
        }
        tracker.removeImage(image, 0);

        testImageLoaded(image);

        int w = image.getWidth(null);
        int h = image.getHeight(null);

        Image resolutionVariant = ((MultiResolutionImage) image)
                .getResolutionVariant(2 * w, 2 * h);

        if (image == resolutionVariant) {
            throw new RuntimeException("Resolution variant is not loaded");
        }

        testImageLoaded(resolutionVariant);
    }
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:25,代碼來源:MultiResolutionImageTest.java

示例2: testToolkitMultiResolutionImageLoad

import java.awt.MediaTracker; //導入方法依賴的package包/類
static void testToolkitMultiResolutionImageLoad(Image image)
    throws Exception {

    MediaTracker tracker = new MediaTracker(new JPanel());
    tracker.addImage(image, 0);
    tracker.waitForID(0);
    if (tracker.isErrorAny()) {
        throw new RuntimeException("Error during image loading");
    }
    tracker.removeImage(image, 0);

    testImageLoaded(image);

    int w = image.getWidth(null);
    int h = image.getHeight(null);

    Image resolutionVariant = ((MultiResolutionImage) image)
        .getResolutionVariant(2 * w, 2 * h);

    if (image == resolutionVariant) {
        throw new RuntimeException("Resolution variant is not loaded");
    }

    testImageLoaded(resolutionVariant);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:MultiResolutionImageTest.java

示例3: prepareImages

import java.awt.MediaTracker; //導入方法依賴的package包/類
public void prepareImages() {
    if (prepared) {
        return;
    }

    MediaTracker mt = new MediaTracker(this);
    for (int i = 0; i < images.length; i++) {
        mt.addImage(images[i], i);
    }
    try {
        mt.waitForAll();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    for (int i = 0; i < images.length; i++) {
        mt.removeImage(images[i], i);
    }

    if (params.scaleFactor != 1) {
        // TODO: scale if needed
        logger.unimplemented("image_scaling");
    }

    prepared = true;
}
 
開發者ID:ShiftMediaProject,項目名稱:libbluray,代碼行數:26,代碼來源:ImageFrameAccurateAnimation.java

示例4: pingstat

import java.awt.MediaTracker; //導入方法依賴的package包/類
static private void pingstat() {
    final int i = (int) (100.0 * ThreadLocalRandom.current().nextDouble());
    try {
        final URL url = new URL("http://c.statcounter.com/9994681/0/14bb645e/1/?reco=" + i + "");
        url.openConnection().setConnectTimeout(5000);
        final Image image = Toolkit.getDefaultToolkit().createImage(url);
        final MediaTracker mediatracker = new MediaTracker(app);
        mediatracker.addImage(image, 0);
        mediatracker.waitForID(0);
        mediatracker.removeImage(image, 0);
    } catch (final Exception ignored) {

    }
}
 
開發者ID:uwx,項目名稱:OpenNFMM,代碼行數:15,代碼來源:xtGraphics.java

示例5: ensureImageLoaded

import java.awt.MediaTracker; //導入方法依賴的package包/類
public static void ensureImageLoaded(final Image anImage) {
  final MediaTracker tracker = new MediaTracker(component);
  tracker.addImage(anImage, 1);
  try {
    tracker.waitForAll();
    tracker.removeImage(anImage);
  } catch (final InterruptedException ignored) {
    Thread.currentThread().interrupt();
  }
}
 
開發者ID:triplea-game,項目名稱:triplea,代碼行數:11,代碼來源:Util.java

示例6: paint

import java.awt.MediaTracker; //導入方法依賴的package包/類
public void paint(Graphics2D g) {
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                       RenderingHints.VALUE_ANTIALIAS_ON);
    //
    // Load Image
    //
    Image image = Toolkit.getDefaultToolkit().createImage("test-resources/org/apache/batik/svggen/resources/vangogh.png");
    MediaTracker tracker = new MediaTracker(new Button(""));
    tracker.addImage(image, 0);
    try{
        tracker.waitForAll();
    }catch(InterruptedException e){
        tracker.removeImage(image);
        image = null;
    }finally {
        if(image != null)
            tracker.removeImage(image);
        if(tracker.isErrorAny())
            image = null;
        if(image != null){
            if(image.getWidth(null)<0 ||
               image.getHeight(null)<0)
                image = null;
        }
    }

    if(image == null){
        throw new Error("Could not load image");
    }

    BufferedImage bi = new BufferedImage(image.getWidth(null),
                                         image.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics2D ig = bi.createGraphics();
    ig.drawImage(image, 0, 0, null);

    byte[] lookup = new byte[256];
    for(int i=0; i<256; i++)
        lookup[i] = (byte)(255 - i);

    LookupTable table = new ByteLookupTable(0, lookup);
    java.awt.image.LookupOp inverter = new java.awt.image.LookupOp(table, null);

    // Simply paint the image without and with the lookup filter
    g.setPaint(Color.black);
    g.drawString("Normal / Inverted", 10, 20);
    g.drawImage(image, 10, 30, null);
    g.drawImage(bi, inverter, 10 + bi.getWidth() + 10, 30);
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:49,代碼來源:Lookup.java

示例7: paint

import java.awt.MediaTracker; //導入方法依賴的package包/類
public void paint(Graphics2D g) {
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                       RenderingHints.VALUE_ANTIALIAS_ON);
    //
    // Load Image
    //
    Image image = Toolkit.getDefaultToolkit().createImage("test-resources/org/apache/batik/svggen/resources/vangogh.jpg");
    MediaTracker tracker = new MediaTracker(new Button(""));
    tracker.addImage(image, 0);
    try{
        tracker.waitForAll();
    }catch(InterruptedException e){
        tracker.removeImage(image);
        image = null;
    }finally {
        if(image != null)
            tracker.removeImage(image);
        if(tracker.isErrorAny())
            image = null;
        if(image != null){
            if(image.getWidth(null)<0 ||
               image.getHeight(null)<0)
                image = null;
        }
    }

    if(image == null){
        throw new Error("Could not load image");
    }

    BufferedImage bi = new BufferedImage(image.getWidth(null),
                                         image.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics2D ig = bi.createGraphics();
    ig.drawImage(image, 0, 0, null);

    java.awt.image.RescaleOp brighten = new java.awt.image.RescaleOp(1.5f, 0, null);
    java.awt.image.RescaleOp darken = new java.awt.image.RescaleOp(.6f, 0, null);

    // Simply paint the image without and with rescale filters
    g.setPaint(Color.black);
    g.drawString("Brighter / Normal / Darker", 10, 20);
    g.drawImage(bi, brighten, 10, 30);
    g.drawImage(image, 10 + bi.getWidth() + 10, 30, null);
    g.drawImage(bi, darken, 10 + 2*(bi.getWidth() + 10), 30);

    g.translate(0, bi.getHeight() + 30 + 20);
    g.drawString("Rescale Red / Green / Blue", 10, 20);
    java.awt.image.RescaleOp redStress = new java.awt.image.RescaleOp(new float[]{ 2.0f, 1.0f, 1.0f },
                                        new float[]{ 0, 0, 0 }, null);
    java.awt.image.RescaleOp greenStress = new java.awt.image.RescaleOp(new float[]{ 1.0f, 2.0f, 1.0f },
                                          new float[]{ 0, 0, 0 }, null);
    java.awt.image.RescaleOp blueStress = new java.awt.image.RescaleOp(new float[]{ 1.0f, 1.0f, 2.0f },
                                         new float[]{ 0, 0, 0 }, null);

    g.drawImage(bi, redStress, 10, 30);
    g.drawImage(bi, greenStress, 10 + bi.getWidth() + 10, 30);
    g.drawImage(bi, blueStress, 10 + 2*(bi.getWidth() + 10), 30);
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:59,代碼來源:Rescale.java


注:本文中的java.awt.MediaTracker.removeImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。