1SkPicture Reference 2=== 3 4 5<a name='SkPicture'></a> 6 7--- 8 9<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 10class <a href='SkPicture_Reference#SkPicture'>SkPicture</a> : public <a href='undocumented#SkRefCnt'>SkRefCnt</a> { 11 12 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakeFromStream'>MakeFromStream</a>(<a href='SkStream_Reference#SkStream'>SkStream</a>* <a href='SkStream_Reference#Stream'>stream</a>, 13 const <a href='undocumented#SkDeserialProcs'>SkDeserialProcs</a>* procs = nullptr); 14 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakeFromData'>MakeFromData</a>(const <a href='undocumented#SkData'>SkData</a>* <a href='undocumented#Data'>data</a>, 15 const <a href='undocumented#SkDeserialProcs'>SkDeserialProcs</a>* procs = nullptr); 16 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakeFromData'>MakeFromData</a>(const void* <a href='undocumented#Data'>data</a>, size_t <a href='undocumented#Size'>size</a>, 17 const <a href='undocumented#SkDeserialProcs'>SkDeserialProcs</a>* procs = nullptr); 18 virtual void <a href='#SkPicture_playback'>playback</a>(<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>* <a href='SkCanvas_Reference#Canvas'>canvas</a>, <a href='#SkPicture_AbortCallback'>AbortCallback</a>* callback = nullptr) const = 0; 19 virtual <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkPicture_cullRect'>cullRect</a>() const = 0; 20 uint32_t <a href='#SkPicture_uniqueID'>uniqueID</a>() const; 21 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkPicture_serialize'>serialize</a>(const <a href='undocumented#SkSerialProcs'>SkSerialProcs</a>* procs = nullptr) const; 22 void <a href='#SkPicture_serialize'>serialize</a>(<a href='SkWStream_Reference#SkWStream'>SkWStream</a>* <a href='SkStream_Reference#Stream'>stream</a>, const <a href='undocumented#SkSerialProcs'>SkSerialProcs</a>* procs = nullptr) const; 23 static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakePlaceholder'>MakePlaceholder</a>(<a href='SkRect_Reference#SkRect'>SkRect</a> cull); 24 virtual int <a href='#SkPicture_approximateOpCount'>approximateOpCount</a>() const = 0; 25 virtual size_t <a href='#SkPicture_approximateBytesUsed'>approximateBytesUsed</a>() const = 0; 26}; 27 28</pre> 29 30<a href='SkPicture_Reference#Picture'>Picture</a> records drawing commands made to <a href='SkCanvas_Reference#Canvas'>Canvas</a>. The command <a href='SkStream_Reference#Stream'>stream</a> may be 31played in whole or in part at a later time. 32 33<a href='SkPicture_Reference#Picture'>Picture</a> is an abstract class. <a href='SkPicture_Reference#Picture'>Picture</a> may be generated by <a href='#Picture_Recorder'>Picture_Recorder</a> 34or <a href='undocumented#Drawable'>Drawable</a>, or from <a href='SkPicture_Reference#Picture'>Picture</a> previously saved to <a href='undocumented#Data'>Data</a> or <a href='SkStream_Reference#Stream'>Stream</a>. 35 36<a href='SkPicture_Reference#Picture'>Picture</a> may contain any <a href='SkCanvas_Reference#Canvas'>Canvas</a> drawing command, as well as one or more 37<a href='#Canvas_Matrix'>Canvas_Matrix</a> or <a href='#Canvas_Clip'>Canvas_Clip</a>. <a href='SkPicture_Reference#Picture'>Picture</a> has a cull <a href='SkRect_Reference#Rect'>Rect</a>, which is used as 38a bounding box hint. To limit <a href='SkPicture_Reference#Picture'>Picture</a> bounds, use <a href='#Canvas_Clip'>Canvas_Clip</a> when 39recording or drawing <a href='SkPicture_Reference#Picture'>Picture</a>. 40 41<a name='SkPicture_AbortCallback'></a> 42 43--- 44 45<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 46 class <a href='#SkPicture_AbortCallback'>AbortCallback</a> { 47 public: 48 <a href='#SkPicture_AbortCallback_AbortCallback'>AbortCallback()</a> {} 49 virtual <a href='#SkPicture_AbortCallback_destructor'>~AbortCallback()</a> {} 50 virtual bool <a href='#SkPicture_AbortCallback_abort'>abort()</a> = 0; 51 }; 52</pre> 53 54<a href='#SkPicture_AbortCallback'>AbortCallback</a> is an abstract class. An implementation of <a href='#SkPicture_AbortCallback'>AbortCallback</a> may 55passed as a parameter to <a href='SkPicture_Reference#SkPicture'>SkPicture</a>::<a href='#SkPicture_playback'>playback</a>, to stop it before all drawing 56commands have been processed. 57 58If <a href='#SkPicture_AbortCallback'>AbortCallback</a>::<a href='#SkPicture_AbortCallback_abort'>abort</a> returns true, <a href='SkPicture_Reference#SkPicture'>SkPicture</a>::<a href='#SkPicture_playback'>playback</a> is interrupted. 59 60<a name='SkPicture_AbortCallback_AbortCallback'></a> 61 62--- 63 64<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 65<a href='#SkPicture_AbortCallback_AbortCallback'>AbortCallback()</a> 66</pre> 67 68Has no effect. 69 70### Return Value 71 72abstract class cannot be instantiated 73 74### See Also 75 76<a href='#SkPicture_playback'>playback</a> 77 78<a name='SkPicture_AbortCallback_destructor'></a> 79 80--- 81 82<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 83virtual <a href='#SkPicture_AbortCallback_destructor'>~AbortCallback()</a> 84</pre> 85 86Has no effect. 87 88### See Also 89 90<a href='#SkPicture_playback'>playback</a> 91 92<a name='SkPicture_AbortCallback_abort'></a> 93 94--- 95 96<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 97virtual bool <a href='#SkPicture_AbortCallback_abort'>abort()</a> = 0 98</pre> 99 100Stops <a href='SkPicture_Reference#SkPicture'>SkPicture</a> playback when some condition is met. A subclass of 101<a href='#SkPicture_AbortCallback'>AbortCallback</a> provides an override for <a href='#SkPicture_AbortCallback_abort'>abort()</a> that can stop <a href='SkPicture_Reference#SkPicture'>SkPicture</a>::<a href='#SkPicture_playback'>playback</a>. 102 103The part of <a href='SkPicture_Reference#SkPicture'>SkPicture</a> drawn when aborted is undefined. <a href='SkPicture_Reference#SkPicture'>SkPicture</a> instantiations are 104free to stop drawing at different <a href='SkPoint_Reference#Point'>points</a> during playback. 105 106If the abort happens inside one or more calls to <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_save'>save()</a>, stack 107of <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> <a href='SkMatrix_Reference#Matrix'>matrix</a> and <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> clip values is restored to its state before 108<a href='SkPicture_Reference#SkPicture'>SkPicture</a>::<a href='#SkPicture_playback'>playback</a> was called. 109 110### Return Value 111 112true to stop playback 113 114### See Also 115 116<a href='#SkPicture_playback'>playback</a> 117 118### Example 119 120<div><fiddle-embed name="56ed920dadbf2b2967ac45fb5a9bded6"><div>JustOneDraw allows the black rectangle to draw but stops playback before the 121white rectangle appears. 122</div></fiddle-embed></div> 123 124<a name='SkPicture_MakeFromStream'></a> 125 126--- 127 128<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 129static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakeFromStream'>MakeFromStream</a>(<a href='SkStream_Reference#SkStream'>SkStream</a>* <a href='SkStream_Reference#Stream'>stream</a>, const <a href='undocumented#SkDeserialProcs'>SkDeserialProcs</a>* procs = nullptr) 130</pre> 131 132Recreates <a href='SkPicture_Reference#SkPicture'>SkPicture</a> that was serialized into a <a href='#SkPicture_MakeFromStream_stream'>stream</a>. Returns constructed <a href='SkPicture_Reference#SkPicture'>SkPicture</a> 133if successful; otherwise, returns nullptr. Fails if <a href='undocumented#Data'>data</a> does not permit 134constructing valid <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. 135 136<a href='#SkPicture_MakeFromStream_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a> permits supplying a custom function to decode <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. 137If <a href='#SkPicture_MakeFromStream_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a> is nullptr, default decoding is used. <a href='#SkPicture_MakeFromStream_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureCtx'>fPictureCtx</a> 138may be used to provide user context to <a href='#SkPicture_MakeFromStream_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a>; <a href='#SkPicture_MakeFromStream_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a> 139is called with a pointer to <a href='undocumented#Data'>data</a>, <a href='undocumented#Data'>data</a> byte length, and user context. 140 141### Parameters 142 143<table> <tr> <td><a name='SkPicture_MakeFromStream_stream'><code><strong>stream</strong></code></a></td> 144 <td>container for serial <a href='undocumented#Data'>data</a></td> 145 </tr> 146 <tr> <td><a name='SkPicture_MakeFromStream_procs'><code><strong>procs</strong></code></a></td> 147 <td>custom serial <a href='undocumented#Data'>data</a> decoders; may be nullptr</td> 148 </tr> 149</table> 150 151### Return Value 152 153<a href='SkPicture_Reference#SkPicture'>SkPicture</a> constructed from <a href='#SkPicture_MakeFromStream_stream'>stream</a> <a href='undocumented#Data'>data</a> 154 155### Example 156 157<div><fiddle-embed name="404fb42560a289c2004cad1caf3b96de"></fiddle-embed></div> 158 159### See Also 160 161<a href='#SkPicture_MakeFromData'>MakeFromData</a> <a href='undocumented#SkPictureRecorder'>SkPictureRecorder</a> 162 163<a name='SkPicture_MakeFromData'></a> 164 165--- 166 167<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 168static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakeFromData'>MakeFromData</a>(const <a href='undocumented#SkData'>SkData</a>* <a href='undocumented#Data'>data</a>, const <a href='undocumented#SkDeserialProcs'>SkDeserialProcs</a>* procs = nullptr) 169</pre> 170 171Recreates <a href='SkPicture_Reference#SkPicture'>SkPicture</a> that was serialized into <a href='#SkPicture_MakeFromData_data'>data</a>. Returns constructed <a href='SkPicture_Reference#SkPicture'>SkPicture</a> 172if successful; otherwise, returns nullptr. Fails if <a href='#SkPicture_MakeFromData_data'>data</a> does not permit 173constructing valid <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. 174 175<a href='#SkPicture_MakeFromData_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a> permits supplying a custom function to decode <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. 176If <a href='#SkPicture_MakeFromData_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a> is nullptr, default decoding is used. <a href='#SkPicture_MakeFromData_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureCtx'>fPictureCtx</a> 177may be used to provide user context to <a href='#SkPicture_MakeFromData_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a>; <a href='#SkPicture_MakeFromData_procs'>procs</a>-><a href='#SkDeserialProcs_fPictureProc'>fPictureProc</a> 178is called with a pointer to <a href='#SkPicture_MakeFromData_data'>data</a>, <a href='#SkPicture_MakeFromData_data'>data</a> byte length, and user context. 179 180### Parameters 181 182<table> <tr> <td><a name='SkPicture_MakeFromData_data'><code><strong>data</strong></code></a></td> 183 <td>container for serial <a href='#SkPicture_MakeFromData_data'>data</a></td> 184 </tr> 185 <tr> <td><a name='SkPicture_MakeFromData_procs'><code><strong>procs</strong></code></a></td> 186 <td>custom serial <a href='#SkPicture_MakeFromData_data'>data</a> decoders; may be nullptr</td> 187 </tr> 188</table> 189 190### Return Value 191 192<a href='SkPicture_Reference#SkPicture'>SkPicture</a> constructed from <a href='#SkPicture_MakeFromData_data'>data</a> 193 194### Example 195 196<div><fiddle-embed name="58b44bf47d8816782066618700afdecb"></fiddle-embed></div> 197 198### See Also 199 200<a href='#SkPicture_MakeFromStream'>MakeFromStream</a> <a href='undocumented#SkPictureRecorder'>SkPictureRecorder</a> 201 202<a name='SkPicture_MakeFromData_2'></a> 203 204--- 205 206<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 207static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakeFromData'>MakeFromData</a>(const void* <a href='undocumented#Data'>data</a>, size_t <a href='undocumented#Size'>size</a>, 208 const <a href='undocumented#SkDeserialProcs'>SkDeserialProcs</a>* procs = nullptr) 209</pre> 210 211### Parameters 212 213<table> <tr> <td><a name='SkPicture_MakeFromData_2_data'><code><strong>data</strong></code></a></td> 214 <td>pointer to serial <a href='#SkPicture_MakeFromData_2_data'>data</a></td> 215 </tr> 216 <tr> <td><a name='SkPicture_MakeFromData_2_size'><code><strong>size</strong></code></a></td> 217 <td><a href='#SkPicture_MakeFromData_2_size'>size</a> of <a href='#SkPicture_MakeFromData_2_data'>data</a></td> 218 </tr> 219 <tr> <td><a name='SkPicture_MakeFromData_2_procs'><code><strong>procs</strong></code></a></td> 220 <td>custom serial <a href='#SkPicture_MakeFromData_2_data'>data</a> decoders; may be nullptr</td> 221 </tr> 222</table> 223 224### Return Value 225 226<a href='SkPicture_Reference#SkPicture'>SkPicture</a> constructed from <a href='#SkPicture_MakeFromData_2_data'>data</a> 227 228### Example 229 230<div><fiddle-embed name="30b9f1b310187db6aff720a5d67591e2"></fiddle-embed></div> 231 232### See Also 233 234<a href='#SkPicture_MakeFromStream'>MakeFromStream</a> <a href='undocumented#SkPictureRecorder'>SkPictureRecorder</a> 235 236<a name='SkPicture_playback'></a> 237 238--- 239 240<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 241virtual void playback(<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>* <a href='SkCanvas_Reference#Canvas'>canvas</a>, <a href='#SkPicture_AbortCallback'>AbortCallback</a>* callback = nullptr) const = 0 242</pre> 243 244Replays the drawing commands on the specified <a href='#SkPicture_playback_canvas'>canvas</a>. In the case that the 245commands are recorded, each command in the <a href='SkPicture_Reference#SkPicture'>SkPicture</a> is sent separately to <a href='#SkPicture_playback_canvas'>canvas</a>. 246 247To add a single command to draw <a href='SkPicture_Reference#SkPicture'>SkPicture</a> to recording <a href='#SkPicture_playback_canvas'>canvas</a>, call 248<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawPicture'>drawPicture</a> instead. 249 250### Parameters 251 252<table> <tr> <td><a name='SkPicture_playback_canvas'><code><strong>canvas</strong></code></a></td> 253 <td>receiver of drawing commands</td> 254 </tr> 255 <tr> <td><a name='SkPicture_playback_callback'><code><strong>callback</strong></code></a></td> 256 <td>allows interruption of playback</td> 257 </tr> 258</table> 259 260### Example 261 262<div><fiddle-embed name="6b0ffb03ba05f526b345dc65a1c73fe4"></fiddle-embed></div> 263 264### See Also 265 266<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawPicture'>drawPicture</a> 267 268<a name='SkPicture_cullRect'></a> 269 270--- 271 272<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 273virtual <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkPicture_cullRect'>cullRect</a>() const = 0 274</pre> 275 276Returns cull <a href='SkRect_Reference#SkRect'>SkRect</a> for this <a href='SkPicture_Reference#Picture'>picture</a>, passed in when <a href='SkPicture_Reference#SkPicture'>SkPicture</a> was created. 277Returned <a href='SkRect_Reference#SkRect'>SkRect</a> does not specify clipping <a href='SkRect_Reference#SkRect'>SkRect</a> for <a href='SkPicture_Reference#SkPicture'>SkPicture</a>; cull is hint 278of <a href='SkPicture_Reference#SkPicture'>SkPicture</a> bounds. 279 280<a href='SkPicture_Reference#SkPicture'>SkPicture</a> is free to discard recorded drawing commands that fall outside 281cull. 282 283### Return Value 284 285bounds passed when <a href='SkPicture_Reference#SkPicture'>SkPicture</a> was created 286 287### Example 288 289<div><fiddle-embed name="15bb9a9596b40c5e2045f76e8c1dcf8e"><div><a href='SkPicture_Reference#Picture'>Picture</a> recorded bounds are smaller than contents; contents outside recorded 290bounds may be drawn, and are drawn in this example. 291</div></fiddle-embed></div> 292 293### See Also 294 295<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_clipRect'>clipRect</a> 296 297<a name='SkPicture_uniqueID'></a> 298 299--- 300 301<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 302uint32_t <a href='#SkPicture_uniqueID'>uniqueID</a>()const 303</pre> 304 305Returns a non-zero value unique among <a href='SkPicture_Reference#SkPicture'>SkPicture</a> in Skia process. 306 307### Return Value 308 309identifier for <a href='SkPicture_Reference#SkPicture'>SkPicture</a> 310 311### Example 312 313<div><fiddle-embed name="8e4257245c988c600410fe4fd7293f07"> 314 315#### Example Output 316 317~~~~ 318empty picture id = 1 319placeholder id = 2 320~~~~ 321 322</fiddle-embed></div> 323 324### See Also 325 326<a href='undocumented#SkRefCnt'>SkRefCnt</a> 327 328<a name='SkPicture_serialize'></a> 329 330--- 331 332<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 333<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkData'>SkData</a>> <a href='#SkPicture_serialize'>serialize</a>(const <a href='undocumented#SkSerialProcs'>SkSerialProcs</a>* procs = nullptr)const 334</pre> 335 336Returns storage containing <a href='undocumented#SkData'>SkData</a> describing <a href='SkPicture_Reference#SkPicture'>SkPicture</a>, using optional custom 337encoders. 338 339<a href='#SkPicture_serialize_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a> permits supplying a custom function to encode <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. 340If <a href='#SkPicture_serialize_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a> is nullptr, default encoding is used. <a href='#SkPicture_serialize_procs'>procs</a>-><a href='#SkSerialProcs_fPictureCtx'>fPictureCtx</a> 341may be used to provide user context to <a href='#SkPicture_serialize_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a>; <a href='#SkPicture_serialize_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a> 342is called with a pointer to <a href='SkPicture_Reference#SkPicture'>SkPicture</a> and user context. 343 344### Parameters 345 346<table> <tr> <td><a name='SkPicture_serialize_procs'><code><strong>procs</strong></code></a></td> 347 <td>custom serial <a href='undocumented#Data'>data</a> encoders; may be nullptr</td> 348 </tr> 349</table> 350 351### Return Value 352 353storage containing serialized <a href='SkPicture_Reference#SkPicture'>SkPicture</a> 354 355### Example 356 357<div><fiddle-embed name="dacdebe1355c884ebd3c2ea038cc7a20"></fiddle-embed></div> 358 359### See Also 360 361<a href='#SkPicture_MakeFromData'>MakeFromData</a> <a href='undocumented#SkData'>SkData</a> <a href='undocumented#SkSerialProcs'>SkSerialProcs</a> 362 363<a name='SkPicture_serialize_2'></a> 364 365--- 366 367<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 368void <a href='#SkPicture_serialize'>serialize</a>(<a href='SkWStream_Reference#SkWStream'>SkWStream</a>* <a href='SkStream_Reference#Stream'>stream</a>, const <a href='undocumented#SkSerialProcs'>SkSerialProcs</a>* procs = nullptr)const 369</pre> 370 371Writes <a href='SkPicture_Reference#Picture'>picture</a> to <a href='#SkPicture_serialize_2_stream'>stream</a>, using optional custom encoders. 372 373<a href='#SkPicture_serialize_2_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a> permits supplying a custom function to encode <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. 374If <a href='#SkPicture_serialize_2_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a> is nullptr, default encoding is used. <a href='#SkPicture_serialize_2_procs'>procs</a>-><a href='#SkSerialProcs_fPictureCtx'>fPictureCtx</a> 375may be used to provide user context to <a href='#SkPicture_serialize_2_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a>; <a href='#SkPicture_serialize_2_procs'>procs</a>-><a href='#SkSerialProcs_fPictureProc'>fPictureProc</a> 376is called with a pointer to <a href='SkPicture_Reference#SkPicture'>SkPicture</a> and user context. 377 378### Parameters 379 380<table> <tr> <td><a name='SkPicture_serialize_2_stream'><code><strong>stream</strong></code></a></td> 381 <td>writable serial <a href='undocumented#Data'>data</a> <a href='#SkPicture_serialize_2_stream'>stream</a></td> 382 </tr> 383 <tr> <td><a name='SkPicture_serialize_2_procs'><code><strong>procs</strong></code></a></td> 384 <td>custom serial <a href='undocumented#Data'>data</a> encoders; may be nullptr</td> 385 </tr> 386</table> 387 388### Example 389 390<div><fiddle-embed name="30b9f1b310187db6aff720a5d67591e2"></fiddle-embed></div> 391 392### See Also 393 394<a href='#SkPicture_MakeFromStream'>MakeFromStream</a> <a href='SkWStream_Reference#SkWStream'>SkWStream</a> <a href='undocumented#SkSerialProcs'>SkSerialProcs</a> 395 396<a name='SkPicture_MakePlaceholder'></a> 397 398--- 399 400<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 401static <a href='undocumented#sk_sp'>sk_sp</a><<a href='SkPicture_Reference#SkPicture'>SkPicture</a>> <a href='#SkPicture_MakePlaceholder'>MakePlaceholder</a>(<a href='SkRect_Reference#SkRect'>SkRect</a> cull) 402</pre> 403 404Returns a placeholder <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. Result does not draw, and contains only 405<a href='#SkPicture_MakePlaceholder_cull'>cull</a> <a href='SkRect_Reference#SkRect'>SkRect</a>, a hint of its bounds. Result is immutable; it cannot be changed 406later. Result identifier is unique. 407 408Returned placeholder can be intercepted during playback to insert other 409commands into <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> draw <a href='SkStream_Reference#Stream'>stream</a>. 410 411### Parameters 412 413<table> <tr> <td><a name='SkPicture_MakePlaceholder_cull'><code><strong>cull</strong></code></a></td> 414 <td>placeholder dimensions</td> 415 </tr> 416</table> 417 418### Return Value 419 420placeholder with unique identifier 421 422### Example 423 424<div><fiddle-embed name="0d2cbf82f490ffb180e0b4531afa232c"></fiddle-embed></div> 425 426### See Also 427 428<a href='#SkPicture_MakeFromStream'>MakeFromStream</a> <a href='#SkPicture_MakeFromData'>MakeFromData</a> <a href='#SkPicture_uniqueID'>uniqueID</a> 429 430<a name='SkPicture_approximateOpCount'></a> 431 432--- 433 434<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 435virtual int <a href='#SkPicture_approximateOpCount'>approximateOpCount</a>() const = 0 436</pre> 437 438Returns the approximate number of operations in <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. Returned value 439may be greater or less than the number of <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a> calls 440recorded: some calls may be recorded as more than one operation, other 441calls may be optimized away. 442 443### Return Value 444 445approximate operation count 446 447### Example 448 449<div><fiddle-embed name="4b3d879118ef770d1f11a23c6493b2c4"></fiddle-embed></div> 450 451### See Also 452 453<a href='#SkPicture_approximateBytesUsed'>approximateBytesUsed</a> 454 455<a name='SkPicture_approximateBytesUsed'></a> 456 457--- 458 459<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 460virtual size_t <a href='#SkPicture_approximateBytesUsed'>approximateBytesUsed</a>() const = 0 461</pre> 462 463Returns the approximate byte <a href='undocumented#Size'>size</a> of <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. Does not include large objects 464referenced by <a href='SkPicture_Reference#SkPicture'>SkPicture</a>. 465 466### Return Value 467 468approximate <a href='undocumented#Size'>size</a> 469 470### Example 471 472<div><fiddle-embed name="ececbda21218bd732394a305dba393a2"></fiddle-embed></div> 473 474### See Also 475 476<a href='#SkPicture_approximateOpCount'>approximateOpCount</a> 477 478