Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Documentation
Sidebar

SDLArtwork Class Reference

Section Contents

Overview

Undocumented

isTemplate

Describes whether or not the image is a template that can be (re)colored by the SDL HMI. To make the artwork a template, set the UIImages rendering mode to UIImageRenderingModeAlwaysTemplate. In order for templates to work successfully, the icon must be one solid color with a clear background. The artwork should be created using the PNG image format.

@discussion An image should be templated if it is intended to be used as an icon in a button or menu.

Objective-C

@property (readonly, assign, nonatomic) BOOL isTemplate;

Swift

var isTemplate: Bool { get }

+artworkWithImage:name:asImageFormat:

Convenience helper to create an ephemeral artwork from an image.

This is an ephemeral file, it will not be persisted through sessions / ignition cycles. Any files that you do not know you will use in future sessions should be created through this method. For example, album / artist artwork should be ephemeral.

Persistent files should be created using persistentArtworkWithImage:name:asImageFormat:

Warning

It is strongly recommended to pass the file url using an SDLFile initializer instead of the image. If you pass the UIImage, it is loaded into memory, and will be dumped to a temporary file. This will create a duplicate file. Only pass a UIImage if the image is not stored on disk.

Objective-C

+ (nonnull instancetype)artworkWithImage:(nonnull UIImage *)image
                                    name:(nonnull NSString *)name
                           asImageFormat:(SDLArtworkImageFormat)imageFormat;

Parameters

image

The UIImage to be sent to the remote head unit

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote file system limitations.

imageFormat

Whether the image should be converted to a PNG or JPG before transmission. Images with transparency or few colors should be PNGs. Images with many colors should be JPGs.

Return Value

An instance of this class to be passed to the file manager.

+artworkWithImage:asImageFormat:

Convenience helper to create an ephemeral artwork from an image. A unique name will be assigned to the image. This name is a string representation of the image’s data which is created by hashing the data using the MD5 algorithm.

This is an ephemeral file, it will not be persisted through sessions / ignition cycles. Any files that you do not know you will use in future sessions should be created through this method. For example, album / artist artwork should be ephemeral.

Persistent files should be created using persistentArtworkWithImage:name:asImageFormat:

Warning

It is strongly recommended to pass the file url using an SDLFile initializer instead of the image. If you pass the UIImage, it is loaded into memory, and will be dumped to a temporary file. This will create a duplicate file. Only pass a UIImage if the image is not stored on disk.

Objective-C

+ (nonnull instancetype)artworkWithImage:(nonnull UIImage *)image
                           asImageFormat:(SDLArtworkImageFormat)imageFormat;

Parameters

image

The UIImage to be sent to the remote head unit

imageFormat

Whether the image should be converted to a PNG or JPG before transmission. Images with transparency or few colors should be PNGs. Images with many colors should be JPGs.

Return Value

An instance of this class to be passed to the file manager.

+persistentArtworkWithImage:name:asImageFormat:

Convenience helper to create a persistent artwork from an image.

This is a persistent file, it will be persisted through sessions / ignition cycles. You will only have a limited space for all files, so be sure to only persist files that are required for all or most sessions. For example, menu artwork should be persistent.

Ephemeral files should be created using ephemeralArtworkWithImage:name:asImageFormat:

Warning

It is strongly recommended to pass the file url using an SDLFile initializer instead of the image. If you pass the UIImage, it is loaded into memory, and will be dumped to a temporary file. This will create a duplicate file. Only pass a UIImage if the image is not stored on disk.

Objective-C

+ (nonnull instancetype)persistentArtworkWithImage:(nonnull UIImage *)image
                                              name:(nonnull NSString *)name
                                     asImageFormat:
                                         (SDLArtworkImageFormat)imageFormat;

Parameters

image

The UIImage to be sent to the remote head unit

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote file system limitations.

imageFormat

Whether the image should be converted to a PNG or JPG before transmission. Images with transparency or few colors should be PNGs. Images with many colors should be JPGs.

Return Value

An instance of this class to be passed to the file manager.

+persistentArtworkWithImage:asImageFormat:

Convenience helper to create a persistent artwork from an image. A unique name will be assigned to the image. This name is a string representation of the image’s data which is created by hashing the data using the MD5 algorithm.

This is a persistent file, it will be persisted through sessions / ignition cycles. You will only have a limited space for all files, so be sure to only persist files that are required for all or most sessions. For example, menu artwork should be persistent.

Ephemeral files should be created using ephemeralArtworkWithImage:name:asImageFormat:

Warning

It is strongly recommended to pass the file url using an SDLFile initializer instead of the image. If you pass the UIImage, it is loaded into memory, and will be dumped to a temporary file. This will create a duplicate file. Only pass a UIImage if the image is not stored on disk.

Objective-C

+ (nonnull instancetype)persistentArtworkWithImage:(nonnull UIImage *)image
                                     asImageFormat:
                                         (SDLArtworkImageFormat)imageFormat;

Parameters

image

The UIImage to be sent to the remote head unit

imageFormat

Whether the image should be converted to a PNG or JPG before transmission. Images with transparency or few colors should be PNGs. Images with many colors should be JPGs.

Return Value

An instance of this class to be passed to the file manager.

-initWithImage:name:persistent:asImageFormat:

Create a file for transmission to the remote system from a UIImage.

Objective-C

- (nonnull instancetype)initWithImage:(nonnull UIImage *)image
                                 name:(nonnull NSString *)name
                           persistent:(BOOL)persistent
                        asImageFormat:(SDLArtworkImageFormat)imageFormat;

Swift

init(image: UIImage, name: String, persistent: Bool, as imageFormat: SDLArtworkImageFormat)

Parameters

image

The UIImage to be sent to the remote head unit

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote file system limitations.

persistent

Whether or not the artwork should be persistent.

imageFormat

Whether the image should be converted to a PNG or JPG before transmission. Images with transparency or few colors should be PNGs. Images with many colors should be JPGs.

Return Value

An instance of this class to be passed to the file manager.

-initWithImage:persistent:asImageFormat:

Create a file for transmission to the remote system from a UIImage. A unique name will be assigned to the image. This name is a string representation of the image’s data which is created by hashing the data using the MD5 algorithm.

Objective-C

- (nonnull instancetype)initWithImage:(nonnull UIImage *)image
                           persistent:(BOOL)persistent
                        asImageFormat:(SDLArtworkImageFormat)imageFormat;

Swift

init(image: UIImage, persistent: Bool, as imageFormat: SDLArtworkImageFormat)

Parameters

image

The UIImage to be sent to the remote head unit

persistent

Whether or not the artwork should be persistent.

imageFormat

Whether the image should be converted to a PNG or JPG before transmission. Images with transparency or few colors should be PNGs. Images with many colors should be JPGs.

Return Value

An instance of this class to be passed to the file manager.

View on GitHub.com
Previous Section Next Section