[DALi][DOC-213] Add Background Knowledge, Handle/Body Pattern
authorYoonsang Lee <ysang114.lee@samsung.com>
Thu, 16 Jul 2015 08:44:05 +0000 (17:44 +0900)
committerYoonsang Lee <ysang114.lee@samsung.com>
Thu, 16 Jul 2015 08:44:14 +0000 (17:44 +0900)
Signed-off-by: Yoonsang Lee <ysang114.lee@samsung.com>
Change-Id: I9641d605283964806484ca130d6a8bdacb4987ee

org.tizen.ui.guides/html/index.htm
org.tizen.ui.guides/html/native/dali/actors_n.htm
org.tizen.ui.guides/html/native/dali/background_n.htm [new file with mode: 0755]
org.tizen.ui.guides/html/native/dali/dali_overview_n.htm
org.tizen.ui.guides/html/native/dali/guides_dali_n.htm

index f89430d..db33965 100755 (executable)
                                </li>
                                <li><a href="native/dali/resources_n.htm">Resources</a></li>
                                <li><a href="native/dali/rendering_effects_n.htm">Rendering and Effects</a></li>
+                               <li><a href="native/dali/background_n.htm">Background Knowledge</a></li>
                        </ul>
                </li>
        </ul>
index 8d8f930..dd6e416 100755 (executable)
@@ -109,6 +109,8 @@ Stage::GetCurrent().Add(actor);
        <li>An actor with the position (X = actorWidth*0.5, Y = actorWidth*0.5) appears at the top-left corner of the screen.</li>\r
 </ul>\r
 \r
+<p>Please see API reference for <span style="font-family: Courier New,Courier,monospace;">Dali::Actor::SetPosition()</span> (in <a href="../../../../org.tizen.native.mobile.apireference/classDali_1_1Layer.html">mobile</a> and <a href="../../../../org.tizen.native.wearable.apireference/classDali_1_1Layer.html">wearable</a>) for more details.</p>\r
+\r
 </li>\r
 </ul> \r
 \r
