summaryrefslogtreecommitdiff
path: root/docs/Classes/SDLArtwork.html
blob: 59655c425cec6c06f5afc2ca372e439f9ab40d6a (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<h1>SDLArtwork Class Reference</h1>

<h3>Section Contents</h3>

<ul>
  <li><a href="#section-isTemplate">isTemplate</a></li>
  <li><a href="#section-+artworkWithImage:name:asImageFormat:">+artworkWithImage:name:asImageFormat:</a></li>
  <li><a href="#section-+artworkWithImage:asImageFormat:">+artworkWithImage:asImageFormat:</a></li>
  <li><a href="#section-+persistentArtworkWithImage:name:asImageFormat:">+persistentArtworkWithImage:name:asImageFormat:</a></li>
  <li><a href="#section-+persistentArtworkWithImage:asImageFormat:">+persistentArtworkWithImage:asImageFormat:</a></li>
  <li><a href="#section--initWithImage:name:persistent:asImageFormat:">-initWithImage:name:persistent:asImageFormat:</a></li>
  <li><a href="#section--initWithImage:persistent:asImageFormat:">-initWithImage:persistent:asImageFormat:</a></li>
</ul>

<h3>Overview</h3>

<p>Undocumented</p>


<section class="section task-group-section">
  <h3 id="section-isTemplate">
      isTemplate
  </h3>
  
  <p>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 <code>UIImage</code>s rendering mode to <code>UIImageRenderingModeAlwaysTemplate</code>. 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.</p>

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

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">assign</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">)</span> <span class="n">BOOL</span> <span class="n">isTemplate</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="k">var</span> <span class="nv">isTemplate</span><span class="p">:</span> <span class="kt">Bool</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

  
  
  
  <h3 id="section-+artworkWithImage:name:asImageFormat:">
      +artworkWithImage:name:asImageFormat:
  </h3>
  
  <p>Convenience helper to create an ephemeral artwork from an image.</p>

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

