blob: 45c9f9702d06ae7ac62f196ec0d9f875204d9c49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
//
// SDLArtwork.h
// SmartDeviceLink-iOS
//
// Created by Joel Fischer on 10/15/15.
// Copyright © 2015 smartdevicelink. All rights reserved.
//
@import UIKit;
#import "SDLFile.h"
typedef NS_ENUM(NSUInteger, SDLArtworkImageFormat) {
SDLArtworkImageFormatPNG,
SDLArtworkImageFormatJPG
};
NS_ASSUME_NONNULL_BEGIN
@interface SDLArtwork : SDLFile
/**
* 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*.
*
* @param image The UIImage to be sent to the remote head unit
* @param name The name of the file that will be used to reference the file in the future (for example on the remote file system).
* @param 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 An instance of this class to be passed to the file manager.
*/
+ (instancetype)ephemeralArtworkWithImage:(UIImage *)image name:(NSString *)name asImageFormat:(SDLArtworkImageFormat)imageFormat;
/**
* 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*.
*
* @param image The UIImage to be sent to the remote head unit
* @param name The name of the file that will be used to reference the file in the future (for example on the remote file system).
* @param 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 An instance of this class to be passed to the file manager.
*/
+ (instancetype)persistentArtworkWithImage:(UIImage *)image name:(NSString *)name asImageFormat:(SDLArtworkImageFormat)imageFormat;
/**
* Create a file for transmission to the remote system from a UIImage.
*
* @param image The UIImage to be sent to the remote head unit
* @param name The name of the file that will be used to reference the file in the future (for example on the remote file system).
* @param persistent Whether or not the artwork should be persistent.
* @param 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 An instance of this class to be passed to the file manager.
*/
- (instancetype)initWithImage:(UIImage *)image name:(NSString *)name persistent:(BOOL)persistent asImageFormat:(SDLArtworkImageFormat)imageFormat NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END
|