diff --git a/org.tizen.ui.guides/html/native/dali/background_n.htm b/org.tizen.ui.guides/html/native/dali/background_n.htm
new file mode 100755 (executable)
index 0000000..248f420
--- /dev/null
@@ -0,0 +1,207 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r
+<head>\r
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />\r
+       <meta http-equiv="X-UA-Compatible" content="IE=9" />\r
+       <link rel="stylesheet" type="text/css" href="../../css/styles.css" />\r
+       <link rel="stylesheet" type="text/css" href="../../css/snippet.css" />\r
+       <script type="text/javascript" src="../../scripts/snippet.js"></script> \r
+       <script type="text/javascript" src="../../scripts/jquery.util.js" charset="utf-8"></script>\r
+       <script type="text/javascript" src="../../scripts/common.js" charset="utf-8"></script>\r
+       <script type="text/javascript" src="../../scripts/core.js" charset="utf-8"></script>\r
+       <script type="text/javascript" src="../../scripts/search.js" charset="utf-8"></script>\r
+\r
+       <title>Background Knowledge: Using DALi More Effectively</title>  \r
+</head>\r
+\r
+<body onload="prettyPrint()" style="overflow: auto;">\r
+\r
+<div id="toc-navigation">\r
+       <div id="profile">\r
+               <p><img alt="Mobile native" src="../../images/mn_icon.png"/> <img alt="Wearable native" src="../../images/wn_icon.png"/></p>\r
+       </div>\r
+               <div id="toc_border"><div id="toc">\r
+               <p class="toc-title">Content</p>\r
+               <ul class="toc">\r
+                       <li><a href="#handle">Handle/Body Pattern</a></li>\r
+                       <li><a href="#property">Properties</a></li>\r
+                       <li><a href="#thread">DALi Thread Model</a></li>\r
+               </ul>\r
+               <p class="toc-title">Related Info</p>\r
+               <ul class="toc">\r
+                       <li><a href="../../../../org.tizen.native.mobile.apireference/classDali_1_1Actor.html">Dali::Actor API for Mobile Native</a></li>\r
+                       <li><a href="../../../../org.tizen.native.mobile.apireference/classDali_1_1Stage.html">Dali::Stage API for Mobile Native</a></li>\r
+                       <li><a href="../../../../org.tizen.native.wearable.apireference/classDali_1_1Actor.html">Dali::Actor API for Wearable Native</a></li>\r
+                       <li><a href="../../../../org.tizen.native.wearable.apireference/classDali_1_1Stage.html">Dali::Stage API for Wearable Native</a></li>                   \r
+               </ul>\r
+       </div></div>\r
+</div> \r
+\r
+<div id="container"><div id="contents"><div class="content">\r
+<h1>Background Knowledge: Using DALi More Effectively</h1>\r
+\r
+<p>This section describes useful background knowledge that enables you to use DALi more effectively.\r
+\r
+<h2 id="handle" name="handle">Handle/Body Pattern</h2>\r
+\r
+<p>DALi widely adopts the handle/body pattern (a.k.a. pimpl pattern) which seperates implementation details (the body class) from its interface (the handle class). In DALi, <span style="font-family: Courier New,Courier,monospace;">Dali::Handle</span> represents the interface part and hides internal implementation classes. It additionally provides smart-pointer semantics which manages internal objects with reference counts.\r
+</p>\r
+\r
+<p>This structure is benificial for both users and developers of DALi:</p>\r
+<ul>\r
+       <li><strong>Easier memory management</strong>\r
+       <p>Each internal <span style="font-family: Courier New,Courier,monospace;">Dali::Object</span> class (the body class) contains a single reference count object which can be intitialized with the static "New" methods in the DALi public API. This means that C++ new/delete operators do not have to be used in the user code.</p>\r
+       </li>\r
+       <li><strong>Better encapsulation</strong>\r
+       <p>The danger of API/ABI breaks is reduced since the implementation of a class can be changed without modifying the public API, thus without recompiling code using the public API. This also can reduce the build time.</p>\r
+       </li>\r
+</ul>\r
+\r
+<h3 id="usage" name="usage">Guide for Handles</h2>\r
+\r
+<ul>\r
+\r
+<li> No need to call destructors\r
+<pre class="prettyprint">\r
+class HandleTest\r
+{\r
+  HandleTest()\r
+  {\r
+    mActor = Actor::New();\r
+  }\r
+\r
+  ~HandleTest() {} // Actor object is destroyed automatically\r
+\r
+  Actor mActor;\r
+};\r
+</pre>\r
+</li>\r
+\r
+<li> Can be stored in STL containers\r
+<pre class="prettyprint">\r
+class HandleTest\r
+{\r
+  HandleTest()\r
+  {\r
+    mActors.push_back( Actor::New() );\r
+    mActors.push_back( Actor::New() );\r
+    ...\r
+  }\r
+\r
+  ~HandleTest() {} // Actors are destroyed automatically\r
+\r
+  std::vector&lt;Actor&gt; mActors;\r
+};\r
+</pre>\r
+</li>\r
+\r
+<li> Passing by value is encouraged\r
+<pre class="prettyprint">\r
+void SomeFunction( Actor actor )\r
+{\r
+  if( actor )\r
+  {\r
+    actor.SomeMethod();\r
+  }\r
+}\r
+</pre>\r
+</li>\r
+\r
+<li> Validity check\r
+<pre class="prettyprint">\r
+{\r
+  ...\r
+  Actor actor;  // Create a NULL object\r
+\r
+  // At this stage we cannot call any of the Actor methods\r
+  if( !actor )  // This test is will pass, since the actor is NULL\r
+  {\r
+    actor = Actor::New();\r
+    ...\r
+  }\r
+  ...\r
+}\r
+</pre>\r
+</li>\r
+\r
+<li> Equality operators\r
+<pre class="prettyprint">\r
+{\r
+  Actor handle1;\r
+  Actor handle2;\r
+  cout &lt;&lt; handle1 == handle2 &lt;&lt; endl; // "true", both handles are empty\r
+\r
+  handle2 = Actor::New();\r
+  cout &lt;&lt; handle1 == handle2 &lt;&lt; endl; // "false", one handle is empty\r
+\r
+  handle1 = Actor::New();\r
+  cout &lt;&lt; handle1 == handle2 &lt;&lt; endl; // "false", handles to different objects\r
+\r
+  handle1 = handle2;\r
+  cout &lt;&lt; handle1 == handle2 &lt;&lt; endl; // "true", handles to same object\r
+}\r
+</pre>\r
+</li>\r
+\r
+<li> Reference counting examples\r
+<pre class="prettyprint">\r
+class AnimationTest\r
+{\r
+...\r
+private:\r
+  Animation mAnimation; // animation handle\r
+};\r
+void AnimationTest::Initialize ()\r
+{\r
+  mAnimation = Animation::New( 10.0f ); // reference count will be 1, animation object stays alive when method returns\r
+  ...\r
+}\r
+void AnimationTest::SetAnimation( Animation anim )\r
+{\r
+  mAnimation = anim; // reference count of original animation decreased, 'anim' is referenced instead\r
+                     // if nobody else had a reference on the initial animation, the object is destroyed\r
+}\r
+</pre>\r
+\r
+<pre class="prettyprint">\r
+// At this point we own a Dali::Actor named "container"\r
+// Enter a code block\r
+{\r
+  // Create an text label\r
+  TextLabel actor = TextLabel::New("test");\r
+  // Add the text label to a container\r
+  container.Add(actor);\r
+}\r
+// Exit the code block\r
+// At this stage the text label is still alive\r
+// We don't keep the handle to the text label, but it can be retrieved from the container\r
+</pre>\r
+\r
+</ul>\r
+\r
+\r
+    \r
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>\r
+<script type="text/javascript" src="../../scripts/showhide.js"></script>\r
+</div></div></div>\r
+\r
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top" /></a>\r
+\r
+<div id="footer">\r
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>\r
+</div>\r
+\r
+<script type="text/javascript">\r
+var _gaq = _gaq || [];\r
+_gaq.push(['_setAccount', 'UA-25976949-1']);\r
+_gaq.push(['_trackPageview']);\r
+(function() {\r
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\r
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\r
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\r
+})();\r
+</script>\r
+\r
+</body>\r
+</html>\r
+\r
index 0fcfe76..969d0ed 100755 (executable)
@@ -69,7 +69,7 @@
 <p> DALi has a concept of camera to display its virtual 3D world to a 2D screen. There are two ways of using the camera in DALi:</p>\r
 \r
 <ul>\r
