Search in sources :

Example 11 with ImageElement

use of com.google.gwt.dom.client.ImageElement in project gwt-test-utils by gwt-test-utils.

the class ImagePatcher method getDim.

private static int getDim(Image image, String dim) {
    ImageElement elem = image.getElement().cast();
    String width = elem.getStyle().getProperty(dim);
    if (width == null) {
        return 0;
    }
    Matcher m = PATTERN.matcher(width);
    if (m.matches()) {
        return Integer.parseInt(m.group(1));
    }
    return 0;
}
Also used : Matcher(java.util.regex.Matcher) ImageElement(com.google.gwt.dom.client.ImageElement)

Example 12 with ImageElement

use of com.google.gwt.dom.client.ImageElement in project lienzo-core by ahome-it.

the class Sprite method load.

Sprite load() {
    if (isLoaded()) {
        if (null != m_loaded) {
            m_loaded.onSpriteLoaded(this);
        }
    } else {
        final String url = getURL();
        new ImageLoader(url) {

            @Override
            public void onImageElementLoad(final ImageElement elem) {
                m_sprite = elem;
                if (null != m_loaded) {
                    m_loaded.onSpriteLoaded(Sprite.this);
                }
            }

            @Override
            public void onImageElementError(String message) {
                LienzoCore.get().error("Sprite could not load URL " + url + " " + message);
            }
        };
    }
    return this;
}
Also used : ImageElement(com.google.gwt.dom.client.ImageElement) JSONString(com.google.gwt.json.client.JSONString) ImageLoader(com.ait.lienzo.client.core.image.ImageLoader)

Aggregations

ImageElement (com.google.gwt.dom.client.ImageElement)12 CanvasElement (com.google.gwt.dom.client.CanvasElement)2 NativeEvent (com.google.gwt.dom.client.NativeEvent)2 ImageLoader (com.ait.lienzo.client.core.image.ImageLoader)1 Canvas (com.google.gwt.canvas.client.Canvas)1 Context2d (com.google.gwt.canvas.dom.client.Context2d)1 Element (com.google.gwt.dom.client.Element)1 IFrameElement (com.google.gwt.dom.client.IFrameElement)1 Style (com.google.gwt.dom.client.Style)1 JSONString (com.google.gwt.json.client.JSONString)1 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)1 HTML (com.google.gwt.user.client.ui.HTML)1 WebGLTexture (com.google.gwt.webgl.client.WebGLTexture)1 Inject (com.google.inject.Inject)1 Matcher (java.util.regex.Matcher)1 ResourceImageOptions (org.cesiumjs.cs.core.options.ResourceImageOptions)1 Entity (org.cesiumjs.cs.datasources.Entity)1 BillboardGraphics (org.cesiumjs.cs.datasources.graphics.BillboardGraphics)1 BillboardGraphicsOptions (org.cesiumjs.cs.datasources.graphics.options.BillboardGraphicsOptions)1 EntityOptions (org.cesiumjs.cs.datasources.options.EntityOptions)1