summaryrefslogtreecommitdiff
path: root/docs/Classes/SDLArtwork.html
blob: b7e0fbb40c0a94523d33e88583fc004d92e8b6f4 (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
<h1>SDLArtwork Class Reference</h1>

<h3>Section Contents</h3>

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

<h3>Overview</h3>

<p>Undocumented</p>


<section class="section task-group-section">
  <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"><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-+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"><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--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"><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"><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>
  
</section>