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.

class UIImage.SymbolConfiguration

An object containing the specific font, size, style, and weight attributes to apply to a symbol image.

class UIImage.Configuration

A configuration object containing the traits that the system used when selecting the current image variant.

Image Creation

func UIGraphicsBeginImageContext(CGSize)

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

func UIGraphicsGetImageFromCurrentImageContext() -> UIImage?

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 jpegData(compressionQuality: CGFloat) -> Data?

Returns a data object containing the specified image in JPEG format.

func pngData() -> Data?

Returns a data object containing 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) -> Bool

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]?) -> Bool

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() -> CGRect

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.

PDF Screenshots

class UIScreenshotService

An object that coordinates the creation of PDF screenshots of your window's content.

See Also

Graphics, Drawing, and Printing

Drawing

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

Printing

Display the system print panels and manage the printing process.