thorvg/docs/html/classtvg_1_1Canvas.html
2024-01-02 20:39:19 +09:00

418 lines
28 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ThorVG: Canvas</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="small_logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">ThorVG
&#160;<span id="projectnumber">v0.12</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classtvg_1_1Canvas.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classtvg_1_1Canvas-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Canvas<div class="ingroups"><a class="el" href="group__ThorVG.html">ThorVG</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>An abstract class for drawing graphical elements.
<a href="classtvg_1_1Canvas.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for Canvas:</div>
<div class="dyncontent">
<div class="center"><img src="classtvg_1_1Canvas__inherit__graph.png" border="0" usemap="#aCanvas_inherit__map" alt="Inheritance graph"/></div>
<map name="aCanvas_inherit__map" id="aCanvas_inherit__map">
<area shape="rect" title="An abstract class for drawing graphical elements." alt="" coords="123,5,193,32"/>
<area shape="rect" href="classtvg_1_1GlCanvas.html" title="A class for the rendering graphic elements with a GL raster engine." alt="" coords="5,80,89,107"/>
<area shape="rect" href="classtvg_1_1SwCanvas.html" title="A class for the rendering graphical elements with a software raster engine." alt="" coords="113,80,203,107"/>
<area shape="rect" href="classtvg_1_1WgCanvas.html" title="A class for the rendering graphic elements with a WebGPU raster engine." alt="" coords="227,80,318,107"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a1db0cc15b62127da865b37981402b411"><td class="memItemLeft" align="right" valign="top">TVG_DEPRECATED <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtvg_1_1Canvas.html#a1db0cc15b62127da865b37981402b411">reserve</a> (uint32_t n) noexcept</td></tr>
<tr class="memdesc:a1db0cc15b62127da865b37981402b411"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the size of the container, where all the paints pushed into the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> are stored. <a href="classtvg_1_1Canvas.html#a1db0cc15b62127da865b37981402b411">More...</a><br /></td></tr>
<tr class="separator:a1db0cc15b62127da865b37981402b411"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace6c268f853a4c144076de89b7bbbe75"><td class="memItemLeft" align="right" valign="top">std::list&lt; <a class="el" href="classtvg_1_1Paint.html">Paint</a> * &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtvg_1_1Canvas.html#ace6c268f853a4c144076de89b7bbbe75">paints</a> () noexcept</td></tr>
<tr class="memdesc:ace6c268f853a4c144076de89b7bbbe75"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the list of the paints that currently held by the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a>. <a href="classtvg_1_1Canvas.html#ace6c268f853a4c144076de89b7bbbe75">More...</a><br /></td></tr>
<tr class="separator:ace6c268f853a4c144076de89b7bbbe75"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82c5ec1c1ba93cf7671642400074201e"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtvg_1_1Canvas.html#a82c5ec1c1ba93cf7671642400074201e">push</a> (std::unique_ptr&lt; <a class="el" href="classtvg_1_1Paint.html">Paint</a> &gt; paint) noexcept</td></tr>
<tr class="memdesc:a82c5ec1c1ba93cf7671642400074201e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Passes drawing elements to the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> using <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> objects. <a href="classtvg_1_1Canvas.html#a82c5ec1c1ba93cf7671642400074201e">More...</a><br /></td></tr>
<tr class="separator:a82c5ec1c1ba93cf7671642400074201e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99cdb01cd893f4199b521b754d21aefd"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtvg_1_1Canvas.html#a99cdb01cd893f4199b521b754d21aefd">clear</a> (bool free=true) noexcept</td></tr>
<tr class="memdesc:a99cdb01cd893f4199b521b754d21aefd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear the internal canvas resources that used for the drawing. <a href="classtvg_1_1Canvas.html#a99cdb01cd893f4199b521b754d21aefd">More...</a><br /></td></tr>
<tr class="separator:a99cdb01cd893f4199b521b754d21aefd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89ac8a85a8c22723af9fb07c098472b3"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtvg_1_1Canvas.html#a89ac8a85a8c22723af9fb07c098472b3">update</a> (<a class="el" href="classtvg_1_1Paint.html">Paint</a> *paint=nullptr) noexcept</td></tr>
<tr class="memdesc:a89ac8a85a8c22723af9fb07c098472b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Request the canvas to update the paint objects. <a href="classtvg_1_1Canvas.html#a89ac8a85a8c22723af9fb07c098472b3">More...</a><br /></td></tr>
<tr class="separator:a89ac8a85a8c22723af9fb07c098472b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aabf9e5a14da3b4bfd5883c2b4459abd0"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtvg_1_1Canvas.html#aabf9e5a14da3b4bfd5883c2b4459abd0">draw</a> () noexcept</td></tr>
<tr class="memdesc:aabf9e5a14da3b4bfd5883c2b4459abd0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Requests the canvas to draw the <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> objects. <a href="classtvg_1_1Canvas.html#aabf9e5a14da3b4bfd5883c2b4459abd0">More...</a><br /></td></tr>
<tr class="separator:aabf9e5a14da3b4bfd5883c2b4459abd0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbca600af79f9a0b8e8366e3be7450e9"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtvg_1_1Canvas.html#adbca600af79f9a0b8e8366e3be7450e9">sync</a> () noexcept</td></tr>
<tr class="memdesc:adbca600af79f9a0b8e8366e3be7450e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Guarantees that drawing task is finished. <a href="classtvg_1_1Canvas.html#adbca600af79f9a0b8e8366e3be7450e9">More...</a><br /></td></tr>
<tr class="separator:adbca600af79f9a0b8e8366e3be7450e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>An abstract class for drawing graphical elements. </p>
<p>A canvas is an entity responsible for drawing the target. It sets up the drawing engine and the buffer, which can be drawn on the screen. It also manages given <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> objects.</p>
<dl class="section note"><dt>Note</dt><dd>A <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> behavior depends on the raster engine though the final content of the buffer is expected to be identical. </dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>The <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> objects belonging to one <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> can't be shared among multiple Canvases. </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a99cdb01cd893f4199b521b754d21aefd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99cdb01cd893f4199b521b754d21aefd">&#9670;&nbsp;</a></span>clear()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a> clear </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>free</em> = <code>true</code></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Clear the internal canvas resources that used for the drawing. </p>
<p>This API sets the total number of paints pushed into the canvas to zero. Depending on the value of the <code>free</code> argument, the paints are either freed or retained. So if you need to update paint properties while maintaining the existing scene structure, you can set <code>free</code> = false.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">free</td><td>If <code>true</code>, the memory occupied by paints is deallocated, otherwise it is not.</td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a505a83f220c02df2f85c3810cd9ceb38" title="The value returned in case of a correct request execution.">Result::Success</a></td><td>when succeed, <a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a119732ff568bf103d744e930ae2404f1" title="The value returned in case the request cannot be processed - e.g. asking for properties of an object,...">Result::InsufficientCondition</a> otherwise.</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classtvg_1_1Canvas.html#a82c5ec1c1ba93cf7671642400074201e" title="Passes drawing elements to the Canvas using Paint objects.">Canvas::push()</a> </dd>
<dd>
<a class="el" href="classtvg_1_1Canvas.html#ace6c268f853a4c144076de89b7bbbe75" title="Returns the list of the paints that currently held by the Canvas.">Canvas::paints()</a> </dd></dl>
</div>
</div>
<a id="aabf9e5a14da3b4bfd5883c2b4459abd0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aabf9e5a14da3b4bfd5883c2b4459abd0">&#9670;&nbsp;</a></span>draw()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a> draw </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Requests the canvas to draw the <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> objects. </p>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a505a83f220c02df2f85c3810cd9ceb38" title="The value returned in case of a correct request execution.">Result::Success</a></td><td>when succeed, <a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a119732ff568bf103d744e930ae2404f1" title="The value returned in case the request cannot be processed - e.g. asking for properties of an object,...">Result::InsufficientCondition</a> otherwise.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>Drawing can be asynchronous if the assigned thread number is greater than zero. To guarantee the drawing is done, call <a class="el" href="classtvg_1_1Canvas.html#adbca600af79f9a0b8e8366e3be7450e9" title="Guarantees that drawing task is finished.">sync()</a> afterwards. </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classtvg_1_1Canvas.html#adbca600af79f9a0b8e8366e3be7450e9" title="Guarantees that drawing task is finished.">Canvas::sync()</a> </dd></dl>
</div>
</div>
<a id="ace6c268f853a4c144076de89b7bbbe75"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace6c268f853a4c144076de89b7bbbe75">&#9670;&nbsp;</a></span>paints()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::list&lt;<a class="el" href="classtvg_1_1Paint.html">Paint</a>*&gt;&amp; paints </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the list of the paints that currently held by the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a>. </p>
<p>This function provides the list of paint nodes, allowing users a direct opportunity to modify the scene tree.</p>
<dl class="section warning"><dt>Warning</dt><dd>Please avoid accessing the paints during <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> update/draw. You can access them after calling <a class="el" href="classtvg_1_1Canvas.html#adbca600af79f9a0b8e8366e3be7450e9" title="Guarantees that drawing task is finished.">sync()</a>. </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classtvg_1_1Canvas.html#adbca600af79f9a0b8e8366e3be7450e9" title="Guarantees that drawing task is finished.">Canvas::sync()</a></dd></dl>
<dl class="section note"><dt>Note</dt><dd>Experimental API </dd></dl>
</div>
</div>
<a id="a82c5ec1c1ba93cf7671642400074201e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82c5ec1c1ba93cf7671642400074201e">&#9670;&nbsp;</a></span>push()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a> push </td>
<td>(</td>
<td class="paramtype">std::unique_ptr&lt; <a class="el" href="classtvg_1_1Paint.html">Paint</a> &gt;&#160;</td>
<td class="paramname"><em>paint</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Passes drawing elements to the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> using <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> objects. </p>
<p>Only pushed paints in the canvas will be drawing targets. They are retained by the canvas until you call <a class="el" href="classtvg_1_1Canvas.html#a99cdb01cd893f4199b521b754d21aefd" title="Clear the internal canvas resources that used for the drawing.">Canvas::clear()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">paint</td><td>A <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> object to be drawn.</td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a505a83f220c02df2f85c3810cd9ceb38" title="The value returned in case of a correct request execution.">Result::Success</a></td><td>When succeed. </td></tr>
<tr><td class="paramname"><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066ae8c0c653fcac575c31470f0f800991c6" title="The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting...">Result::MemoryCorruption</a></td><td>In case a <code>nullptr</code> is passed as the argument. </td></tr>
<tr><td class="paramname"><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a119732ff568bf103d744e930ae2404f1" title="The value returned in case the request cannot be processed - e.g. asking for properties of an object,...">Result::InsufficientCondition</a></td><td>An internal error.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The rendering order of the paints is the same as the order as they were pushed into the canvas. Consider sorting the paints before pushing them if you intend to use layering. </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classtvg_1_1Canvas.html#ace6c268f853a4c144076de89b7bbbe75" title="Returns the list of the paints that currently held by the Canvas.">Canvas::paints()</a> </dd>
<dd>
<a class="el" href="classtvg_1_1Canvas.html#a99cdb01cd893f4199b521b754d21aefd" title="Clear the internal canvas resources that used for the drawing.">Canvas::clear()</a> </dd></dl>
</div>
</div>
<a id="a1db0cc15b62127da865b37981402b411"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1db0cc15b62127da865b37981402b411">&#9670;&nbsp;</a></span>reserve()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">TVG_DEPRECATED <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a> reserve </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>n</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the size of the container, where all the paints pushed into the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> are stored. </p>
<p>If the number of objects pushed into the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> is known in advance, calling the function prevents multiple memory reallocation, thus improving the performance.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>The number of objects for which the memory is to be reserved.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a505a83f220c02df2f85c3810cd9ceb38" title="The value returned in case of a correct request execution.">Result::Success</a> when succeed. </dd></dl>
</div>
</div>
<a id="adbca600af79f9a0b8e8366e3be7450e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adbca600af79f9a0b8e8366e3be7450e9">&#9670;&nbsp;</a></span>sync()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a> sync </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Guarantees that drawing task is finished. </p>
<p>The <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> rendering can be performed asynchronously. To make sure that rendering is finished, the <a class="el" href="classtvg_1_1Canvas.html#adbca600af79f9a0b8e8366e3be7450e9" title="Guarantees that drawing task is finished.">sync()</a> must be called after the <a class="el" href="classtvg_1_1Canvas.html#aabf9e5a14da3b4bfd5883c2b4459abd0" title="Requests the canvas to draw the Paint objects.">draw()</a> regardless of threading.</p>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a505a83f220c02df2f85c3810cd9ceb38" title="The value returned in case of a correct request execution.">Result::Success</a></td><td>when succeed, <a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a119732ff568bf103d744e930ae2404f1" title="The value returned in case the request cannot be processed - e.g. asking for properties of an object,...">Result::InsufficientCondition</a> otherwise. </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classtvg_1_1Canvas.html#aabf9e5a14da3b4bfd5883c2b4459abd0" title="Requests the canvas to draw the Paint objects.">Canvas::draw()</a> </dd></dl>
</div>
</div>
<a id="a89ac8a85a8c22723af9fb07c098472b3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a89ac8a85a8c22723af9fb07c098472b3">&#9670;&nbsp;</a></span>update()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="group__ThorVG.html#ga28287671eaf7406afd604bd055ba4066">Result</a> update </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classtvg_1_1Paint.html">Paint</a> *&#160;</td>
<td class="paramname"><em>paint</em> = <code>nullptr</code></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Request the canvas to update the paint objects. </p>
<p>If a <code>nullptr</code> is passed all paint objects retained by the <a class="el" href="classtvg_1_1Canvas.html" title="An abstract class for drawing graphical elements.">Canvas</a> are updated, otherwise only the paint to which the given <code>paint</code> points.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">paint</td><td>A pointer to the <a class="el" href="classtvg_1_1Paint.html" title="An abstract class for managing graphical elements.">Paint</a> object or <code>nullptr</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"><a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a505a83f220c02df2f85c3810cd9ceb38" title="The value returned in case of a correct request execution.">Result::Success</a></td><td>when succeed, <a class="el" href="group__ThorVG.html#gga28287671eaf7406afd604bd055ba4066a119732ff568bf103d744e930ae2404f1" title="The value returned in case the request cannot be processed - e.g. asking for properties of an object,...">Result::InsufficientCondition</a> otherwise.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The Update behavior can be asynchronous if the assigned thread number is greater than zero. </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><b>tvg</b></li><li class="navelem"><a class="el" href="classtvg_1_1Canvas.html">Canvas</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>