Images and PDF

Create and manage images, including those that use bitmap and PDF formats.

Topics

Representations

class UIImage

An object that manages image data in your app.

Image Creation

func UIGraphicsBeginImageContext(CGSize)

Creates a bitmap-based graphics context and makes it the current context.

func UIGraphicsGetImageFromCurrentImageContext()

Returns an image based on the contents of the current bitmap-based graphics context.

func UIGraphicsEndImageContext()

Removes the current bitmap-based graphics context from the top of the stack.

func UIImageJPEGRepresentation(UIImage, CGFloat)

Returns the data for the specified image in JPEG format.

func UIImagePNGRepresentation(UIImage)

Returns the data for the specified image in PNG format

Photo Album

func UIImageWriteToSavedPhotosAlbum(UIImage, Any?, Selector?, UnsafeMutableRawPointer?)

Adds the specified image to the user’s Camera Roll album.

func UISaveVideoAtPathToSavedPhotosAlbum(String, Any?, Selector?, UnsafeMutableRawPointer?)

Adds the movie at the specified path to the user’s Camera Roll album.

func UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(String)

Returns a Boolean value indicating whether the specified video can be saved to user’s Camera Roll album.

PDF Creation

func UIGraphicsBeginPDFContextToData(NSMutableData, CGRect, [AnyHashable : Any]?)

Creates a PDF-based graphics context that targets the specified mutable data object.

func UIGraphicsBeginPDFContextToFile(String, CGRect, [AnyHashable : Any]?)

Creates a PDF-based graphics context that targets a file at the specified path.

func UIGraphicsEndPDFContext()

Closes a PDF graphics context and pops it from the current context stack.

func UIGraphicsBeginPDFPage()

Marks the beginning of a new page in a PDF context and configures it using default values.

func UIGraphicsBeginPDFPageWithInfo(CGRect, [AnyHashable : Any]?)

Marks the beginning of a new page in a PDF context and configures it using the specified values.

func UIGraphicsGetPDFContextBounds()

Returns the current page bounds.

func UIGraphicsAddPDFContextDestinationAtPoint(String, CGPoint)

Creates a jump destination in the current page.

func UIGraphicsSetPDFContextDestinationForRect(String, CGRect)

Links a rectangle on the current page to the specified jump destination.

func UIGraphicsSetPDFContextURLForRect(URL, CGRect)

Links a rectangle on the current page to the specified URL.

See Also

Graphics, Drawing, and Printing

Drawing

Configure your app's drawing environment using renderers, and draw paths, strings, and shadows.

Printing

Display the system print panels and manage the printing process.