-       <li>For <strong>2D</strong> applications, you don't need to care about the camera at all. The default camera is alreay best suited for 2D applications (configured to have the origin of coordinate system at the top-left corner of the screen, and unit 1 as 1 pixel of the screen). This is a typical way.</li>\r
+       <li>For <strong>2D</strong> applications, you don't need to care about the camera at all. The default camera is already best suited for 2D applications (configured to have the origin of coordinate system at the top-left corner of the screen, and unit 1 as 1 pixel of the screen). This is a typical way.</li>\r
        <li>For <strong>3D</strong> applications, you might want to change the view by mapulating the camera. You can translate / rotate the camera in this case. Please note that the top-left corner of the screen and unit 1 no longer are (0,0,0) and 1 pixel after manipulating the camera.</li>\r
 </ul>\r
 \r
index d900875..4be15be 100755 (executable)
@@ -55,6 +55,8 @@
        <p>Enables you to manage resource images.</p></li>
        <li><a href="rendering_effects_n.htm">Rendering and Effects: Managing Viewing Modes and Shader Effects</a>
        <p>Enables you to manage DALi viewing modes and create shade effects.</p></li>
+       <li><a href="background_n.htm">Background Knowledge: Using DALi More Effectively</a>
+       <p>Enables you to use DALi more effectively with background knowledge.</p></li>
 </ul>
     
 <script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>