Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
UIImage: Difference between revisions - iPhone Development Wiki

UIImage: Difference between revisions

From iPhone Development Wiki
mNo edit summary
Line 5: Line 5:
[[Image:AppIcon.png|right|framed|From left to right: The original image; <tt>_applicationIconImagePrecomposed:NO</tt>; <tt>_applicationIconImagePrecomposed:YES</tt>; <tt>_smallApplicationIconImagePrecomposed:NO</tt>; <tt>_smallApplicationIconImagePrecomposed:YES</tt>]]
[[Image:AppIcon.png|right|framed|From left to right: The original image; <tt>_applicationIconImagePrecomposed:NO</tt>; <tt>_applicationIconImagePrecomposed:YES</tt>; <tt>_smallApplicationIconImagePrecomposed:NO</tt>; <tt>_smallApplicationIconImagePrecomposed:YES</tt>]]


{{Function signature|signature=-(UIImage*)_applicationIconImagePrecomposed:(BOOL)precomposed;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(UIImage*)_applicationIconImagePrecomposed:(BOOL)precomposed;|firmware=2.0 –}}
{{Function signature|signature=-(UIImage*)_smallApplicationIconImagePrecomposed:(BOOL)precomposed;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(UIImage*)_smallApplicationIconImagePrecomposed:(BOOL)precomposed;|firmware=2.0 –}}


These methods resize an image to icon size (59&times;59) or small icon size (29&times;29), clip out a rounded rectangle, draw shadows and apply a glossy overlay if required (when <tt>precomposed == NO</tt>), so that it resembles an icon.
These methods resize an image to icon size (59&times;59) or small icon size (29&times;29), clip out a rounded rectangle, draw shadows and apply a glossy overlay if required (when <tt>precomposed == NO</tt>), so that it resembles an icon.
Line 13: Line 13:


=== _flatImageWithWhite:alpha: ===
=== _flatImageWithWhite:alpha: ===
{{Function signature|signature=-(UIImage*)_flatImageWithWhite:(CGFloat)white alpha:(CGFloat)alpha;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(UIImage*)_flatImageWithWhite:(CGFloat)white alpha:(CGFloat)alpha;|firmware=2.0 –}}


Create an image having the same size as the original image, but filled with the solid color as the parameters.
Create an image having the same size as the original image, but filled with the solid color as the parameters.


=== _bezeledImageWithRed:green:blue:alpha: ===
=== _bezeledImageWithRed:green:blue:alpha: ===
{{Function signature|signature=-(UIImage*) _bezeledImageWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(UIImage*) _bezeledImageWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;|firmware=2.0 –}}


Create a solid white image having the same size as the original image, and then stroke the top 1px edge by the specified color.
Create a solid white image having the same size as the original image, and then stroke the top 1px edge by the specified color.


=== _imageScaledToSize:interpolationQuality: & _imageScaledToProportion:interpolationQuality: ===
=== _imageScaledToSize:interpolationQuality: & _imageScaledToProportion:interpolationQuality: ===
{{Function signature|signature=-(UIImage*)_imageScaledToSize:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(UIImage*)_imageScaledToSize:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality;|firmware=2.0 –}}
{{Function signature|signature=-(UIImage*)_imageScaledToProportion:(CGFloat)scale interpolationQuality:(CGInterpolationQuality)quality;|firmware=2.0 – 3.1}}
{{Function signature|signature=-(UIImage*)_imageScaledToProportion:(CGFloat)scale interpolationQuality:(CGInterpolationQuality)quality;|firmware=2.0 –}}


Rescale the image to the new size.
Rescale the image to the new size.


=== +kitImageNamed: ===
=== +kitImageNamed: ===
{{Function signature|signature=+(UIImage*)kitImageNamed:(NSString*)name;|firmware=2.0 – 3.1}}
{{Function signature|signature=+(UIImage*)kitImageNamed:(NSString*)name;|firmware=2.0 –}}


