ClippedImagePrototype class
Implementation of {@link AbstractImagePrototype} for a clipped image. This class is used internally by the image bundle generator and is not intended for general use. It is subject to change without warning.
class ClippedImagePrototype extends AbstractImagePrototype { static final ClippedImageImpl _impl = new ClippedImageImpl(); //GWT.create(ClippedImageImpl.class); final int height; final int left; final int top; final SafeUri url; final int width; ClippedImagePrototype(this.url, this.left, this.top, this.width, this.height); void applyTo(Image image) { image.setSafeUrlAndVisibleRect(url, left, top, width, height); } void applyToImageElement(dart_html.ImageElement imageElement) { _impl.adjust(imageElement, url, left, top, width, height); } dart_html.ImageElement createElement() { return _impl.createStructure(url, left, top, width, height) as dart_html.ImageElement; } Image createImage() { return new Image.fromSafeUriAndMeasure(url, left, top, width, height); } SafeHtml getSafeHtml() { return _impl.getSafeHtml(url, left, top, width, height); } }
Extends
AbstractImagePrototype > ClippedImagePrototype
Properties
final int height #
final int height
final int left #
final int left
final int top #
final int top
final int width #
final int width
Methods
void applyTo(Image image) #
Transforms an existing {@link Image} into the image represented by this prototype.
@param image the instance to be transformed to match this prototype
void applyTo(Image image) { image.setSafeUrlAndVisibleRect(url, left, top, width, height); }
void applyToImageElement(ImageElement imageElement) #
Transforms an existing {@link ImagePrototypeElement} into the image represented by this prototype.
@param imageElement an <code>ImagePrototypeElement</code> created by
{@link #createElement()}
void applyToImageElement(dart_html.ImageElement imageElement) { _impl.adjust(imageElement, url, left, top, width, height); }
ImageElement createElement() #
Creates a new {@link Element} based on the image represented by this prototype. The DOM structure may not necessarily a simple <code><img></code> element. It may be a more complex structure that should be treated opaquely.
@return the <code>ImagePrototypeElement</code> corresponding to the image
represented by this prototype
dart_html.ImageElement createElement() { return _impl.createStructure(url, left, top, width, height) as dart_html.ImageElement; }
Image createImage() #
Creates a new {@link Image} instance based on the image represented by this prototype.
@return a new {@link Image} based on this prototype
Image createImage() { return new Image.fromSafeUriAndMeasure(url, left, top, width, height); }
String getHtml() #
Gets an HTML fragment that displays the image represented by this prototype. The HTML returned is not necessarily a simple <code><img></code> element. It may be a more complex structure that should be treated opaquely. <p> The default implementation calls {@link #getSafeHtml()}.
@return the HTML representation of this prototype
String getHtml() { return getSafeHtml().asString(); }
SafeHtml getSafeHtml() #
Gets an HTML fragment that displays the image represented by this prototype. The HTML returned is not necessarily a simple <code><img></code> element. It may be a more complex structure that should be treated opaquely. <p> The default implementation throws an {@link UnsupportedOperationException}.
@return the HTML representation of this prototype
SafeHtml getSafeHtml() { return _impl.getSafeHtml(url, left, top, width, height); }