Package com.emitrom.lienzo.client.core.types

Examples of com.emitrom.lienzo.client.core.types.ImageLoader


        m_destinationWidth = (int) Math.round(m_picture.getClippedImageDestinationWidth());

        m_destinationHeight = (int) Math.round(m_picture.getClippedImageDestinationHeight());

        new ImageLoader(url)
        {
            @Override
            public void onLoaded(ImageLoader image)
            {
                Console.log("loaded " + url + " time=" + (System.currentTimeMillis() - start));

                m_imageJSO = image.getJSO();

                if (m_width == 0)
                {
                    m_width = image.getWidth();
                }
                if (m_height == 0)
                {
                    m_height = image.getHeight();
                }
                if (m_destinationWidth == 0)
                {
                    m_destinationWidth = m_width;
                }
                if (m_destinationHeight == 0)
                {
                    m_destinationHeight = m_height;
                }
                if (false == m_picture.isListening())
                {
                    doneLoading();

                    return;
                }
                // Prepare the Image for the Selection Layer.
                // Get ImageData of the image by drawing it in a temporary canvas...

                ScratchCanvas scratch = new ScratchCanvas(m_destinationWidth, m_destinationHeight);

                Context2D context = scratch.getContext();

                context.drawImage(m_imageJSO, m_x, m_y, m_width, m_height, 0, 0, m_destinationWidth, m_destinationHeight);

                ImageData imageData = context.getImageData(0, 0, m_destinationWidth, m_destinationHeight);

                // Now draw the image again, replacing each color with the color key

                scratch.clear();

                Color rgb = Color.fromColorString(m_picture.getColorKey());

                context.putImageData(new RGBIgnoreAlphaImageDataFilter(rgb.getR(), rgb.getG(), rgb.getB()).filter(imageData, true), 0, 0);

                // Load the resulting image from the temporary canvas into the selection Image

                String dataURL = scratch.toDataURL();

                new ImageLoader(dataURL)
                {
                    @Override
                    public void onLoaded(ImageLoader image)
                    {
                        m_selectionImageJSO = image.getJSO();
View Full Code Here


        m_destinationWidth = (int) Math.round(m_picture.getClippedImageDestinationWidth());

        m_destinationHeight = (int) Math.round(m_picture.getClippedImageDestinationHeight());

        new ImageLoader(url)
        {
            @Override
            public void onLoaded(ImageLoader image)
            {
                Console.log("loaded " + url + " time=" + (System.currentTimeMillis() - start));

                m_imageJSO = image.getJSO();

                if (m_width == 0)
                {
                    m_width = image.getWidth();
                }
                if (m_height == 0)
                {
                    m_height = image.getHeight();
                }
                if (m_destinationWidth == 0)
                {
                    m_destinationWidth = m_width;
                }
                if (m_destinationHeight == 0)
                {
                    m_destinationHeight = m_height;
                }
                if (false == m_picture.isListening())
                {
                    doneLoading();

                    return;
                }
                // Prepare the Image for the Selection Layer.
                // Get ImageData of the image by drawing it in a temporary canvas...

                ScratchCanvas scratch = new ScratchCanvas(m_destinationWidth, m_destinationHeight);

                Context2D context = scratch.getContext();

                context.drawImage(m_imageJSO, m_x, m_y, m_width, m_height, 0, 0, m_destinationWidth, m_destinationHeight);

                ImageData imageData = context.getImageData(0, 0, m_destinationWidth, m_destinationHeight);

                // Now draw the image again, replacing each color with the color key

                scratch.clear();

                Color rgb = Color.fromColorString(m_picture.getColorKey());

                context.putImageData(new RGBIgnoreAlphaImageDataFilter(rgb.getR(), rgb.getG(), rgb.getB()).filter(imageData), 0, 0);

                // Load the resulting image from the temporary canvas into the selection Image

                String dataURL = scratch.toDataURL();

                new ImageLoader(dataURL)
                {
                    @Override
                    public void onLoaded(ImageLoader image)
                    {
                        m_selectionImageJSO = image.getJSO();
View Full Code Here

TOP

Related Classes of com.emitrom.lienzo.client.core.types.ImageLoader

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.