Equivalent to <tt>_UIImageWithName(name)</tt>.
Equivalent to <tt>_UIImageWithName(name)</tt>.


=== +defaultDesktopImage ===
=== +defaultDesktopImage ===
{{Function signature|signature=+(UIImage*)defaultDesktopImage;|firmware=2.0 – 3.1}}
{{Function signature|signature=+(UIImage*)defaultDesktopImage;|firmware=2.0 –}}


Return the user's lock screen image.
Return the user's lock screen image.


=== +setDesktopImageData: ===
=== +setDesktopImageData: ===
{{Function signature|signature=+(void)setDesktopImageData:(NSData*)jpegData;|firmware=2.0 – 3.1}}
{{Function signature|signature=+(void)setDesktopImageData:(NSData*)jpegData;|firmware=2.0 –}}


Replace the user's lock screen image by the given JPEG data.
Replace the user's lock screen image by the given JPEG data.

Revision as of 09:13, 22 November 2009

UIImage is an Objective-C class that represents a bitmap image.

Undocumented methods

-_applicationIconImagePrecomposed: & -_smallApplicationIconImagePrecomposed:

From left to right: The original image; _applicationIconImagePrecomposed:NO; _applicationIconImagePrecomposed:YES; _smallApplicationIconImagePrecomposed:NO; _smallApplicationIconImagePrecomposed:YES
Signature -(UIImage*)_applicationIconImagePrecomposed:(BOOL)precomposed;
Available in 2.0 –
Signature -(UIImage*)_smallApplicationIconImagePrecomposed:(BOOL)precomposed;
Available in 2.0 –

These methods resize an image to icon size (59×59) or small icon size (29×29), clip out a rounded rectangle, draw shadows and apply a glossy overlay if required (when precomposed == NO), so that it resembles an icon.

If the input image is rectangular, the largest square portion in the top-left corner will be used.

_flatImageWithWhite:alpha:

Signature -(UIImage*)_flatImageWithWhite:(CGFloat)white alpha:(CGFloat)alpha;
Available in 2.0 –

Create an image having the same size as the original image, but filled with the solid color as the parameters.

_bezeledImageWithRed:green:blue:alpha:

Signature -(UIImage*) _bezeledImageWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
Available in 2.0 –

Create a solid white image having the same size as the original image, and then stroke the top 1px edge by the specified color.

_imageScaledToSize:interpolationQuality: & _imageScaledToProportion:interpolationQuality:

Signature -(UIImage*)_imageScaledToSize:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality;
Available in 2.0 –
Signature -(UIImage*)_imageScaledToProportion:(CGFloat)scale interpolationQuality:(CGInterpolationQuality)quality;
Available in 2.0 –

Rescale the image to the new size.

+kitImageNamed:

Signature +(UIImage*)kitImageNamed:(NSString*)name;
Available in 2.0 –

Equivalent to _UIImageWithName(name).

+defaultDesktopImage

Signature +(UIImage*)defaultDesktopImage;
Available in 2.0 –

Return the user's lock screen image.

+setDesktopImageData:

Signature +(void)setDesktopImageData:(NSData*)jpegData;
Available in 2.0 –

Replace the user's lock screen image by the given JPEG data.

Undocumented C functions

_UIImageWithName

Signature UIImage* _UIImageWithName(NSString* name);
Available in 2.0 – 3.1

Obtain a built-in image. The name are stored in UIKit.framework/*.artwork. There are various ways to extract this information[1][2][3], and you can grab a (slightly outdated) list from http://test.saurik.com/winterboard/UIImages.txt.

UIImageDataWriteToSavedPhotosAlbum

Signature void UIImageDataWriteToSavedPhotosAlbum(NSData* imageData, id target, SEL selector, void* context);
Available in 3.1

Write the image data to photos album. This is similar to UIImageWriteToSavedPhotosAlbum function in the SDK, except that you can choose the image format (the extension will always be *.jpg, however).

References