public class UIImage extends NSObject implements NSSecureCoding
Modifier and Type | Method and Description |
---|---|
static UIImage |
animatedImageNamed(String name,
double duration)
Returns a special animated image based on a image sequence, starting to
name0 up to name1024.
|
static UIImage |
animatedImageWithImages(List<UIImage> images,
double duration) |
CGImage |
CGImage()
Returns the underlying image data.
|
void |
drawAtPoint(CGPoint point)
Draws this image using the specified benchmark point.
|
void |
drawInRect(CGRect rect)
Draws this image within the specified rectangle.
|
double |
duration()
The duration of the animated image, or 0 if it is not animated.
|
static UIImage |
imageNamed(String filename)
Returns the image that corresponds to the specified filename.
|
int |
imageOrientation() |
List<UIImage> |
images()
In case this is an animated image, the list of the animated images, or
null otherwise.
|
static UIImage |
imageWithCGImage(CGImage img)
Returns an image using the given Core Graphics image.
|
static UIImage |
imageWithCGImage(CGImage img,
double scale,
int UIImageOrientation)
Returns an image using the given Core Graphics image with the specified
scale and orientation factors.
|
static UIImage |
imageWithContentsOfFile(String filename)
Returns an image that is created using the image data of the specified
file.
|
static UIImage |
imageWithData(NSData data)
Returns an image that is created using the specified image data.
|
UIImage |
imageWithRenderingMode(int UIImageRenderingMode)
Return a new image, based on the current image, with different rendering
mode
|
NSData |
JPEGRepresentation(double compressionQuality)
Returns JPEG encoded data for this image.
|
NSData |
PNGRepresentation()
Returns PNG encoded data for this image.
|
int |
renderingMode()
Retreive the rendering mode of this image.
|
UIImage |
resizableImageWithCapInsets(UIEdgeInsets capInsets)
Returns an image with the specified cap insets.
|
UIImage |
resizableImageWithCapInsets(UIEdgeInsets capInsets,
int UIImageResizingMode)
Returns an image with the specified cap insets and resizing mode.
|
double |
scale()
The scaling of this image: this is used for high resolution images to
display correctly.
|
CGSize |
size()
Returns the dimensions of this image.
|
UIImage |
stretchableImageWithLeftCapWidth(int leftCapWidth,
int topCapHeight)
Deprecated.
|
String |
toString() |
void |
writeToSavedPhotosAlbum(UIImageWriteToPhotoAlbumHandler callback,
Object contextInfo)
Adds this image to the user’s photo album.
|
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
supportsSecureCoding
public static UIImage imageWithCGImage(CGImage img)
img
- The Core Graphics image used.public static UIImage imageWithCGImage(CGImage img, double scale, int UIImageOrientation)
img
- The Core Graphics image used.scale
- The scale of the new image.UIImageOrientation
- The orientation of the image.UIImageOrientation
public static UIImage imageNamed(String filename)
filename
- The filename for which the image is requested.public static UIImage imageWithData(NSData data)
data
- The image data for the new image.public static UIImage imageWithContentsOfFile(String filename)
filename
- The file name containing the image data of the new image.public static UIImage animatedImageNamed(String name, double duration)
name
- The base name of this imageduration
- the duration of the animationpublic static UIImage animatedImageWithImages(List<UIImage> images, double duration)
@Deprecated public UIImage stretchableImageWithLeftCapWidth(int leftCapWidth, int topCapHeight)
leftCapWidth
- The width of the cap.topCapHeight
- The height of the cap.public UIImage resizableImageWithCapInsets(UIEdgeInsets capInsets)
capInsets
- The cap insets of the new image.public UIImage resizableImageWithCapInsets(UIEdgeInsets capInsets, int UIImageResizingMode)
capInsets
- The cap insets of the new image.UIImageResizingMode
- The resizing mode of the new image.public UIImage imageWithRenderingMode(int UIImageRenderingMode)
UIImageRenderingMode
- the new rendering modepublic int imageOrientation()
public double scale()
public int renderingMode()
public CGImage CGImage()
public void drawInRect(CGRect rect)
rect
- The rectangle into which the image is drawn.public void drawAtPoint(CGPoint point)
point
- The benchmark point of the image.public CGSize size()
public List<UIImage> images()
public double duration()
public NSData PNGRepresentation()
public NSData JPEGRepresentation(double compressionQuality)
compressionQuality
- The quality of the image.public void writeToSavedPhotosAlbum(UIImageWriteToPhotoAlbumHandler callback, Object contextInfo)
callback
- The callback handler.contextInfo
- The context info.Copyright © 2020. All rights reserved.