public abstract class DynamicImage
ImplementsActionSource
java.lang.Object, int, int, int, int)
method.Constructors
public DynamicImage() | Constructor. |
public DynamicImage(int w, int h) | Constructor with width and height. |
Methods
public static void setIcon(Label lbl, DynamicImage img) | Sets the given image as the icon for the specified label. |
public Style getStyle() | Gets the style for this image. |
public void setStyle(Style s) | Sets the style to be used for drawing the image. |
public int getWidth() | Returns the width of the image |
public int getHeight() | Returns the height of the image |
public void scale(int width, int height) | Scale the image to the given width and height, this is a fast algorithm that preserves translucent information |
public Image fill(int width, int height) | Resizes/crops the image so that its center fills the given dimensions. |
public 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. |
public boolean requiresDrawImage() | New label optimizations don’t invoke drawImage and instead just pass the native image directly to the underlying renderer. |
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. |
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. |
Inherited methods
From Image
isSimdOptimizationsEnabled, setSimdOptimizationsEnabled, resetSimdOptimizationsEnabled, isSVGSupported, createSVG, createIndexed, createImage, createImage, createImage, createImage, createImage, isAlphaMutableImageSupported, createImage, createImage, exifRotation, exifRotation, exifRotation, getExifOrientationTag, getExifOrientationTag, isJPEG, isPNG, asyncLock, lock, isLocked, unlock, getSVGDocument, isSVG, createMask, applyMask, applyMaskAutoScale, subImage, mirror, rotate, modifyAlpha, modifyAlphaWithTranslucency, modifyAlpha, getGraphics, toRGB, getRGB, getRGB, getRGBCached, scaledWidth, scaledHeight, scaledSmallerRatio, scaledLargerRatio, scaled, getImage, isAnimation, animate, isOpaque, getImageName, setImageName, dispose, rotate90Degrees, rotate180Degrees, rotate270Degrees, flipHorizontally, flipVertically, addActionListener, removeActionListener, fireChangedEvent
Constructor details
DynamicImage
public DynamicImage()DynamicImage
public DynamicImage(int w, int h)Parameters
wint- The width of the image.
hint- The height of the image.
Method details
setIcon
public static void setIcon(Label lbl, DynamicImage img)java.lang.Object, int, int, int, int)
so that the image can correctly adapt to the label’s style.getStyle
public Style getStyle()setStyle
public void setStyle(Style s)java.lang.Object, int, int, int, int)
can use any aspect of this style to customize the drawing.Parameters
sStyle- The style.
getWidth
public int getWidth()Returns
getHeight
public int getHeight()Returns
scale
public void scale(int width, int height)Parameters
widthint- width for the scaling
heightint- height of the scaled image
fill
public Image fill(int width, int height)com.codename1.ui.plaf.Style#BACKGROUND_IMAGE_SCALED_FILLParameters
widthint- the width to fill
heightint- the height to fill
Returns
applyMask
public Image applyMask(Object mask)Parameters
maskObject- mask object created by the createMask() method.
Returns
Throws
IllegalArgumentException- if the image size doesn’t match the mask size
requiresDrawImage
public boolean requiresDrawImage()Returns
drawImageImpl
protected abstract void drawImageImpl(Graphics g, Object nativeGraphics, int x, int y, int w, int h)Parameters
gGraphics- The graphics context
nativeGraphicsObject- THe native graphics context.
xint- x-coordinate of the bounds to draw.
yint- y-coordinate of the bounds to draw.
wint- width of the bounds
hint- height of the bounds
drawImage
protected void drawImage(Graphics g, Object nativeGraphics, int x, int y)Parameters
gGraphics- the graphics object
nativeGraphicsObject- the underlying native graphics which might be essential for some image types
xint- the x coordinate
yint- the y coordinate
drawImage
protected void drawImage(Graphics g, Object nativeGraphics, int x, int y, int w, int h)Parameters
gGraphics- the graphics object
nativeGraphicsObject- the underlying native graphics which might be essential for some image types
xint- the x coordinate
yint- the y coordinate
wint- the width to occupy
hint- the height to occupy