Source

cappuccino-docs / cappuccino docs / cappuccino.org / learn / documentation / _c_g_geometry_8j_source.html

Full commit
<!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">

<!-- Mirrored from cappuccino.org/learn/documentation/_c_g_geometry_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:20:02 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Cappuccino API: AppKit/CoreGraphics/CGGeometry.j 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="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</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>AppKit/CoreGraphics/CGGeometry.j</h1><a href="_c_g_geometry_8j.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"> * CGGeometry.j</span>
<a name="l00003"></a>00003 <span class="comment"> * AppKit</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * Created by Francisco Tolmasky.</span>
<a name="l00006"></a>00006 <span class="comment"> * Copyright 2008, 280 North, Inc.</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00009"></a>00009 <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span>
<a name="l00010"></a>00010 <span class="comment"> * License as published by the Free Software Foundation; either</span>
<a name="l00011"></a>00011 <span class="comment"> * version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
<a name="l00016"></a>00016 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span>
<a name="l00019"></a>00019 <span class="comment"> * License along with this library; if not, write to the Free Software</span>
<a name="l00020"></a>00020 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span>
<a name="l00021"></a>00021 <span class="comment"> */</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="_c_g_geometry_8h.html">CGGeometry.h</a>&quot;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#define _function(inline) function inline { return _##inline; }</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a><a class="code" href="_c_g_geometry_8j.html#a06c96cb5931220da52ff44b8ce9b603e">00027</a> _function(<a class="code" href="_c_g_geometry_8j.html#a06c96cb5931220da52ff44b8ce9b603e">CGPointMake</a>(x, y))
<a name="l00028"></a><a class="code" href="_c_g_geometry_8j.html#a708f763d0feefd3056965f041c3c2cb2">00028</a> _function(<a class="code" href="_c_g_geometry_8j.html#a708f763d0feefd3056965f041c3c2cb2">CGPointMakeZero</a>())
<a name="l00029"></a><a class="code" href="_c_g_geometry_8j.html#a314db62cdcca474c114163fda67046ac">00029</a> _function(<a class="code" href="_c_g_geometry_8j.html#a314db62cdcca474c114163fda67046ac">CGPointMakeCopy</a>(aPoint))
<a name="l00030"></a><a class="code" href="_c_g_geometry_8j.html#a3705f18589345780f617faa2ae6ab2c4">00030</a> _function(<a class="code" href="_c_g_geometry_8j.html#a3705f18589345780f617faa2ae6ab2c4">CGPointCreateCopy</a>(aPoint))
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="_c_g_geometry_8j.html#a92e2504d7631188e8c340f9462dd80d9">00032</a> _function(<a class="code" href="_c_g_geometry_8j.html#a92e2504d7631188e8c340f9462dd80d9">CGPointEqualToPoint</a>(lhsPoint, rhsPoint))
<a name="l00033"></a><a class="code" href="_c_g_geometry_8j.html#a75e4350392b5b64cac252ec80d1e758c">00033</a> _function(<a class="code" href="_c_g_geometry_8j.html#a75e4350392b5b64cac252ec80d1e758c">CGStringFromPoint</a>(aPoint))
<a name="l00034"></a>00034 
<a name="l00035"></a><a class="code" href="_c_g_geometry_8j.html#ae46727e9923eb30b151ac3cbf6f0be42">00035</a> _function(<a class="code" href="_c_g_geometry_8j.html#ae46727e9923eb30b151ac3cbf6f0be42">CGSizeMake</a>(<a class="code" href="_c_p_segmented_control_8j.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>))
<a name="l00036"></a><a class="code" href="_c_g_geometry_8j.html#ab8e35bab228754c325f263092a141847">00036</a> _function(<a class="code" href="_c_g_geometry_8j.html#ab8e35bab228754c325f263092a141847">CGSizeMakeZero</a>())
<a name="l00037"></a><a class="code" href="_c_g_geometry_8j.html#affb0172e44ea288a2660c9a5394db33a">00037</a> _function(<a class="code" href="_c_g_geometry_8j.html#affb0172e44ea288a2660c9a5394db33a">CGSizeMakeCopy</a>(aSize))
<a name="l00038"></a><a class="code" href="_c_g_geometry_8j.html#ac0ce05074e36a3ea5cdc40d111b6d8b5">00038</a> _function(<a class="code" href="_c_g_geometry_8j.html#ac0ce05074e36a3ea5cdc40d111b6d8b5">CGSizeCreateCopy</a>(aSize))
<a name="l00039"></a>00039 
<a name="l00040"></a><a class="code" href="_c_g_geometry_8j.html#a1eefbb30f35d5c4f4473bec9a2ebff9f">00040</a> _function(<a class="code" href="_c_g_geometry_8j.html#a1eefbb30f35d5c4f4473bec9a2ebff9f">CGSizeEqualToSize</a>(lhsSize, rhsSize))
<a name="l00041"></a><a class="code" href="_c_g_geometry_8j.html#ab9e11b649116f9d78214576c2e7d3067">00041</a> _function(<a class="code" href="_c_g_geometry_8j.html#ab9e11b649116f9d78214576c2e7d3067">CGStringFromSize</a>(aSize))
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="_c_g_geometry_8j.html#aca150c0049e24797c6271bad7bc90610">00043</a> _function(<a class="code" href="_c_g_geometry_8j.html#aca150c0049e24797c6271bad7bc90610">CGRectMake</a>(x, y, width, <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>))
<a name="l00044"></a><a class="code" href="_c_g_geometry_8j.html#aaab3ca5ef295a8517c18bfce6e95c1f6">00044</a> _function(<a class="code" href="_c_g_geometry_8j.html#aaab3ca5ef295a8517c18bfce6e95c1f6">CGRectMakeZero</a>())
<a name="l00045"></a><a class="code" href="_c_g_geometry_8j.html#a7521362038d81fa55cafbd6da5130335">00045</a> _function(<a class="code" href="_c_g_geometry_8j.html#a7521362038d81fa55cafbd6da5130335">CGRectMakeCopy</a>(aRect))
<a name="l00046"></a><a class="code" href="_c_g_geometry_8j.html#ae62f9f5339c89eeddc9eaad1386a1566">00046</a> _function(<a class="code" href="_c_g_geometry_8j.html#ae62f9f5339c89eeddc9eaad1386a1566">CGRectCreateCopy</a>(aRect))
<a name="l00047"></a>00047 
<a name="l00048"></a><a class="code" href="_c_g_geometry_8j.html#ab2c7317de643eac257976b886fc932e8">00048</a> _function(<a class="code" href="_c_g_geometry_8j.html#ab2c7317de643eac257976b886fc932e8">CGRectEqualToRect</a>(lhsRect, rhsRect))
<a name="l00049"></a><a class="code" href="_c_g_geometry_8j.html#acd9be44fdde9dca288664360071e9114">00049</a> _function(<a class="code" href="_c_g_geometry_8j.html#acd9be44fdde9dca288664360071e9114">CGStringFromRect</a>(aRect))
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="_c_g_geometry_8j.html#a7aba1c63e3babe772e0875917fc1d3e2">00051</a> _function(<a class="code" href="_c_g_geometry_8j.html#a7aba1c63e3babe772e0875917fc1d3e2">CGRectOffset</a>(aRect, dX, dY))
<a name="l00052"></a><a class="code" href="_c_g_geometry_8j.html#a7a8bf2c8ac39961ec6002958ccf846b2">00052</a> _function(<a class="code" href="_c_g_geometry_8j.html#a7a8bf2c8ac39961ec6002958ccf846b2">CGRectInset</a>(aRect, dX, dY))
<a name="l00053"></a>00053 
<a name="l00054"></a><a class="code" href="_c_g_geometry_8j.html#a09d2072d60c7f39b04a41705d640fa98">00054</a> _function(<a class="code" href="_c_g_geometry_8j.html#a09d2072d60c7f39b04a41705d640fa98">CGRectGetHeight</a>(aRect))
<a name="l00055"></a><a class="code" href="_c_g_geometry_8j.html#af3a2c4d8cf973ee27fb86b6ed74497cc">00055</a> _function(<a class="code" href="_c_g_geometry_8j.html#af3a2c4d8cf973ee27fb86b6ed74497cc">CGRectGetMaxX</a>(aRect))
<a name="l00056"></a><a class="code" href="_c_g_geometry_8j.html#ab0a24500a256a6e58aab6ae4f19d7a77">00056</a> _function(<a class="code" href="_c_g_geometry_8j.html#ab0a24500a256a6e58aab6ae4f19d7a77">CGRectGetMaxY</a>(aRect))
<a name="l00057"></a><a class="code" href="_c_g_geometry_8j.html#a4010d2080312e060876e676ec3c2bdfc">00057</a> _function(<a class="code" href="_c_g_geometry_8j.html#a4010d2080312e060876e676ec3c2bdfc">CGRectGetMidX</a>(aRect))
<a name="l00058"></a><a class="code" href="_c_g_geometry_8j.html#a06897041af5e32e1288828f8e1240ef5">00058</a> _function(<a class="code" href="_c_g_geometry_8j.html#a06897041af5e32e1288828f8e1240ef5">CGRectGetMidY</a>(aRect))
<a name="l00059"></a><a class="code" href="_c_g_geometry_8j.html#a7c1a8fe081097d577b441f6b7b553421">00059</a> _function(<a class="code" href="_c_g_geometry_8j.html#a7c1a8fe081097d577b441f6b7b553421">CGRectGetMinX</a>(aRect))
<a name="l00060"></a><a class="code" href="_c_g_geometry_8j.html#a9408ba6b0750742be8d630f59a3d4669">00060</a> _function(<a class="code" href="_c_g_geometry_8j.html#a9408ba6b0750742be8d630f59a3d4669">CGRectGetMinY</a>(aRect))
<a name="l00061"></a><a class="code" href="_c_g_geometry_8j.html#aa310af239f2108c573299b35776996fa">00061</a> _function(<a class="code" href="_c_g_geometry_8j.html#aa310af239f2108c573299b35776996fa">CGRectGetWidth</a>(aRect))
<a name="l00062"></a>00062 
<a name="l00063"></a><a class="code" href="_c_g_geometry_8j.html#ad81ae6c5e4970cf016df53180eb3d1bc">00063</a> _function(<a class="code" href="_c_g_geometry_8j.html#ad81ae6c5e4970cf016df53180eb3d1bc">CGRectIsEmpty</a>(aRect))
<a name="l00064"></a><a class="code" href="_c_g_geometry_8j.html#a987de357f508964f389e7d0fee2b6e51">00064</a> _function(<a class="code" href="_c_g_geometry_8j.html#a987de357f508964f389e7d0fee2b6e51">CGRectIsNull</a>(aRect))
<a name="l00065"></a>00065 
<a name="l00066"></a><a class="code" href="_c_g_geometry_8j.html#a1a96c087c2dc31ab61c3c88a3c6ec7c5">00066</a> _function(<a class="code" href="_c_g_geometry_8j.html#a1a96c087c2dc31ab61c3c88a3c6ec7c5">CGRectContainsPoint</a>(aRect, aPoint))
<a name="l00067"></a>00067 
<a name="l00068"></a><a class="code" href="_c_g_geometry_8j.html#acbe4ee1d0010dd63819109c25c4106ca">00068</a> _function(<a class="code" href="_c_g_geometry_8j.html#acbe4ee1d0010dd63819109c25c4106ca">CGInsetMake</a>(top, right, bottom, left))
<a name="l00069"></a><a class="code" href="_c_g_geometry_8j.html#ab2ea13515b628198146c63ee8277fc27">00069</a> _function(<a class="code" href="_c_g_geometry_8j.html#ab2ea13515b628198146c63ee8277fc27">CGInsetMakeZero</a>())
<a name="l00070"></a><a class="code" href="_c_g_geometry_8j.html#a74dd3c9036396a23e2c9760a41f57702">00070</a> _function(<a class="code" href="_c_g_geometry_8j.html#a74dd3c9036396a23e2c9760a41f57702">CGInsetMakeCopy</a>(anInset))
<a name="l00071"></a><a class="code" href="_c_g_geometry_8j.html#a9a1d491b8963f3de686f63a8f82f816a">00071</a> _function(<a class="code" href="_c_g_geometry_8j.html#a9a1d491b8963f3de686f63a8f82f816a">CGInsetIsEmpty</a>(anInset))
<a name="l00072"></a>00072 
<a name="l00073"></a><a class="code" href="_c_g_geometry_8j.html#a70bbbd017c0da1a4dc3f6f21218f029f">00073</a> <a class="code" href="_c_g_geometry_8j.html#a70bbbd017c0da1a4dc3f6f21218f029f">CGRectNull</a> = _CGRectMake(Infinity, Infinity, 0.0, 0.0);
<a name="l00074"></a>00074 
<a name="l00088"></a><a class="code" href="group__appkit.html#gadfb2531cda2178d0864d50184bd9d2a1">00088</a> function <a class="code" href="group__appkit.html#gadfb2531cda2178d0864d50184bd9d2a1">CGRectContainsRect</a>(lhsRect, rhsRect)
<a name="l00089"></a>00089 {
<a name="l00090"></a>00090     var <span class="keyword">union </span>= <a class="code" href="group__appkit.html#gacafe1605d9b8dd64e2ca806da443c255">CGRectUnion</a>(lhsRect, rhsRect);
<a name="l00091"></a>00091     
<a name="l00092"></a>00092     <span class="keywordflow">return</span> _CGRectEqualToRect(<span class="keyword">union</span>, lhsRect);
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094 
<a name="l00102"></a><a class="code" href="group__appkit.html#ga77d150d6cf60ff142fa46dc079e8203a">00102</a> function <a class="code" href="group__appkit.html#ga77d150d6cf60ff142fa46dc079e8203a">CGRectIntersectsRect</a>(lhsRect, rhsRect)
<a name="l00103"></a>00103 {
<a name="l00104"></a>00104     var intersection = <a class="code" href="group__appkit.html#gaa7d357ddb0a9100773cb092dd14a243f">CGRectIntersection</a>(lhsRect, rhsRect);
<a name="l00105"></a>00105     
<a name="l00106"></a>00106     <span class="keywordflow">return</span> !_CGRectIsEmpty(intersection);
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 
<a name="l00116"></a><a class="code" href="group__appkit.html#ga6467a5221d9979237392c9524c0d7ddf">00116</a> function <a class="code" href="group__appkit.html#ga6467a5221d9979237392c9524c0d7ddf">CGRectIntegral</a>(aRect)
<a name="l00117"></a>00117 {
<a name="l00118"></a>00118     aRect = <a class="code" href="group__appkit.html#gadc61478b2000b5b2f1ea07a24d050434">CGRectStandardize</a>(aRect);
<a name="l00119"></a>00119 
<a name="l00120"></a>00120     <span class="comment">// Store these out separately, if not the GetMaxes will return incorrect values.</span>
<a name="l00121"></a>00121     var x = FLOOR(_CGRectGetMinX(aRect)),
<a name="l00122"></a>00122         y = FLOOR(_CGRectGetMinY(aRect));
<a name="l00123"></a>00123     
<a name="l00124"></a>00124     aRect.size.width = CEIL(_CGRectGetMaxX(aRect)) - x;
<a name="l00125"></a>00125     aRect.size.height = CEIL(_CGRectGetMaxY(aRect)) - y;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127     aRect.origin.x = x;
<a name="l00128"></a>00128     aRect.origin.y = y;
<a name="l00129"></a>00129 
<a name="l00130"></a>00130     <span class="keywordflow">return</span> aRect;
<a name="l00131"></a>00131 }
<a name="l00132"></a>00132 
<a name="l00140"></a><a class="code" href="group__appkit.html#gaa7d357ddb0a9100773cb092dd14a243f">00140</a> function <a class="code" href="group__appkit.html#gaa7d357ddb0a9100773cb092dd14a243f">CGRectIntersection</a>(lhsRect, rhsRect)
<a name="l00141"></a>00141 {
<a name="l00142"></a>00142     var intersection = _CGRectMake(
<a name="l00143"></a>00143         <a class="code" href="_c_p_obj_j_runtime_8j.html#a45f5f88d061da0c18bcb6b6a854fe898">MAX</a>(_CGRectGetMinX(lhsRect), _CGRectGetMinX(rhsRect)), 
<a name="l00144"></a>00144         <a class="code" href="_c_p_obj_j_runtime_8j.html#a45f5f88d061da0c18bcb6b6a854fe898">MAX</a>(_CGRectGetMinY(lhsRect), _CGRectGetMinY(rhsRect)), 
<a name="l00145"></a>00145         0, 0);
<a name="l00146"></a>00146     
<a name="l00147"></a>00147     intersection.size.width = <a class="code" href="_c_p_obj_j_runtime_8j.html#a4fca277171215842609dc38a6f0c19fb">MIN</a>(_CGRectGetMaxX(lhsRect), _CGRectGetMaxX(rhsRect)) - _CGRectGetMinX(intersection);
<a name="l00148"></a>00148     intersection.size.height = <a class="code" href="_c_p_obj_j_runtime_8j.html#a4fca277171215842609dc38a6f0c19fb">MIN</a>(_CGRectGetMaxY(lhsRect), _CGRectGetMaxY(rhsRect)) - _CGRectGetMinY(intersection);
<a name="l00149"></a>00149     
<a name="l00150"></a>00150     <span class="keywordflow">return</span> _CGRectIsEmpty(intersection) ? _CGRectMakeZero() : intersection;
<a name="l00151"></a>00151 }
<a name="l00152"></a>00152 
<a name="l00153"></a>00153 <span class="comment">/*</span>
<a name="l00154"></a>00154 <span class="comment">    </span>
<a name="l00155"></a>00155 <span class="comment">*/</span>
<a name="l00156"></a><a class="code" href="group__appkit.html#gadc61478b2000b5b2f1ea07a24d050434">00156</a> function <a class="code" href="group__appkit.html#gadc61478b2000b5b2f1ea07a24d050434">CGRectStandardize</a>(aRect)
<a name="l00157"></a>00157 {
<a name="l00158"></a>00158     var <a class="code" href="_c_p_segmented_control_8j.html#a2474a5474cbff19523a51eb1de01cda4">width</a> = _CGRectGetWidth(aRect),
<a name="l00159"></a>00159         <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a> = _CGRectGetHeight(aRect),
<a name="l00160"></a>00160         standardized = _CGRectMakeCopy(aRect);
<a name="l00161"></a>00161 
<a name="l00162"></a>00162     <span class="keywordflow">if</span> (width &lt; 0.0)
<a name="l00163"></a>00163     {
<a name="l00164"></a>00164         standardized.origin.x += width;
<a name="l00165"></a>00165         standardized.size.width = -width;
<a name="l00166"></a>00166     }
<a name="l00167"></a>00167 
<a name="l00168"></a>00168     <span class="keywordflow">if</span> (<a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a> &lt; 0.0)
<a name="l00169"></a>00169     {
<a name="l00170"></a>00170         standardized.origin.y += <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>;
<a name="l00171"></a>00171         standardized.size.height = -<a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>;
<a name="l00172"></a>00172     }
<a name="l00173"></a>00173 
<a name="l00174"></a>00174     <span class="keywordflow">return</span> standardized;
<a name="l00175"></a>00175 }
<a name="l00176"></a>00176 
<a name="l00177"></a><a class="code" href="group__appkit.html#gacafe1605d9b8dd64e2ca806da443c255">00177</a> function <a class="code" href="group__appkit.html#gacafe1605d9b8dd64e2ca806da443c255">CGRectUnion</a>(lhsRect, rhsRect)
<a name="l00178"></a>00178 {
<a name="l00179"></a>00179     var lhsRectIsNull = !lhsRect || lhsRect === <a class="code" href="_c_g_geometry_8j.html#a70bbbd017c0da1a4dc3f6f21218f029f">CGRectNull</a>,
<a name="l00180"></a>00180         rhsRectIsNull = !rhsRect || rhsRect === <a class="code" href="_c_g_geometry_8j.html#a70bbbd017c0da1a4dc3f6f21218f029f">CGRectNull</a>;
<a name="l00181"></a>00181 
<a name="l00182"></a>00182     <span class="keywordflow">if</span> (lhsRectIsNull)
<a name="l00183"></a>00183         <span class="keywordflow">return</span> rhsRectIsNull ? <a class="code" href="_c_g_geometry_8j.html#a70bbbd017c0da1a4dc3f6f21218f029f">CGRectNull</a> : rhsRect;
<a name="l00184"></a>00184 
<a name="l00185"></a>00185     <span class="keywordflow">if</span> (rhsRectIsNull)
<a name="l00186"></a>00186         <span class="keywordflow">return</span> lhsRectIsNull ? <a class="code" href="_c_g_geometry_8j.html#a70bbbd017c0da1a4dc3f6f21218f029f">CGRectNull</a> : lhsRect;
<a name="l00187"></a>00187 
<a name="l00188"></a>00188     var minX = <a class="code" href="_c_p_obj_j_runtime_8j.html#a4fca277171215842609dc38a6f0c19fb">MIN</a>(_CGRectGetMinX(lhsRect), _CGRectGetMinX(rhsRect)),
<a name="l00189"></a>00189         minY = <a class="code" href="_c_p_obj_j_runtime_8j.html#a4fca277171215842609dc38a6f0c19fb">MIN</a>(_CGRectGetMinY(lhsRect), _CGRectGetMinY(rhsRect)),
<a name="l00190"></a>00190         maxX = <a class="code" href="_c_p_obj_j_runtime_8j.html#a45f5f88d061da0c18bcb6b6a854fe898">MAX</a>(_CGRectGetMaxX(lhsRect), _CGRectGetMaxX(rhsRect)),
<a name="l00191"></a>00191         maxY = <a class="code" href="_c_p_obj_j_runtime_8j.html#a45f5f88d061da0c18bcb6b6a854fe898">MAX</a>(_CGRectGetMaxY(lhsRect), _CGRectGetMaxY(rhsRect));
<a name="l00192"></a>00192     
<a name="l00193"></a>00193     <span class="keywordflow">return</span> _CGRectMake(minX, minY, maxX - minX, maxY - minY);
<a name="l00194"></a>00194 }
<a name="l00195"></a>00195 
<a name="l00196"></a><a class="code" href="group__appkit.html#ga0fd2ac563f14e0e83bc02ff03323ff83">00196</a> function <a class="code" href="group__appkit.html#ga0fd2ac563f14e0e83bc02ff03323ff83">CGPointFromString</a>(aString)
<a name="l00197"></a>00197 {
<a name="l00198"></a>00198     var comma = aString.indexOf(<span class="charliteral">&apos;,&apos;</span>);
<a name="l00199"></a>00199     
<a name="l00200"></a>00200     <span class="keywordflow">return</span> { x:parseInt(aString.substr(1, comma - 1)), y:parseInt(aString.substring(comma + 1, aString.length)) };
<a name="l00201"></a>00201 }
<a name="l00202"></a>00202 
<a name="l00203"></a><a class="code" href="group__appkit.html#ga84ce576541d3be67b5c966f4d8c4efee">00203</a> function <a class="code" href="group__appkit.html#ga84ce576541d3be67b5c966f4d8c4efee">CGSizeFromString</a>(aString)
<a name="l00204"></a>00204 {
<a name="l00205"></a>00205     var comma = aString.indexOf(<span class="charliteral">&apos;,&apos;</span>);
<a name="l00206"></a>00206     
<a name="l00207"></a>00207     <span class="keywordflow">return</span> { <a class="code" href="_c_p_segmented_control_8j.html#a2474a5474cbff19523a51eb1de01cda4">width</a>:parseInt(aString.substr(1, comma - 1)), <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>:parseInt(aString.substring(comma + 1, aString.length)) };
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209 
<a name="l00210"></a><a class="code" href="group__appkit.html#ga0beeec3e822ea69566b8a9fe6dd3d396">00210</a> function <a class="code" href="group__appkit.html#ga0beeec3e822ea69566b8a9fe6dd3d396">CGRectFromString</a>(aString)
<a name="l00211"></a>00211 {
<a name="l00212"></a>00212     var comma = aString.indexOf(<span class="charliteral">&apos;,&apos;</span>, aString.indexOf(<span class="charliteral">&apos;,&apos;</span>) + 1);
<a name="l00213"></a>00213     
<a name="l00214"></a>00214     <span class="keywordflow">return</span> { origin:<a class="code" href="group__appkit.html#ga0fd2ac563f14e0e83bc02ff03323ff83">CGPointFromString</a>(aString.substr(1, comma - 1)), <a class="code" href="_c_p_screen_8j.html#ad241596b0d0f8cbdd1529d94ea71337b">size</a>:<a class="code" href="group__appkit.html#ga84ce576541d3be67b5c966f4d8c4efee">CGSizeFromString</a>(aString.substring(comma + 2, aString.length)) };
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 
<a name="l00217"></a><a class="code" href="group__appkit.html#ga829caa5225d092bc239579634dcf1c4a">00217</a> function <a class="code" href="group__appkit.html#ga829caa5225d092bc239579634dcf1c4a">CGPointFromEvent</a>(anEvent)
<a name="l00218"></a>00218 {
<a name="l00219"></a>00219     <span class="keywordflow">return</span> _CGPointMake(anEvent.clientX, anEvent.clientY);
<a name="l00220"></a>00220 }
<a name="l00221"></a>00221 
<a name="l00222"></a><a class="code" href="group__appkit.html#gafe8cdb5659015648c6f5e6391c31a0a4">00222</a> function <a class="code" href="group__appkit.html#gafe8cdb5659015648c6f5e6391c31a0a4">CGInsetFromString</a>(aString)
<a name="l00223"></a>00223 {
<a name="l00224"></a>00224     var numbers = aString.substr(1, aString.length - 2).split(<span class="charliteral">&apos;,&apos;</span>);
<a name="l00225"></a>00225 
<a name="l00226"></a>00226     <span class="keywordflow">return</span> _CGInsetMake(parseFloat(numbers[0]), parseFloat(numbers[1]), parseFloat(numbers[2]), parseFloat(numbers[3]));
<a name="l00227"></a>00227 }
<a name="l00228"></a>00228 
<a name="l00229"></a><a class="code" href="group__appkit.html#gae68c119d4f565225c476b78478e36eca">00229</a> <a class="code" href="group__appkit.html#gae68c119d4f565225c476b78478e36eca">CGInsetFromCPString</a> = <a class="code" href="group__appkit.html#gafe8cdb5659015648c6f5e6391c31a0a4">CGInsetFromString</a>;
<a name="l00230"></a>00230 
<a name="l00231"></a><a class="code" href="group__appkit.html#ga613a2d41ced53d7e7999b1caa9cb6e3a">00231</a> function <a class="code" href="group__appkit.html#ga613a2d41ced53d7e7999b1caa9cb6e3a">CPStringFromCGInset</a>(anInset)
<a name="l00232"></a>00232 {
<a name="l00233"></a>00233     <span class="keywordflow">return</span> <span class="charliteral">&apos;{&apos;</span> + anInset.top + <span class="stringliteral">&quot;, &quot;</span> + anInset.left + <span class="stringliteral">&quot;, &quot;</span> + anInset.bottom + <span class="stringliteral">&quot;, &quot;</span> + anInset.right + <span class="charliteral">&apos;}&apos;</span>;
<a name="l00234"></a>00234 }
<a name="l00235"></a>00235 
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Tue Apr 6 10:32:54 2010 for Cappuccino API 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>

<!-- Mirrored from cappuccino.org/learn/documentation/_c_g_geometry_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:20:02 GMT -->
</html>