blob: 1b4fb99edc3efcbe4a3224389ab29cc750756398 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Skia: include/core/SkPicture.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<h1>include/core/SkPicture.h</h1><a href="_sk_picture_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2007 The Android Open Source Project</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
<a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
<a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef SkPicture_DEFINED</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define SkPicture_DEFINED</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="_sk_ref_cnt_8h.html">SkRefCnt.h</a>&quot;</span>
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="keyword">class </span><a class="code" href="class_sk_canvas.html">SkCanvas</a>;
<a name="l00023"></a>00023 <span class="keyword">class </span>SkPicturePlayback;
<a name="l00024"></a>00024 <span class="keyword">class </span>SkPictureRecord;
<a name="l00025"></a>00025 <span class="keyword">class </span><a class="code" href="class_sk_stream.html">SkStream</a>;
<a name="l00026"></a>00026 <span class="keyword">class </span><a class="code" href="class_sk_w_stream.html">SkWStream</a>;
<a name="l00027"></a>00027
<a name="l00033"></a><a class="code" href="class_sk_picture.html">00033</a> <span class="keyword">class </span><a class="code" href="class_sk_picture.html">SkPicture</a> : <span class="keyword">public</span> <a class="code" href="class_sk_ref_cnt.html">SkRefCnt</a> {
<a name="l00034"></a>00034 <span class="keyword">public</span>:
<a name="l00039"></a>00039 <a class="code" href="class_sk_picture.html#add64d7f6f686afc895b73347fccb8380">SkPicture</a>();
<a name="l00043"></a>00043 <a class="code" href="class_sk_picture.html#add64d7f6f686afc895b73347fccb8380">SkPicture</a>(<span class="keyword">const</span> <a class="code" href="class_sk_picture.html">SkPicture</a>&amp; src);
<a name="l00044"></a>00044 <span class="keyword">explicit</span> <a class="code" href="class_sk_picture.html#add64d7f6f686afc895b73347fccb8380">SkPicture</a>(<a class="code" href="class_sk_stream.html">SkStream</a>*);
<a name="l00045"></a>00045 <span class="keyword">virtual</span> <a class="code" href="class_sk_picture.html#aa700bebc1dbfd7c216dc4a39aceae170">~SkPicture</a>();
<a name="l00046"></a>00046
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="class_sk_picture.html#a6e55dc7649f661d384f080debd26a0d0">swap</a>(<a class="code" href="class_sk_picture.html">SkPicture</a>&amp; other);
<a name="l00051"></a>00051
<a name="l00052"></a><a class="code" href="class_sk_picture.html#a5af5c62450a2a893a2e08cb08c8d6a60">00052</a> <span class="keyword">enum</span> <a class="code" href="class_sk_picture.html#a5af5c62450a2a893a2e08cb08c8d6a60">RecordingFlags</a> {
<a name="l00053"></a>00053 <span class="comment">/* This flag specifies that when clipPath() is called, the path will</span>
<a name="l00054"></a>00054 <span class="comment"> be faithfully recorded, but the recording canvas&apos; current clip will</span>
<a name="l00055"></a>00055 <span class="comment"> only see the path&apos;s bounds. This speeds up the recording process</span>
<a name="l00056"></a>00056 <span class="comment"> without compromising the fidelity of the playback. The only side-</span>
<a name="l00057"></a>00057 <span class="comment"> effect for recording is that calling getTotalClip() or related</span>
<a name="l00058"></a>00058 <span class="comment"> clip-query calls will reflect the path&apos;s bounds, not the actual</span>
<a name="l00059"></a>00059 <span class="comment"> path.</span>
<a name="l00060"></a>00060 <span class="comment"> */</span>
<a name="l00061"></a><a class="code" href="class_sk_picture.html#a5af5c62450a2a893a2e08cb08c8d6a60ac40a2be6eaf8e93f5d9003802764c354">00061</a> <a class="code" href="class_sk_picture.html#a5af5c62450a2a893a2e08cb08c8d6a60ac40a2be6eaf8e93f5d9003802764c354">kUsePathBoundsForClip_RecordingFlag</a> = 0x01
<a name="l00062"></a>00062 };
<a name="l00063"></a>00063
<a name="l00072"></a>00072 <a class="code" href="class_sk_canvas.html">SkCanvas</a>* <a class="code" href="class_sk_picture.html#a2152d3a05ac6735d94a83a6e22b7b980">beginRecording</a>(<span class="keywordtype">int</span> <a class="code" href="class_sk_picture.html#a38752549880440b3a4f5e50350b3ffde">width</a>, <span class="keywordtype">int</span> <a class="code" href="class_sk_picture.html#aeb76cf765597c1bb5c825a4e7518fc1d">height</a>, uint32_t recordFlags = 0);
<a name="l00073"></a>00073
<a name="l00077"></a>00077 <a class="code" href="class_sk_canvas.html">SkCanvas</a>* <a class="code" href="class_sk_picture.html#ac06ee612b253a29f723f48e8a38fe189">getRecordingCanvas</a>() <span class="keyword">const</span>;
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="class_sk_picture.html#a4026905f39481775b484406f11f27919">endRecording</a>();
<a name="l00084"></a>00084
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="class_sk_picture.html#adf1b69943f6927166c6a55f3b32ee034">draw</a>(<a class="code" href="class_sk_canvas.html">SkCanvas</a>* surface);
<a name="l00090"></a>00090
<a name="l00096"></a><a class="code" href="class_sk_picture.html#a38752549880440b3a4f5e50350b3ffde">00096</a> <span class="keywordtype">int</span> <a class="code" href="class_sk_picture.html#a38752549880440b3a4f5e50350b3ffde">width</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fWidth; }
<a name="l00097"></a>00097
<a name="l00103"></a><a class="code" href="class_sk_picture.html#aeb76cf765597c1bb5c825a4e7518fc1d">00103</a> <span class="keywordtype">int</span> <a class="code" href="class_sk_picture.html#aeb76cf765597c1bb5c825a4e7518fc1d">height</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fHeight; }
<a name="l00104"></a>00104
<a name="l00105"></a>00105 <span class="keywordtype">void</span> <a class="code" href="class_sk_picture.html#acc43b3b68921e2015f022f81b8024f41">serialize</a>(<a class="code" href="class_sk_w_stream.html">SkWStream</a>*) <span class="keyword">const</span>;
<a name="l00106"></a>00106
<a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="class_sk_picture.html#a949d548418a160328aa1238b40b67ba2">abortPlayback</a>();
<a name="l00112"></a>00112
<a name="l00113"></a>00113 <span class="keyword">private</span>:
<a name="l00114"></a>00114 <span class="keywordtype">int</span> fWidth, fHeight;
<a name="l00115"></a>00115 SkPictureRecord* fRecord;
<a name="l00116"></a>00116 <a class="code" href="class_sk_picture.html#a2728637a51dc47f1edac12b41dba9cdd">SkPicturePlayback</a>* fPlayback;
<a name="l00117"></a>00117
<a name="l00118"></a><a class="code" href="class_sk_picture.html#a243631722be0dc316f79f38670624948">00118</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_sk_picture.html#a243631722be0dc316f79f38670624948">SkFlatPicture</a>;
<a name="l00119"></a><a class="code" href="class_sk_picture.html#a2728637a51dc47f1edac12b41dba9cdd">00119</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_sk_picture.html#a2728637a51dc47f1edac12b41dba9cdd">SkPicturePlayback</a>;
<a name="l00120"></a>00120 };
<a name="l00121"></a>00121
<a name="l00122"></a><a class="code" href="class_sk_auto_picture_record.html">00122</a> <span class="keyword">class </span><a class="code" href="class_sk_auto_picture_record.html">SkAutoPictureRecord</a> : SkNoncopyable {
<a name="l00123"></a>00123 <span class="keyword">public</span>:
<a name="l00124"></a><a class="code" href="class_sk_auto_picture_record.html#a885fe845aa09469cf47cadd91c43bd2b">00124</a> <a class="code" href="class_sk_auto_picture_record.html#a885fe845aa09469cf47cadd91c43bd2b">SkAutoPictureRecord</a>(<a class="code" href="class_sk_picture.html">SkPicture</a>* pict, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height,
<a name="l00125"></a>00125 uint32_t recordingFlags = 0) {
<a name="l00126"></a>00126 fPicture = pict;
<a name="l00127"></a>00127 fCanvas = pict-&gt;<a class="code" href="class_sk_picture.html#a2152d3a05ac6735d94a83a6e22b7b980">beginRecording</a>(width, height, recordingFlags);
<a name="l00128"></a>00128 }
<a name="l00129"></a><a class="code" href="class_sk_auto_picture_record.html#a630e21a1e47488ea72567611a5da419c">00129</a> <a class="code" href="class_sk_auto_picture_record.html#a630e21a1e47488ea72567611a5da419c">~SkAutoPictureRecord</a>() {
<a name="l00130"></a>00130 fPicture-&gt;<a class="code" href="class_sk_picture.html#a4026905f39481775b484406f11f27919">endRecording</a>();
<a name="l00131"></a>00131 }
<a name="l00132"></a>00132
<a name="l00135"></a><a class="code" href="class_sk_auto_picture_record.html#ab3461298a5bd8197b8da294f405da56a">00135</a> <a class="code" href="class_sk_canvas.html">SkCanvas</a>* <a class="code" href="class_sk_auto_picture_record.html#ab3461298a5bd8197b8da294f405da56a">getRecordingCanvas</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fCanvas; }
<a name="l00136"></a>00136
<a name="l00137"></a>00137 <span class="keyword">private</span>:
<a name="l00138"></a>00138 <a class="code" href="class_sk_picture.html">SkPicture</a>* fPicture;
<a name="l00139"></a>00139 <a class="code" href="class_sk_canvas.html">SkCanvas</a>* fCanvas;
<a name="l00140"></a>00140 };
<a name="l00141"></a>00141
<a name="l00142"></a>00142
<a name="l00143"></a>00143 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Tue Oct 20 11:03:40 2009 for Skia by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>