Class TeaImage
java.lang.Object
nl.colorize.multimedialib.renderer.teavm.TeaImage
- All Implemented Interfaces:
Image
Image implementation that is based on an HTML
img element. Since all
browser images are loaded asynchronously, an instance of this class can refer
to either the full image, or to an image that is currently being loaded.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractRegion(Region subRegion) Returns a newImageinstance that is based on the same source image, but only contains the specified rectangular region within the source image.Returns aTeaImageinstance that uses the same<img>element as this instance, but points to the entire image rather than a specific image region.intgetAlpha(int x, int y) Returns the alpha of a pixel within the image.getColor(int x, int y) Returns the RGB color value of a pixel within the image.getId()Optional<org.teavm.jso.dom.html.HTMLImageElement> nl.colorize.util.Subject<org.teavm.jso.dom.html.HTMLImageElement> booleanbooleanisLoaded()toString()
-
Field Details
-
IMAGE_LOADING_REGION
-
-
Constructor Details
-
TeaImage
protected TeaImage(nl.colorize.util.Subject<org.teavm.jso.dom.html.HTMLImageElement> imagePromise, Region region)
-
-
Method Details
-
getImageElement
-
isLoaded
public boolean isLoaded() -
getRegion
-
extractRegion
Description copied from interface:ImageReturns a newImageinstance that is based on the same source image, but only contains the specified rectangular region within the source image. If thisImageis itself a region, the coordinates in theregionparameter will be interpreted relative to this image's region.- Specified by:
extractRegionin interfaceImage
-
getColor
Description copied from interface:ImageReturns the RGB color value of a pixel within the image. This does not include the pixel's alpha value even if the image does support transparency. The returned color does not include an alpha channel. The alpha value of transparent or translucent pixels in the image can be obtained usingImage.getAlpha(int, int). -
getAlpha
public int getAlpha(int x, int y) Description copied from interface:ImageReturns the alpha of a pixel within the image. The returned value is between 0 (fully transparent) and 100 (fully opaque). -
forParentImage
Returns aTeaImageinstance that uses the same<img>element as this instance, but points to the entire image rather than a specific image region.- Throws:
IllegalStateException- if the underlying<img>is still loading, and this image therefore is not available yet.
-
isFullImage
public boolean isFullImage() -
toString
-
getId
-
getImagePromise
public nl.colorize.util.Subject<org.teavm.jso.dom.html.HTMLImageElement> getImagePromise()
-