API Reference 0.3.24dart_web_toolkit_uiClippedImagePrototype

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

Constructors

new ClippedImagePrototype(SafeUri url, int left, int top, int width, int height) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
ClippedImagePrototype(this.url, this.left, this.top, this.width, this.height);

Properties

final int height #

final int height

final int left #

final int left

final int top #

final int top

final SafeUri url #

final SafeUri url

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

docs inherited from AbstractImagePrototype
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()}
docs inherited from AbstractImagePrototype
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
docs inherited from AbstractImagePrototype
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

docs inherited from AbstractImagePrototype
Image createImage() {
 return new Image.fromSafeUriAndMeasure(url, left, top, width, height);
}

String getHtml() #

inherited from AbstractImagePrototype

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

docs inherited from AbstractImagePrototype
SafeHtml getSafeHtml() {
 return _impl.getSafeHtml(url, left, top, width, height);
}