Source

cappuccino-docs / cappuccino docs / cappuccino.org / learn / documentation / _c_g_affine_transform_8h_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_affine_transform_8h_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:42 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Cappuccino API: AppKit/CoreGraphics/CGAffineTransform.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="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/CGAffineTransform.h</h1><a href="_c_g_affine_transform_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * CGAffineTransform.h</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 _CGAffineTransformMake(a_, b_, c_, d_, tx_, ty_) { a:a_, b:b_, c:c_, d:d_, tx:tx_, ty:ty_ }</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define _CGAffineTransformMakeIdentity() _CGAffineTransformMake(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define _CGAffineTransformMakeCopy(aTransform) _CGAffineTransformMake(aTransform.a, aTransform.b, aTransform.c, aTransform.d, aTransform.tx, aTransform.ty)</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="preprocessor">#define _CGAffineTransformMakeScale(sx, sy) _CGAffineTransformMake(sx, 0.0, 0.0, sy, 0.0, 0.0)</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define _CGAffineTransformMakeTranslation(tx, ty) _CGAffineTransformMake(1.0, 0.0, 0.0, 1.0, tx, ty)</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
<a name="l00032"></a>00032 <span class="preprocessor">#define _CGAffineTransformTranslate(aTransform, tx, ty) _CGAffineTransformMake(aTransform.a, aTransform.b, aTransform.c, aTransform.d, aTransform.tx + aTransform.a * tx + aTransform.c * ty, aTransform.ty + aTransform.b * tx + aTransform.d * ty)</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define _CGAffineTransformScale(aTransform, sx, sy) _CGAffineTransformMake(aTransform.a * sx, aTransform.b * sx, aTransform.c * sy, aTransform.d * sy, aTransform.tx, aTransform.ty)</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>
<a name="l00035"></a>00035 <span class="preprocessor">#define _CGAffineTransformConcat(lhs, rhs) _CGAffineTransformMake(lhs.a * rhs.a + lhs.b * rhs.c, lhs.a * rhs.b + lhs.b * rhs.d, lhs.c * rhs.a + lhs.d * rhs.c, lhs.c * rhs.b + lhs.d * rhs.d, lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx, lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty)</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#define _CGPointApplyAffineTransform(aPoint, aTransform) _CGPointMake(aPoint.x * aTransform.a + aPoint.y * aTransform.c + aTransform.tx, aPoint.x * aTransform.b + aPoint.y * aTransform.d + aTransform.ty)</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#define _CGSizeApplyAffineTransform(aSize, aTransform) _CGSizeMake(aSize.width * aTransform.a + aSize.height * aTransform.c, aSize.width * aTransform.b + aSize.height * aTransform.d)</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define _CGRectApplyAffineTransform(aRect, aTransform) { origin:_CGPointApplyAffineTransform(aRect.origin, aTransform), size:_CGSizeApplyAffineTransform(aRect.size, aTransform) }</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#define _CGAffineTransformIsIdentity(aTransform) (aTransform.a == 1 &amp;&amp; aTransform.b == 0 &amp;&amp; aTransform.c == 0 &amp;&amp; aTransform.d == 1 &amp;&amp; aTransform.tx == 0 &amp;&amp; aTransform.ty == 0)</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define _CGAffineTransformEqualToTransform(lhs, rhs) (lhs.a == rhs.a &amp;&amp; lhs.b == rhs.b &amp;&amp; lhs.c == rhs.c &amp;&amp; lhs.d == rhs.d &amp;&amp; lhs.tx == rhs.tx &amp;&amp; lhs.ty == rhs.ty)</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="preprocessor">#define _CGStringCreateWithCGAffineTransform(aTransform) (&quot; [[ &quot; + aTransform.a + &quot;, &quot; + aTransform.b + &quot;, 0 ], [ &quot; + aTransform.c + &quot;, &quot; + aTransform.d + &quot;, 0 ], [ &quot; + aTransform.tx + &quot;, &quot; + aTransform.ty + &quot;, 1]]&quot;)</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046 <span class="preprocessor">#define _CGAffineTransformConcatTo(lhs, rhs, to) \</span>
<a name="l00047"></a>00047 <span class="preprocessor">var tx = lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx;\</span>
<a name="l00048"></a>00048 <span class="preprocessor">to.ty = lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty;\</span>
<a name="l00049"></a>00049 <span class="preprocessor">to.tx = tx;\</span>
<a name="l00050"></a>00050 <span class="preprocessor">var a = lhs.a * rhs.a + lhs.b * rhs.c,\</span>
<a name="l00051"></a>00051 <span class="preprocessor">    b = lhs.a * rhs.b + lhs.b * rhs.d,\</span>
<a name="l00052"></a>00052 <span class="preprocessor">    c = lhs.c * rhs.a + lhs.d * rhs.c;\</span>
<a name="l00053"></a>00053 <span class="preprocessor">to.d = lhs.c * rhs.b + lhs.d * rhs.d;\</span>
<a name="l00054"></a>00054 <span class="preprocessor">to.a = a;\</span>
<a name="l00055"></a>00055 <span class="preprocessor">to.b = b;\</span>
<a name="l00056"></a>00056 <span class="preprocessor">to.c = c;\</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="comment">/*</span>
<a name="l00059"></a>00059 <span class="comment">a  b  0 cos sin 0</span>
<a name="l00060"></a>00060 <span class="comment">c  d  0 -sin cos 0</span>
<a name="l00061"></a>00061 <span class="comment">tx ty 1 0 0 1</span>
<a name="l00062"></a>00062 <span class="comment">*/</span>
</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_affine_transform_8h_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:42 GMT -->
</html>