public class ComponentImage extends Image
Modifier and Type | Class and Description |
---|---|
class |
ComponentImage.EncodedWrapper
A wrapper for ComponentImage to convert it to an EncodedImage.
|
Constructor and Description |
---|
ComponentImage(Component cmp,
int w,
int h)
Creates a new image that renders the given component.
|
Modifier and Type | Method and Description |
---|---|
boolean |
animate() |
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.
|
void |
disablePulsingAnimation()
Disables the pulsing animation.
|
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.
|
void |
enablePulsingAnimation(double currStep,
double stepSize,
double minAlpha,
double maxAlpha)
Enables a pulsing animation on the image.
|
Image |
fill(int width,
int height)
Resizes/crops the image so that its center fills the given dimensions.
|
Component |
getComponent()
Gets the wrapped component that is rendered by this image.
|
int |
getHeight()
Returns the height of the image
|
int |
getWidth()
Returns the width of the image
|
boolean |
isAnimation()
Checks if this is an animation.
|
boolean |
isPulsingAnimationEnabled()
Checks if pulsing animation is enabled.
|
boolean |
requiresDrawImage()
Overridden to always return true so that the paint() method is called
on this image.
|
void |
scale(int width,
int height)
Scale the image to the given width and height, this is a fast algorithm
that preserves translucent information
|
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.
|
void |
setAnimation(boolean anim)
Sets whether this in an animation.
|
EncodedImage |
toEncodedImage()
Converts to an encoded image.
|
addActionListener, 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, isJPEG, isLocked, isOpaque, isPNG, isSVG, isSVGSupported, lock, mirror, modifyAlpha, modifyAlpha, modifyAlphaWithTranslucency, removeActionListener, rotate, rotate180Degrees, rotate270Degrees, rotate90Degrees, scaledHeight, scaledLargerRatio, scaledSmallerRatio, scaledWidth, setImageName, subImage, toRGB, unlock
public ComponentImage(Component cmp, int w, int h)
cmp
- The component to render.w
- The width of the image.h
- The height of the image.public Component getComponent()
public void enablePulsingAnimation(double currStep, double stepSize, double minAlpha, double maxAlpha)
currStep
- The current step.stepSize
- The step size.minAlpha
- The min alphamaxAlpha
- The max alphapublic void disablePulsingAnimation()
public boolean isPulsingAnimationEnabled()
public int getWidth()
public int getHeight()
public void scale(int width, int height)
public Image fill(int width, int height)
Image
Style.BACKGROUND_IMAGE_SCALED_FILL
public Image applyMask(Object mask)
public void setAnimation(boolean anim)
anim
- True to make this an animated imagepublic boolean isAnimation()
isAnimation
in class Image
public boolean requiresDrawImage()
requiresDrawImage
in class Image
protected 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 Image scaled(int width, int height)
public EncodedImage toEncodedImage()