public class ComponentImage
ImplementsActionSource
Nested types
class ComponentImage.EncodedWrapper | A wrapper for ComponentImage to convert it to an EncodedImage. |
Constructors
public ComponentImage(Component cmp, int w, int h) | Creates a new image that renders the given component. |
Methods
public Component getComponent() | Gets the wrapped component that is rendered by this image. |
public void enablePulsingAnimation(double currStep, double stepSize, double minAlpha, double maxAlpha) | Enables a pulsing animation on the image. |
public void disablePulsingAnimation() | Disables the pulsing animation. |
public boolean isPulsingAnimationEnabled() | Checks if pulsing animation is enabled. |
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 isAnimation() | Checks if this is an animation. |
public void setAnimation(boolean anim) | Sets whether this in an animation. |
public boolean requiresDrawImage() | Overridden to always return true so that the paint() method is called on this image. |
protected void drawImage(Graphics g, Object nativeGraphics, int x, int y) | Draws the image. |
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. |
public Image scaled(int width, int height) | Returns a scaled version of this image image using the given width and height, this is a fast algorithm that preserves translucent information. |
public boolean animate() | Advances this image’s animation state, if it is animated. |
public EncodedImage toEncodedImage() | Converts to an encoded image. |
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, getImage, isOpaque, getImageName, setImageName, dispose, rotate90Degrees, rotate180Degrees, rotate270Degrees, flipHorizontally, flipVertically, addActionListener, removeActionListener, fireChangedEvent
Constructor details
ComponentImage
public ComponentImage(Component cmp, int w, int h)Parameters
cmpComponent- The component to render.
wint- The width of the image.
hint- The height of the image.
Method details
getComponent
public Component getComponent()enablePulsingAnimation
public void enablePulsingAnimation(double currStep, double stepSize, double minAlpha, double maxAlpha)Parameters
currStepdouble- The current step.
stepSizedouble- The step size.
minAlphadouble- The min alpha
maxAlphadouble- The max alpha
disablePulsingAnimation
public void disablePulsingAnimation()isPulsingAnimationEnabled
public boolean isPulsingAnimationEnabled()getWidth
public int getWidth()Returns
getHeight
public int getHeight()Returns
scale
public void scale(int width, int height)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)Returns
Throws
IllegalArgumentException- if the image size doesn’t match the mask size
isAnimation
public boolean isAnimation()Returns
setAnimation
public void setAnimation(boolean anim)Parameters
animboolean- True to make this an animated image
requiresDrawImage
public boolean requiresDrawImage()Returns
drawImage
protected void drawImage(Graphics g, Object nativeGraphics, int x, int y)Parameters
gGraphics- The graphics context
nativeGraphicsObject- The native graphics context
xint- The x coordinate at which to draw the image.
yint- The y coordinate at which to draw the image.
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
scaled
public Image scaled(int width, int height)Parameters
widthint- width for the scaling
heightint- height of the scaled image
Returns
animate
public boolean animate()Returns
true if the animation state changed.toEncodedImage
public EncodedImage toEncodedImage()