Package org.thenesis.microbackend.ui.graphics

Examples of org.thenesis.microbackend.ui.graphics.VirtualImage


        this.image = image;
    }

    /** Creates a new instance of ImageImpl */
    Image(int[] imageArray, int w, int h) {
        this(new VirtualImage(imageArray, w, h, true));
    }
View Full Code Here


        // translucency to
        // be maintained in the newly created image
        int[] arr = new int[width * height];
        image.getRGB(arr, 0, width, x, y, width, height);

        Image i = new Image(new VirtualImage(arr, width, height, processAlpha));
        i.opaque = opaque;
        i.opaqueTested = opaqueTested;
        return i;
    }
View Full Code Here

     * @return newly created image object
     */
    public static Image createImage(String path) throws IOException {
        try {
            InputStream is = Image.class.getResourceAsStream(path);
            return new Image(new VirtualImage(is));
        } catch (OutOfMemoryError err) {
            // Images have a major bug on many phones where they sometimes throw
            // an OOM with no reason. A system.gc followed by the same call over
            // solves the problem. This has something to do with the fact that
            // there is no Image.dispose method in existance.
            System.gc();
            System.gc();
            InputStream is = Image.class.getResourceAsStream(path);
            return new Image(new VirtualImage(is));
        }
    }
View Full Code Here

     *            a given InputStream
     * @throws java.io.IOException
     */
    public static Image createImage(InputStream stream) throws IOException {
        try {
            return new Image(new VirtualImage(stream));
        } catch (OutOfMemoryError err) {
            // Images have a major bug on many phones where they sometimes throw
            // an OOM with no reason. A system.gc followed by the same call over
            // solves the problem. This has something to do with the fact that
            // there is no Image.dispose method in existance.
            System.gc();
            System.gc();
            return new Image(new VirtualImage(stream));
        }
    }
View Full Code Here

     *            the image height
     * @return an image from an RGB image
     */
    public static Image createImage(int[] rgb, int width, int height) {
        try {
            Image i = new Image(new VirtualImage(rgb, width, height, true));

            // its already set so might as well do the test
            i.testOpaque(rgb);
            return i;
        } catch (OutOfMemoryError err) {
            // Images have a major bug on many phones where they sometimes throw
            // an OOM with no reason. A system.gc followed by the same call over
            // solves the problem. This has something to do with the fact that
            // there is no Image.dispose method in existance.
            System.gc();
            System.gc();
            return new Image(new VirtualImage(rgb, width, height, true));
        }
    }
View Full Code Here

     *            the image height
     * @return an image in a given width and height dimension
     */
    public static Image createImage(int width, int height) {
        try {
            return new Image(new VirtualImage(width, height));
        } catch (OutOfMemoryError err) {
            // Images have a major bug on many phones where they sometimes throw
            // an OOM with no reason. A system.gc followed by the same call over
            // solves the problem. This has something to do with the fact that
            // there is no Image.dispose method in existance.
            System.gc();
            System.gc();
            return new Image(new VirtualImage(width, height));
        }
    }
View Full Code Here

     *            the length of the data in the array
     */
    public static Image createImage(byte[] bytes, int offset, int len) {
        try {
            try {
                return new Image(new VirtualImage(bytes, offset, len));
            } catch (OutOfMemoryError err) {
                // Images have a major bug on many phones where they sometimes
                // throw
                // an OOM with no reason. A system.gc followed by the same call
                // over
                // solves the problem. This has something to do with the fact
                // that
                // there is no Image.dispose method in existance.
                System.gc();
                System.gc();
                return new Image(new VirtualImage(bytes, offset, len));
            }
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
View Full Code Here

        // if an image is opaque use a mutable image since on the device it
        // takes
        // far less memory
        // if(opaque) {
        image = new VirtualImage(width, height);
        VirtualGraphics g = image.getGraphics();
        g.drawRGB(destinationArray, 0, width, 0, 0, width, height, false);
        /*
         * } else { image = VirtualImage.createRGBImage(destinationArray, width,
         * height, true); }
View Full Code Here

TOP

Related Classes of org.thenesis.microbackend.ui.graphics.VirtualImage

Copyright © 2018 www.massapicom. 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.