<p>Persistent files should be created using <code>persistentArtworkWithImage:name:asImageFormat:</code></p>
<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>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. <em>Only pass a UIImage if the image is not stored on disk</em>.</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">artworkWithImage</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">UIImage</span> <span class="o">*</span><span class="p">)</span><span class="nv">image</span>
                                    <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span>
                           <span class="nf">asImageFormat</span><span class="p">:(</span><span class="n"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span><span class="nv">imageFormat</span><span class="p">;</span></code></pre>

  
  
  
  <h4>Parameters</h4>
  <dl>
      <dt>image</dt>
      <dd><p>The UIImage to be sent to the remote head unit</p></dd>
      <dt>name</dt>
      <dd><p>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.</p></dd>
      <dt>imageFormat</dt>
      <dd><p>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.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class to be passed to the file manager.</p>
  </div>
  
  <h3 id="section-+artworkWithImage:asImageFormat:">
      +artworkWithImage:asImageFormat:
  </h3>
  
  <p>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&rsquo;s data which is created by hashing the data using the MD5 algorithm.</p>

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

<p>Persistent files should be created using <code>persistentArtworkWithImage:name:asImageFormat:</code></p>
<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>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. <em>Only pass a UIImage if the image is not stored on disk</em>.</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">artworkWithImage</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">UIImage</span> <span class="o">*</span><span class="p">)</span><span class="nv">image</span>
                           <span class="nf">asImageFormat</span><span class="p">:(</span><span class="n"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span><span class="nv">imageFormat</span><span class="p">;</span></code></pre>

  
  
  
  <h4>Parameters</h4>
  <dl>
      <dt>image</dt>
      <dd><p>The UIImage to be sent to the remote head unit</p></dd>
      <dt>imageFormat</dt>
      <dd><p>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.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class to be passed to the file manager.</p>
  </div>
  
  <h3 id="section-+persistentArtworkWithImage:name:asImageFormat:">
      +persistentArtworkWithImage:name:asImageFormat:
  </h3>
  
  <p>Convenience helper to create a persistent artwork from an image.</p>

<p>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.</p>

<p>Ephemeral files should be created using <code>ephemeralArtworkWithImage:name:asImageFormat:</code></p>
<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>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. <em>Only pass a UIImage if the image is not stored on disk</em>.</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">persistentArtworkWithImage</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">UIImage</span> <span class="o">*</span><span class="p">)</span><span class="nv">image</span>
                                              <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span>
                                     <span class="nf">asImageFormat</span><span class="p">:</span>
                                         <span class="p">(</span><span class="n"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span><span class="nv">imageFormat</span><span class="p">;</span></code></pre>

  
  
  
  <h4>Parameters</h4>
  <dl>
      <dt>image</dt>
      <dd><p>The UIImage to be sent to the remote head unit</p></dd>
      <dt>name</dt>
      <dd><p>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.</p></dd>
      <dt>imageFormat</dt>
      <dd><p>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.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class to be passed to the file manager.</p>
  </div>
  
  <h3 id="section-+persistentArtworkWithImage:asImageFormat:">
      +persistentArtworkWithImage:asImageFormat:
  </h3>
  
  <p>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&rsquo;s data which is created by hashing the data using the MD5 algorithm.</p>

<p>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.</p>

<p>Ephemeral files should be created using <code>ephemeralArtworkWithImage:name:asImageFormat:</code></p>
<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>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. <em>Only pass a UIImage if the image is not stored on disk</em>.</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">persistentArtworkWithImage</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">UIImage</span> <span class="o">*</span><span class="p">)</span><span class="nv">image</span>
                                     <span class="nf">asImageFormat</span><span class="p">:</span>
                                         <span class="p">(</span><span class="n"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span><span class="nv">imageFormat</span><span class="p">;</span></code></pre>

  
  
  
  <h4>Parameters</h4>
  <dl>
      <dt>image</dt>
      <dd><p>The UIImage to be sent to the remote head unit</p></dd>
      <dt>imageFormat</dt>
      <dd><p>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.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class to be passed to the file manager.</p>
  </div>
  
  <h3 id="section--initWithImage:name:persistent:asImageFormat:">
      -initWithImage:name:persistent:asImageFormat:
  </h3>
  
  <p>Create a file for transmission to the remote system from a UIImage.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">initWithImage</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">UIImage</span> <span class="o">*</span><span class="p">)</span><span class="nv">image</span>
                                 <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span>
                           <span class="nf">persistent</span><span class="p">:(</span><span class="n">BOOL</span><span class="p">)</span><span class="nv">persistent</span>
                        <span class="nf">asImageFormat</span><span class="p">:(</span><span class="n"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span><span class="nv">imageFormat</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="nf">init</span><span class="p">(</span><span class="nv">image</span><span class="p">:</span> <span class="kt">UIImage</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">persistent</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">,</span> <span class="k">as</span> <span class="nv">imageFormat</span><span class="p">:</span> <span class="kt"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>image</dt>
      <dd><p>The UIImage to be sent to the remote head unit</p></dd>
      <dt>name</dt>
      <dd><p>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.</p></dd>
      <dt>persistent</dt>
      <dd><p>Whether or not the artwork should be persistent.</p></dd>
      <dt>imageFormat</dt>
      <dd><p>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.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class to be passed to the file manager.</p>
  </div>
  
  <h3 id="section--initWithImage:persistent:asImageFormat:">
      -initWithImage:persistent:asImageFormat:
  </h3>
  
  <p>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&rsquo;s data which is created by hashing the data using the MD5 algorithm.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">initWithImage</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">UIImage</span> <span class="o">*</span><span class="p">)</span><span class="nv">image</span>
                           <span class="nf">persistent</span><span class="p">:(</span><span class="n">BOOL</span><span class="p">)</span><span class="nv">persistent</span>
                        <span class="nf">asImageFormat</span><span class="p">:(</span><span class="n"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span><span class="nv">imageFormat</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="nf">init</span><span class="p">(</span><span class="nv">image</span><span class="p">:</span> <span class="kt">UIImage</span><span class="p">,</span> <span class="nv">persistent</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">,</span> <span class="k">as</span> <span class="nv">imageFormat</span><span class="p">:</span> <span class="kt"><a href="../Enums/SDLArtworkImageFormat.html">SDLArtworkImageFormat</a></span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>image</dt>
      <dd><p>The UIImage to be sent to the remote head unit</p></dd>
      <dt>persistent</dt>
      <dd><p>Whether or not the artwork should be persistent.</p></dd>
      <dt>imageFormat</dt>
      <dd><p>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.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class to be passed to the file manager.</p>
  </div>
  
</section>