Source

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

<!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_p_geometry_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:28 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Cappuccino API: AppKit/CPGeometry.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/CPGeometry.j</h1><a href="_c_p_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"> * CPGeometry.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="keyword">import</span> <span class="stringliteral">&quot;CGGeometry.j&quot;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 
<a name="l00026"></a><a class="code" href="_c_p_geometry_8j.html#a943177064e0b14a876a2c95209a13bb2">00026</a> <a class="code" href="_c_p_geometry_8j.html#a943177064e0b14a876a2c95209a13bb2">CPMinXEdge</a> = 0;
<a name="l00027"></a><a class="code" href="_c_p_geometry_8j.html#a9364bfbb4d761f955ecb059732380acc">00027</a> <a class="code" href="_c_p_geometry_8j.html#a9364bfbb4d761f955ecb059732380acc">CPMinYEdge</a> = 1;
<a name="l00028"></a><a class="code" href="_c_p_geometry_8j.html#aee1128570ed76b6c0d4722cd2a004e20">00028</a> <a class="code" href="_c_p_geometry_8j.html#aee1128570ed76b6c0d4722cd2a004e20">CPMaxXEdge</a> = 2;
<a name="l00029"></a><a class="code" href="_c_p_geometry_8j.html#a14fcdaddd46fdeaabc38c72e5353b262">00029</a> <a class="code" href="_c_p_geometry_8j.html#a14fcdaddd46fdeaabc38c72e5353b262">CPMaxYEdge</a> = 3;
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="comment">// FIXME: the rest!</span>
<a name="l00032"></a><a class="code" href="_c_p_geometry_8j.html#a82fe35f82ea8fd730539351fba488d21">00032</a> <a class="code" href="_c_p_geometry_8j.html#a82fe35f82ea8fd730539351fba488d21">CPMakePoint</a> = <a class="code" href="_c_g_geometry_8j.html#a06c96cb5931220da52ff44b8ce9b603e">CGPointMake</a>;
<a name="l00033"></a><a class="code" href="_c_p_geometry_8j.html#a18a3be74a9985727dff3562a485209b9">00033</a> <a class="code" href="_c_p_geometry_8j.html#a18a3be74a9985727dff3562a485209b9">CPMakeSize</a> = <a class="code" href="_c_g_geometry_8j.html#ae46727e9923eb30b151ac3cbf6f0be42">CGSizeMake</a>;
<a name="l00034"></a><a class="code" href="_c_p_geometry_8j.html#accb7689c1d0a476670fa163b9ca11374">00034</a> <a class="code" href="_c_p_geometry_8j.html#accb7689c1d0a476670fa163b9ca11374">CPMakeRect</a> = <a class="code" href="_c_g_geometry_8j.html#aca150c0049e24797c6271bad7bc90610">CGRectMake</a>;
<a name="l00035"></a>00035 
<a name="l00047"></a><a class="code" href="group__appkit.html#gad598c0723910b60871b2154ec31e0980">00047</a> function <a class="code" href="group__appkit.html#gad598c0723910b60871b2154ec31e0980">CPPointCreateCopy</a>(aPoint)
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049     <span class="keywordflow">return</span> { x: aPoint.x, y: aPoint.y };
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00059"></a><a class="code" href="group__appkit.html#gabbd24c413b418848a07ac0ce30db3f8d">00059</a> function <a class="code" href="group__appkit.html#gabbd24c413b418848a07ac0ce30db3f8d">CPPointMake</a>(x, y)
<a name="l00060"></a>00060 {
<a name="l00061"></a>00061     <span class="keywordflow">return</span> { x: x, y: y };
<a name="l00062"></a>00062 }
<a name="l00063"></a>00063 
<a name="l00071"></a><a class="code" href="group__appkit.html#ga735dd5c3fb0f772f423562a82ef1e131">00071</a> function <a class="code" href="group__appkit.html#ga735dd5c3fb0f772f423562a82ef1e131">CPRectInset</a>(aRect, dX, dY)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#ga14b3a32dc5a4198a67fd5cfd8c69bed5">CPRectMake</a>(  aRect.origin.x + dX, aRect.origin.y + dY, 
<a name="l00074"></a>00074                         aRect.size.width - 2 * dX, aRect.size.height - 2*dY);
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00083"></a><a class="code" href="group__appkit.html#gae01afc68cdf68696650779a56efd754c">00083</a> function <a class="code" href="group__appkit.html#gae01afc68cdf68696650779a56efd754c">CPRectIntegral</a>(aRect)
<a name="l00084"></a>00084 {
<a name="l00085"></a>00085     <span class="comment">// FIXME!!!</span>
<a name="l00086"></a>00086     alert(<span class="stringliteral">&quot;CPRectIntegral unimplemented&quot;</span>);
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00096"></a><a class="code" href="group__appkit.html#gac51bd3173e24d234bb2ce4ee60615d0f">00096</a> function <a class="code" href="group__appkit.html#gac51bd3173e24d234bb2ce4ee60615d0f">CPRectIntersection</a>(lhsRect, rhsRect)
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098     var intersection = <a class="code" href="group__appkit.html#ga14b3a32dc5a4198a67fd5cfd8c69bed5">CPRectMake</a>(
<a name="l00099"></a>00099         Math.max(<a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">CPRectGetMinX</a>(lhsRect), <a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">CPRectGetMinX</a>(rhsRect)), 
<a name="l00100"></a>00100         Math.max(<a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">CPRectGetMinY</a>(lhsRect), <a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">CPRectGetMinY</a>(rhsRect)), 
<a name="l00101"></a>00101         0, 0);
<a name="l00102"></a>00102     
<a name="l00103"></a>00103     intersection.size.width = Math.min(<a class="code" href="group__appkit.html#ga645da772bf356a2f09233ac80ffa457d">CPRectGetMaxX</a>(lhsRect), <a class="code" href="group__appkit.html#ga645da772bf356a2f09233ac80ffa457d">CPRectGetMaxX</a>(rhsRect)) - <a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">CPRectGetMinX</a>(intersection);
<a name="l00104"></a>00104     intersection.size.height = Math.min(<a class="code" href="group__appkit.html#gab79c376cdca5dc4138f85d442552fd64">CPRectGetMaxY</a>(lhsRect), <a class="code" href="group__appkit.html#gab79c376cdca5dc4138f85d442552fd64">CPRectGetMaxY</a>(rhsRect)) - <a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">CPRectGetMinY</a>(intersection);
<a name="l00105"></a>00105     
<a name="l00106"></a>00106     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#ga67a67f40f32145ca466a66dce1886c79">CPRectIsEmpty</a>(intersection) ? <a class="code" href="group__appkit.html#gaaa40d5e6c0fb3846d0e6c54e5bd61c22">CPRectMakeZero</a>() : intersection;
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 
<a name="l00115"></a><a class="code" href="group__appkit.html#ga853e1640c6b7e5608c3f153b55ee6a0d">00115</a> function <a class="code" href="group__appkit.html#ga853e1640c6b7e5608c3f153b55ee6a0d">CPRectCreateCopy</a>(aRect)
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117     <span class="keywordflow">return</span> { origin: <a class="code" href="group__appkit.html#gad598c0723910b60871b2154ec31e0980">CPPointCreateCopy</a>(aRect.origin), <a class="code" href="_c_p_screen_8j.html#ad241596b0d0f8cbdd1529d94ea71337b">size</a>: <a class="code" href="group__appkit.html#gacc725419a297a72093c0cc6ec0c20fa6">CPSizeCreateCopy</a>(aRect.size) };
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119 
<a name="l00129"></a><a class="code" href="group__appkit.html#ga14b3a32dc5a4198a67fd5cfd8c69bed5">00129</a> function <a class="code" href="group__appkit.html#ga14b3a32dc5a4198a67fd5cfd8c69bed5">CPRectMake</a>(x, y, <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="l00130"></a>00130 {
<a name="l00131"></a>00131     <span class="keywordflow">return</span> { origin: <a class="code" href="group__appkit.html#gabbd24c413b418848a07ac0ce30db3f8d">CPPointMake</a>(x, y), <a class="code" href="_c_p_screen_8j.html#ad241596b0d0f8cbdd1529d94ea71337b">size</a>: <a class="code" href="group__appkit.html#gaf2c52024bde426528d77ac7848519ed3">CPSizeMake</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="l00132"></a>00132 }
<a name="l00133"></a>00133 
<a name="l00142"></a><a class="code" href="group__appkit.html#gaf481a1738c26fb572ed66c09c53619b9">00142</a> function <a class="code" href="group__appkit.html#gaf481a1738c26fb572ed66c09c53619b9">CPRectOffset</a>(aRect, dX, dY)
<a name="l00143"></a>00143 {
<a name="l00144"></a>00144     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#ga14b3a32dc5a4198a67fd5cfd8c69bed5">CPRectMake</a>(aRect.origin.x + dX, aRect.origin.y + dY, aRect.size.width, aRect.size.height);
<a name="l00145"></a>00145 }
<a name="l00146"></a>00146 
<a name="l00152"></a><a class="code" href="group__appkit.html#ga6e223a150b33676f9a2c7fc40243e95a">00152</a> function <a class="code" href="group__appkit.html#ga6e223a150b33676f9a2c7fc40243e95a">CPRectStandardize</a>(aRect)
<a name="l00153"></a>00153 {
<a name="l00154"></a>00154     var <a class="code" href="_c_p_segmented_control_8j.html#a2474a5474cbff19523a51eb1de01cda4">width</a> = <a class="code" href="group__appkit.html#gac738eacca8c3bbca75b376494856324f">CPRectGetWidth</a>(aRect),
<a name="l00155"></a>00155         <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a> = <a class="code" href="group__appkit.html#gaac7f924224ace818f859197c492ba592">CPRectGetHeight</a>(aRect),
<a name="l00156"></a>00156         standardized = <a class="code" href="group__appkit.html#ga853e1640c6b7e5608c3f153b55ee6a0d">CPRectCreateCopy</a>(aRect);
<a name="l00157"></a>00157 
<a name="l00158"></a>00158     <span class="keywordflow">if</span> (width &lt; 0.0)
<a name="l00159"></a>00159     {
<a name="l00160"></a>00160         standardized.origin.x += width;
<a name="l00161"></a>00161         standardized.size.width = -width;
<a name="l00162"></a>00162     }
<a name="l00163"></a>00163     
<a name="l00164"></a>00164     <span class="keywordflow">if</span> (<a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a> &lt; 0.0)
<a name="l00165"></a>00165     {
<a name="l00166"></a>00166         standardized.origin.y += <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>;
<a name="l00167"></a>00167         standardized.size.height = -<a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>;
<a name="l00168"></a>00168     }
<a name="l00169"></a>00169     
<a name="l00170"></a>00170     <span class="keywordflow">return</span> standardized;
<a name="l00171"></a>00171 }
<a name="l00172"></a>00172 
<a name="l00180"></a><a class="code" href="group__appkit.html#gaa6c1cf8e052c8602acb31fad68ea9bac">00180</a> function <a class="code" href="group__appkit.html#gaa6c1cf8e052c8602acb31fad68ea9bac">CPRectUnion</a>(lhsRect, rhsRect)
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182     var minX = Math.min(<a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">CPRectGetMinX</a>(lhsRect), <a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">CPRectGetMinX</a>(rhsRect)),
<a name="l00183"></a>00183         minY = Math.min(<a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">CPRectGetMinY</a>(lhsRect), <a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">CPRectGetMinY</a>(rhsRect)),
<a name="l00184"></a>00184         maxX = Math.max(<a class="code" href="group__appkit.html#ga645da772bf356a2f09233ac80ffa457d">CPRectGetMaxX</a>(lhsRect), <a class="code" href="group__appkit.html#ga645da772bf356a2f09233ac80ffa457d">CPRectGetMaxX</a>(rhsRect)),
<a name="l00185"></a>00185         maxY = Math.max(<a class="code" href="group__appkit.html#gab79c376cdca5dc4138f85d442552fd64">CPRectGetMaxY</a>(lhsRect), <a class="code" href="group__appkit.html#gab79c376cdca5dc4138f85d442552fd64">CPRectGetMaxY</a>(rhsRect));
<a name="l00186"></a>00186     
<a name="l00187"></a>00187     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#ga14b3a32dc5a4198a67fd5cfd8c69bed5">CPRectMake</a>(minX, minY, maxX - minX, maxY - minY);
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00196"></a><a class="code" href="group__appkit.html#gacc725419a297a72093c0cc6ec0c20fa6">00196</a> function <a class="code" href="group__appkit.html#gacc725419a297a72093c0cc6ec0c20fa6">CPSizeCreateCopy</a>(aSize)
<a name="l00197"></a>00197 {
<a name="l00198"></a>00198     <span class="keywordflow">return</span> { <a class="code" href="_c_p_segmented_control_8j.html#a2474a5474cbff19523a51eb1de01cda4">width</a>: aSize.width, <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>: aSize.height };
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 
<a name="l00208"></a><a class="code" href="group__appkit.html#gaf2c52024bde426528d77ac7848519ed3">00208</a> function <a class="code" href="group__appkit.html#gaf2c52024bde426528d77ac7848519ed3">CPSizeMake</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="l00209"></a>00209 {
<a name="l00210"></a>00210     <span class="keywordflow">return</span> { <a class="code" href="_c_p_segmented_control_8j.html#a2474a5474cbff19523a51eb1de01cda4">width</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 class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a> };
<a name="l00211"></a>00211 }
<a name="l00212"></a>00212 
<a name="l00221"></a><a class="code" href="group__appkit.html#ga61d5dffb2dbefeb127f9f1d4ae742cf8">00221</a> function <a class="code" href="group__appkit.html#ga61d5dffb2dbefeb127f9f1d4ae742cf8">CPRectContainsPoint</a>(aRect, aPoint)
<a name="l00222"></a>00222 {
<a name="l00223"></a>00223     <span class="keywordflow">return</span>  aPoint.x &gt;= <a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">CPRectGetMinX</a>(aRect) &amp;&amp;
<a name="l00224"></a>00224             aPoint.y &gt;= <a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">CPRectGetMinY</a>(aRect) &amp;&amp;
<a name="l00225"></a>00225                         aPoint.x &lt; <a class="code" href="group__appkit.html#ga645da772bf356a2f09233ac80ffa457d">CPRectGetMaxX</a>(aRect) &amp;&amp;
<a name="l00226"></a>00226                         aPoint.y &lt; <a class="code" href="group__appkit.html#gab79c376cdca5dc4138f85d442552fd64">CPRectGetMaxY</a>(aRect);
<a name="l00227"></a>00227 }
<a name="l00228"></a>00228 
<a name="l00237"></a><a class="code" href="group__appkit.html#gab8a28571d4942fac6b058efce8f61ba4">00237</a> function <a class="code" href="group__appkit.html#gab8a28571d4942fac6b058efce8f61ba4">CPRectContainsRect</a>(possibleOuter, possibleInner)
<a name="l00238"></a>00238 {
<a name="l00239"></a>00239     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#gadfb2531cda2178d0864d50184bd9d2a1">CGRectContainsRect</a>(possibleOuter, possibleInner);
<a name="l00240"></a>00240 }
<a name="l00241"></a>00241 
<a name="l00250"></a><a class="code" href="group__appkit.html#ga9686c8a85c3ea633b9b7028f977b6249">00250</a> function <a class="code" href="group__appkit.html#ga9686c8a85c3ea633b9b7028f977b6249">CPPointEqualToPoint</a>(lhsPoint, rhsPoint)
<a name="l00251"></a>00251 {
<a name="l00252"></a>00252     <span class="keywordflow">return</span> lhsPoint.x == rhsPoint.x &amp;&amp; lhsPoint.y == rhsPoint.y;
<a name="l00253"></a>00253 }
<a name="l00254"></a>00254 
<a name="l00262"></a><a class="code" href="group__appkit.html#gae655caae884233c3118468b17a832f3e">00262</a> function <a class="code" href="group__appkit.html#gae655caae884233c3118468b17a832f3e">CPRectEqualToRect</a>(lhsRect, rhsRect)
<a name="l00263"></a>00263 {
<a name="l00264"></a>00264     <span class="keywordflow">return</span>  <a class="code" href="group__appkit.html#ga9686c8a85c3ea633b9b7028f977b6249">CPPointEqualToPoint</a>(lhsRect.origin, rhsRect.origin) &amp;&amp; 
<a name="l00265"></a>00265             <a class="code" href="group__appkit.html#ga7fe8ba39fa9fc95ea90a772b90589d8e">CPSizeEqualToSize</a>(lhsRect.size, rhsRect.size);
<a name="l00266"></a>00266 }
<a name="l00267"></a>00267 
<a name="l00273"></a><a class="code" href="group__appkit.html#gaac7f924224ace818f859197c492ba592">00273</a> function <a class="code" href="group__appkit.html#gaac7f924224ace818f859197c492ba592">CPRectGetHeight</a>(aRect)
<a name="l00274"></a>00274 {
<a name="l00275"></a>00275     <span class="keywordflow">return</span> aRect.size.height;
<a name="l00276"></a>00276 }
<a name="l00277"></a>00277 
<a name="l00283"></a><a class="code" href="group__appkit.html#ga645da772bf356a2f09233ac80ffa457d">00283</a> function <a class="code" href="group__appkit.html#ga645da772bf356a2f09233ac80ffa457d">CPRectGetMaxX</a>(aRect)
<a name="l00284"></a>00284 {
<a name="l00285"></a>00285     <span class="keywordflow">return</span> aRect.origin.x + aRect.size.width;
<a name="l00286"></a>00286 }
<a name="l00287"></a>00287 
<a name="l00293"></a><a class="code" href="group__appkit.html#gab79c376cdca5dc4138f85d442552fd64">00293</a> function <a class="code" href="group__appkit.html#gab79c376cdca5dc4138f85d442552fd64">CPRectGetMaxY</a>(aRect)
<a name="l00294"></a>00294 {
<a name="l00295"></a>00295     <span class="keywordflow">return</span> aRect.origin.y + aRect.size.height;
<a name="l00296"></a>00296 }
<a name="l00297"></a>00297 
<a name="l00303"></a><a class="code" href="group__appkit.html#ga62be494ecf7e11ff1e6f7a1d4c9ca543">00303</a> function <a class="code" href="group__appkit.html#ga62be494ecf7e11ff1e6f7a1d4c9ca543">CPRectGetMidX</a>(aRect)
<a name="l00304"></a>00304 {
<a name="l00305"></a>00305     <span class="keywordflow">return</span> aRect.origin.x + (aRect.size.width) / 2.0;
<a name="l00306"></a>00306 }
<a name="l00307"></a>00307 
<a name="l00313"></a><a class="code" href="group__appkit.html#ga5cc62ad408c515e0e92a895c812bb95c">00313</a> function <a class="code" href="group__appkit.html#ga5cc62ad408c515e0e92a895c812bb95c">CPRectGetMidY</a>(aRect)
<a name="l00314"></a>00314 {
<a name="l00315"></a>00315     <span class="keywordflow">return</span> aRect.origin.y + (aRect.size.height) / 2.0;
<a name="l00316"></a>00316 }
<a name="l00317"></a>00317 
<a name="l00323"></a><a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">00323</a> function <a class="code" href="group__appkit.html#gae552202f612db721139187b6dd9a7ad5">CPRectGetMinX</a>(aRect)
<a name="l00324"></a>00324 {
<a name="l00325"></a>00325     <span class="keywordflow">return</span> aRect.origin.x;
<a name="l00326"></a>00326 }
<a name="l00327"></a>00327 
<a name="l00333"></a><a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">00333</a> function <a class="code" href="group__appkit.html#ga26fef021e85583eba5c270a2bcdb18e2">CPRectGetMinY</a>(aRect)
<a name="l00334"></a>00334 {
<a name="l00335"></a>00335     <span class="keywordflow">return</span> aRect.origin.y;
<a name="l00336"></a>00336 }
<a name="l00337"></a>00337 
<a name="l00343"></a><a class="code" href="group__appkit.html#gac738eacca8c3bbca75b376494856324f">00343</a> function <a class="code" href="group__appkit.html#gac738eacca8c3bbca75b376494856324f">CPRectGetWidth</a>(aRect)
<a name="l00344"></a>00344 {
<a name="l00345"></a>00345     <span class="keywordflow">return</span> aRect.size.width;
<a name="l00346"></a>00346 }
<a name="l00347"></a>00347 
<a name="l00355"></a><a class="code" href="group__appkit.html#ga0e136ec11aaf49f33d3f0a41896de1ea">00355</a> function <a class="code" href="group__appkit.html#ga0e136ec11aaf49f33d3f0a41896de1ea">CPRectIntersectsRect</a>(lhsRect, rhsRect)
<a name="l00356"></a>00356 {
<a name="l00357"></a>00357     <span class="keywordflow">return</span> !<a class="code" href="group__appkit.html#ga67a67f40f32145ca466a66dce1886c79">CPRectIsEmpty</a>(<a class="code" href="group__appkit.html#gac51bd3173e24d234bb2ce4ee60615d0f">CPRectIntersection</a>(lhsRect, rhsRect));
<a name="l00358"></a>00358 }
<a name="l00359"></a>00359 
<a name="l00367"></a><a class="code" href="group__appkit.html#ga67a67f40f32145ca466a66dce1886c79">00367</a> function <a class="code" href="group__appkit.html#ga67a67f40f32145ca466a66dce1886c79">CPRectIsEmpty</a>(aRect)
<a name="l00368"></a>00368 {
<a name="l00369"></a>00369     <span class="keywordflow">return</span> aRect.size.width &lt;= 0.0 || aRect.size.height &lt;= 0.0;
<a name="l00370"></a>00370 }
<a name="l00371"></a>00371 
<a name="l00378"></a><a class="code" href="group__appkit.html#gafdc6edfaa213465f7b24320ea674de84">00378</a> function <a class="code" href="group__appkit.html#gafdc6edfaa213465f7b24320ea674de84">CPRectIsNull</a>(aRect)
<a name="l00379"></a>00379 {
<a name="l00380"></a>00380     <span class="keywordflow">return</span> aRect.size.width &lt;= 0.0 || aRect.size.height &lt;= 0.0;
<a name="l00381"></a>00381 }
<a name="l00382"></a>00382 
<a name="l00390"></a><a class="code" href="group__appkit.html#ga7fe8ba39fa9fc95ea90a772b90589d8e">00390</a> function <a class="code" href="group__appkit.html#ga7fe8ba39fa9fc95ea90a772b90589d8e">CPSizeEqualToSize</a>(lhsSize, rhsSize)
<a name="l00391"></a>00391 {
<a name="l00392"></a>00392     <span class="keywordflow">return</span> lhsSize.width == rhsSize.width &amp;&amp; lhsSize.height == rhsSize.height;
<a name="l00393"></a>00393 }
<a name="l00394"></a>00394 
<a name="l00401"></a><a class="code" href="group__appkit.html#ga3321ac808ad73709750ce8a832bce91b">00401</a> function <a class="code" href="group__appkit.html#ga3321ac808ad73709750ce8a832bce91b">CPStringFromPoint</a>(aPoint)
<a name="l00402"></a>00402 {
<a name="l00403"></a>00403     <span class="keywordflow">return</span> <span class="stringliteral">&quot;{&quot;</span> + aPoint.x + <span class="stringliteral">&quot;, &quot;</span> + aPoint.y + <span class="stringliteral">&quot;}&quot;</span>;
<a name="l00404"></a>00404 }
<a name="l00405"></a>00405 
<a name="l00412"></a><a class="code" href="group__appkit.html#ga82e33c8cecc10669b0e04b4777031ee0">00412</a> function <a class="code" href="group__appkit.html#ga82e33c8cecc10669b0e04b4777031ee0">CPStringFromSize</a>(aSize)
<a name="l00413"></a>00413 {
<a name="l00414"></a>00414     <span class="keywordflow">return</span> <span class="stringliteral">&quot;{&quot;</span> + aSize.width + <span class="stringliteral">&quot;, &quot;</span> + aSize.height + <span class="stringliteral">&quot;}&quot;</span>;
<a name="l00415"></a>00415 }
<a name="l00416"></a>00416 
<a name="l00423"></a><a class="code" href="group__appkit.html#ga01c72ee68d8cc785337c3309e0bf6b03">00423</a> function <a class="code" href="group__appkit.html#ga01c72ee68d8cc785337c3309e0bf6b03">CPStringFromRect</a>(aRect)
<a name="l00424"></a>00424 {
<a name="l00425"></a>00425     <span class="keywordflow">return</span> <span class="stringliteral">&quot;{&quot;</span> + <a class="code" href="group__appkit.html#ga3321ac808ad73709750ce8a832bce91b">CPStringFromPoint</a>(aRect.origin) + <span class="stringliteral">&quot;, &quot;</span> + <a class="code" href="group__appkit.html#ga82e33c8cecc10669b0e04b4777031ee0">CPStringFromSize</a>(aRect.size) + <span class="stringliteral">&quot;}&quot;</span>;
<a name="l00426"></a>00426 }
<a name="l00427"></a>00427 
<a name="l00434"></a><a class="code" href="group__appkit.html#ga0e693056c4f4db7087c72d05026c471e">00434</a> function <a class="code" href="group__appkit.html#ga0e693056c4f4db7087c72d05026c471e">CPPointFromString</a>(aString)
<a name="l00435"></a>00435 {
<a name="l00436"></a>00436     var comma = aString.indexOf(<span class="charliteral">&apos;,&apos;</span>);
<a name="l00437"></a>00437     
<a name="l00438"></a>00438     <span class="keywordflow">return</span> { x:parseFloat(aString.substr(1, comma - 1), 10), y:parseFloat(aString.substring(comma + 1, aString.length), 10) };
<a name="l00439"></a>00439 }
<a name="l00440"></a>00440 
<a name="l00447"></a><a class="code" href="group__appkit.html#gab41991de553df7b3657573f33f51e2aa">00447</a> function <a class="code" href="group__appkit.html#gab41991de553df7b3657573f33f51e2aa">CPSizeFromString</a>(aString)
<a name="l00448"></a>00448 {
<a name="l00449"></a>00449     var comma = aString.indexOf(<span class="charliteral">&apos;,&apos;</span>);
<a name="l00450"></a>00450     
<a name="l00451"></a>00451     <span class="keywordflow">return</span> { <a class="code" href="_c_p_segmented_control_8j.html#a2474a5474cbff19523a51eb1de01cda4">width</a>:parseFloat(aString.substr(1, comma - 1), 10), <a class="code" href="_c_p_screen_8j.html#a4540395d130d8a367becfe06b659b9f1">height</a>:parseFloat(aString.substring(comma + 1, aString.length), 10) };
<a name="l00452"></a>00452 }
<a name="l00453"></a>00453 
<a name="l00460"></a><a class="code" href="group__appkit.html#ga0ee9a6225f6a5c8fddd60016d7274a19">00460</a> function <a class="code" href="group__appkit.html#ga0ee9a6225f6a5c8fddd60016d7274a19">CPRectFromString</a>(aString)
<a name="l00461"></a>00461 {
<a name="l00462"></a>00462     var comma = aString.indexOf(<span class="charliteral">&apos;,&apos;</span>, aString.indexOf(<span class="charliteral">&apos;,&apos;</span>) + 1);
<a name="l00463"></a>00463     
<a name="l00464"></a>00464     <span class="keywordflow">return</span> { origin:<a class="code" href="group__appkit.html#ga0e693056c4f4db7087c72d05026c471e">CPPointFromString</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#gab41991de553df7b3657573f33f51e2aa">CPSizeFromString</a>(aString.substring(comma + 2, aString.length)) };
<a name="l00465"></a>00465 }
<a name="l00466"></a>00466 
<a name="l00472"></a><a class="code" href="group__appkit.html#gaa819a6da9ac1c00ad174872c2d629143">00472</a> function <a class="code" href="group__appkit.html#gaa819a6da9ac1c00ad174872c2d629143">CPPointFromEvent</a>(anEvent)
<a name="l00473"></a>00473 {
<a name="l00474"></a>00474     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#gabbd24c413b418848a07ac0ce30db3f8d">CPPointMake</a>(anEvent.clientX, anEvent.clientY, 0);
<a name="l00475"></a>00475 }
<a name="l00476"></a>00476 
<a name="l00482"></a><a class="code" href="group__appkit.html#gac383eb8e79a2476c947c533d3205fc9a">00482</a> function <a class="code" href="group__appkit.html#gac383eb8e79a2476c947c533d3205fc9a">CPSizeMakeZero</a>()
<a name="l00483"></a>00483 {
<a name="l00484"></a>00484     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#gaf2c52024bde426528d77ac7848519ed3">CPSizeMake</a>(0, 0);
<a name="l00485"></a>00485 }
<a name="l00486"></a>00486 
<a name="l00492"></a><a class="code" href="group__appkit.html#gaaa40d5e6c0fb3846d0e6c54e5bd61c22">00492</a> function <a class="code" href="group__appkit.html#gaaa40d5e6c0fb3846d0e6c54e5bd61c22">CPRectMakeZero</a>()
<a name="l00493"></a>00493 {
<a name="l00494"></a>00494     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#ga14b3a32dc5a4198a67fd5cfd8c69bed5">CPRectMake</a>(0, 0, 0, 0);
<a name="l00495"></a>00495 }
<a name="l00496"></a>00496 
<a name="l00502"></a><a class="code" href="group__appkit.html#gaf966bac39815f4926c5e7dcf7bf4c67c">00502</a> function <a class="code" href="group__appkit.html#gaf966bac39815f4926c5e7dcf7bf4c67c">CPPointMakeZero</a>()
<a name="l00503"></a>00503 {
<a name="l00504"></a>00504     <span class="keywordflow">return</span> <a class="code" href="group__appkit.html#gabbd24c413b418848a07ac0ce30db3f8d">CPPointMake</a>(0, 0, 0);
<a name="l00505"></a>00505 }
<a name="l00506"></a>00506 
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Tue Apr 6 10:32:55 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_p_geometry_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:28 GMT -->
</html>