Examples of MediaTracker


Examples of java.awt.MediaTracker

        }
        return out;
    }

    public Shape3D getModel(Image img, float alpha, boolean scale) {
        MediaTracker tracker = new MediaTracker(comp);

        // Fully load image before continuing
        tracker.addImage(img, 0);
        do {
            try { tracker.waitForID(0); } catch (InterruptedException e) { continue; }
        } while (false);
        tracker.removeImage(img);

        final int w = img.getWidth(null), h = img.getHeight(null);
        BufferedImage tmp = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);

        Graphics2D tgr = tmp.createGraphics();
        tgr.drawImage(img, null, null);
        tgr.dispose();
        tgr = null;

        tracker.addImage(tmp, 1);
        do {
            try { tracker.waitForID(1); } catch (InterruptedException e) { continue; }
        } while (false);
        tracker.removeImage(tmp);

        Shape3D model = new ImageModel(tmp, scale);
        Appearance app = new Appearance();
        app.setTexture(getTexture(img, false, null, alpha, true));
        if (alpha != 1.0) app.setTransparencyAttributes(C.alphaTexture);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.