public abstract class DynamicImage extends Image
drawImageImpl(com.codename1.ui.Graphics, java.lang.Object, int, int, int, int)
method.Constructor and Description |
---|
DynamicImage()
Constructor.
|
DynamicImage(int w,
int h)
Constructor with width and height.
|
Modifier and Type | Method and Description |
---|---|
Image |
applyMask(Object mask)
Applies the given alpha mask onto this image and returns the resulting image
see the createMask method for indication on how to convert an image into an alpha
mask.
|
protected void |
drawImage(Graphics g,
Object nativeGraphics,
int x,
int y)
Callback invoked internally by Codename One to draw the image/frame onto the display.
|
protected void |
drawImage(Graphics g,
Object nativeGraphics,
int x,
int y,
int w,
int h)
Callback invoked internally by Codename One to draw the image/frame onto the display.
|
protected abstract void |
drawImageImpl(Graphics g,
Object nativeGraphics,
int x,
int y,
int w,
int h)
This method should be overridden by subclasses to perform the actual drawing of
the image on a graphics context.
|
Image |
fill(int width,
int height)
Resizes/crops the image so that its center fills the given dimensions.
|
int |
getHeight()
Returns the height of the image
|
Style |
getStyle()
Gets the style for this image.
|
int |
getWidth()
Returns the width of the image
|
boolean |
requiresDrawImage()
New label optimizations don't invoke drawImage and instead just pass the native image directly to
the underlying renderer.
|
void |
scale(int width,
int height)
Scale the image to the given width and height, this is a fast algorithm
that preserves translucent information
|
static void |
setIcon(Label lbl,
DynamicImage img)
Sets the given image as the icon for the specified label.
|
void |
setStyle(Style s)
Sets the style to be used for drawing the image.
|
addActionListener, animate, applyMask, applyMaskAutoScale, asyncLock, createImage, createImage, createImage, createImage, createImage, createImage, createImage, createIndexed, createMask, createSVG, dispose, exifRotation, exifRotation, exifRotation, fireChangedEvent, flipHorizontally, flipVertically, getExifOrientationTag, getExifOrientationTag, getGraphics, getImage, getImageName, getRGB, getRGB, getRGBCached, getSVGDocument, isAlphaMutableImageSupported, isAnimation, isJPEG, isLocked, isOpaque, isPNG, isSVG, isSVGSupported, lock, mirror, modifyAlpha, modifyAlpha, modifyAlphaWithTranslucency, removeActionListener, rotate, rotate180Degrees, rotate270Degrees, rotate90Degrees, scaled, scaledHeight, scaledLargerRatio, scaledSmallerRatio, scaledWidth, setImageName, subImage, toRGB, unlock
public DynamicImage()
public DynamicImage(int w, int h)
w
- The width of the image.h
- The height of the image.public void setStyle(Style s)
drawImageImpl(com.codename1.ui.Graphics, java.lang.Object, int, int, int, int)
can use any aspect of this style to customize the drawing.s
- The style.public Style getStyle()
public int getWidth()
public int getHeight()
public void scale(int width, int height)
public Image fill(int width, int height)
Style.BACKGROUND_IMAGE_SCALED_FILL
public Image applyMask(Object mask)
public boolean requiresDrawImage()
Image
requiresDrawImage
in class Image
protected abstract void drawImageImpl(Graphics g, Object nativeGraphics, int x, int y, int w, int h)
g
- The graphics contextnativeGraphics
- THe native graphics context.x
- x-coordinate of the bounds to draw.y
- y-coordinate of the bounds to draw.w
- width of the boundsh
- height of the boundsprotected void drawImage(Graphics g, Object nativeGraphics, int x, int y)
protected void drawImage(Graphics g, Object nativeGraphics, int x, int y, int w, int h)
public static void setIcon(Label lbl, DynamicImage img)
drawImageImpl(com.codename1.ui.Graphics, java.lang.Object, int, int, int, int)
so that the image can correctly adapt to the label's style.