1. Stewart Mackenzie
  2. cappuccino-docs

Source

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

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<!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_context_canvas_8j_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/CGContextCanvas.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/CGContextCanvas.j</h1><a href="_c_g_context_canvas_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"> * CGContextCanvas.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><a class="code" href="_c_g_context_canvas_8j.html#acef6e7cad9745277275c1a8b41b83dde">00023</a> var <a class="code" href="_c_g_context_canvas_8j.html#acef6e7cad9745277275c1a8b41b83dde">CANVAS_LINECAP_TABLE</a>    = [ <span class="stringliteral">&quot;butt&quot;</span>, <span class="stringliteral">&quot;round&quot;</span>, <span class="stringliteral">&quot;square&quot;</span> ],
<a name="l00024"></a><a class="code" href="_c_g_context_canvas_8j.html#a165af8e7c37b4daa35aaf0f76542e341">00024</a>     <a class="code" href="_c_g_context_canvas_8j.html#a165af8e7c37b4daa35aaf0f76542e341">CANVAS_LINEJOIN_TABLE</a>   = [ <span class="stringliteral">&quot;miter&quot;</span>, <span class="stringliteral">&quot;round&quot;</span>, <span class="stringliteral">&quot;bevel&quot;</span> ],
<a name="l00025"></a><a class="code" href="_c_g_context_canvas_8j.html#aa4673b68d2bcfd587f01f738f5eb19b4">00025</a>     <a class="code" href="_c_g_context_canvas_8j.html#aa4673b68d2bcfd587f01f738f5eb19b4">CANVAS_COMPOSITE_TABLE</a>  = [ <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;darker&quot;</span>, 
<a name="l00026"></a>00026                                 <span class="stringliteral">&quot;lighter&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, 
<a name="l00027"></a>00027                                 <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, 
<a name="l00028"></a>00028                                 <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, 
<a name="l00029"></a>00029                                 <span class="stringliteral">&quot;copy&quot;</span>, <span class="stringliteral">&quot;source-in&quot;</span>, <span class="stringliteral">&quot;source-out&quot;</span>, <span class="stringliteral">&quot;source-atop&quot;</span>, 
<a name="l00030"></a>00030                                 <span class="stringliteral">&quot;destination-over&quot;</span>, <span class="stringliteral">&quot;destination-in&quot;</span>, <span class="stringliteral">&quot;destination-out&quot;</span>, <span class="stringliteral">&quot;destination-atop&quot;</span>, 
<a name="l00031"></a>00031                                 <span class="stringliteral">&quot;xor&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span>, <span class="stringliteral">&quot;source-over&quot;</span> ];
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="preprocessor">#define _CGContextAddArcCanvas(aContext, x, y, radius, startAngle, endAngle, anticlockwise) aContext.arc(x, y, radius, startAngle, endAngle, anticlockwise)</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextAddArcToPointCanvas(aContext, x1, y1, x2, y2, radius) aContext.arcTo(x1, y1, x2, y2, radius)</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextAddCurveToPointCanvas(aContext, cp1x, cp1y, cp2x, cp2y, x, y) aContext.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextAddQuadCurveToPointCanvas(aContext, cpx, cpy, x, y) aContext.quadraticCurveTo(cpx, cpy, x, y)</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextAddLineToPointCanvas(aContext, x, y) aContext.lineTo(x, y)</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextClosePathCanvas(aContext) aContext.closePath()</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextMoveToPointCanvas(aContext, x, y) aContext.moveTo(x, y)</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#define _CGContextAddRectCanvas(aContext, aRect) aContext.rect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect))</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextBeginPathCanvas(aContext) aContext.beginPath()</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextFillRectCanvas(aContext, aRect) aContext.fillRect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect))</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define _CGContextClipCanvas(aContext) aContext.clip()</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a><a class="code" href="_c_g_context_canvas_8j.html#a3044141e2efee5c87c2d2cf7a034442d">00046</a> function <a class="code" href="group__coregraphics.html#ga3044141e2efee5c87c2d2cf7a034442d">CGContextSaveGState</a>(aContext)
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048     aContext.save();
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="_c_g_context_canvas_8j.html#a017455e56ea37b37ba671c0443764576">00051</a> function <a class="code" href="group__coregraphics.html#ga017455e56ea37b37ba671c0443764576">CGContextRestoreGState</a>(aContext)
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053     aContext.restore();
<a name="l00054"></a>00054 }
<a name="l00055"></a>00055 
<a name="l00056"></a><a class="code" href="_c_g_context_canvas_8j.html#a27478973daa43b1ba32a37dad435549b">00056</a> function <a class="code" href="group__coregraphics.html#ga27478973daa43b1ba32a37dad435549b">CGContextSetLineCap</a>(aContext, aLineCap)
<a name="l00057"></a>00057 {
<a name="l00058"></a>00058     aContext.lineCap = <a class="code" href="_c_g_context_canvas_8j.html#acef6e7cad9745277275c1a8b41b83dde">CANVAS_LINECAP_TABLE</a>[aLineCap];
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 
<a name="l00061"></a><a class="code" href="_c_g_context_canvas_8j.html#ad212e3fb640ac5f830477b13197585b3">00061</a> function <a class="code" href="group__coregraphics.html#gad212e3fb640ac5f830477b13197585b3">CGContextSetLineJoin</a>(aContext, aLineJoin)
<a name="l00062"></a>00062 {
<a name="l00063"></a>00063     aContext.lineJoin = <a class="code" href="_c_g_context_canvas_8j.html#a165af8e7c37b4daa35aaf0f76542e341">CANVAS_LINEJOIN_TABLE</a>[aLineJoin];
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065 
<a name="l00066"></a><a class="code" href="_c_g_context_canvas_8j.html#a96bba0be21dd53a15a84c8f23eb7cc70">00066</a> function <a class="code" href="group__coregraphics.html#ga96bba0be21dd53a15a84c8f23eb7cc70">CGContextSetLineWidth</a>(aContext, aLineWidth)
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068     aContext.lineWidth = aLineWidth;
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070 
<a name="l00071"></a><a class="code" href="_c_g_context_canvas_8j.html#a472ae3ee4dce3d163b9ff53a4bcc1a23">00071</a> function <a class="code" href="group__coregraphics.html#ga472ae3ee4dce3d163b9ff53a4bcc1a23">CGContextSetMiterLimit</a>(aContext, aMiterLimit)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073     aContext.miterLimit = aMiterLimit;
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 
<a name="l00076"></a><a class="code" href="_c_g_context_canvas_8j.html#a565e47763ab20231c4c911586936146f">00076</a> function <a class="code" href="group__coregraphics.html#ga565e47763ab20231c4c911586936146f">CGContextSetBlendMode</a>(aContext, aBlendMode)
<a name="l00077"></a>00077 {
<a name="l00078"></a>00078     aContext.globalCompositeOperation = <a class="code" href="_c_g_context_canvas_8j.html#aa4673b68d2bcfd587f01f738f5eb19b4">CANVAS_COMPOSITE_TABLE</a>[aBlendMode];
<a name="l00079"></a>00079 }
<a name="l00080"></a>00080 
<a name="l00081"></a><a class="code" href="_c_g_context_canvas_8j.html#ac3f1c96dd9247e1ebc30d89b1b2acf13">00081</a> function <a class="code" href="group__coregraphics.html#gac3f1c96dd9247e1ebc30d89b1b2acf13">CGContextAddArc</a>(aContext, x, y, radius, startAngle, endAngle, clockwise)
<a name="l00082"></a>00082 {
<a name="l00083"></a>00083     <span class="comment">// Despite the documentation saying otherwise, the last parameter is anti-clockwise not clockwise.</span>
<a name="l00084"></a>00084     <span class="comment">// http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes#Arcs</span>
<a name="l00085"></a>00085     _CGContextAddArcCanvas(aContext, x, y, radius, startAngle, endAngle, !clockwise);
<a name="l00086"></a>00086 }
<a name="l00087"></a>00087 
<a name="l00088"></a><a class="code" href="_c_g_context_canvas_8j.html#a917be14f02e018002bc478dda09d1db8">00088</a> function <a class="code" href="group__coregraphics.html#ga917be14f02e018002bc478dda09d1db8">CGContextAddArcToPoint</a>(aContext, x1, y1, x2, y2, radius)
<a name="l00089"></a>00089 {
<a name="l00090"></a>00090     _CGContextAddArcToPointCanvas(aContext, x1, y1, x2, y2, radius);
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092 
<a name="l00093"></a><a class="code" href="_c_g_context_canvas_8j.html#a4d0b41532294635e2f412038f5a1b4e1">00093</a> function <a class="code" href="group__coregraphics.html#ga4d0b41532294635e2f412038f5a1b4e1">CGContextAddCurveToPoint</a>(aContext, cp1x, cp1y, cp2x, cp2y, x, y)
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095     _CGContextAddCurveToPointCanvas(aContext, cp1x, cp1y, cp2x, cp2y, x, y);
<a name="l00096"></a>00096 }
<a name="l00097"></a>00097 
<a name="l00098"></a><a class="code" href="_c_g_context_canvas_8j.html#a834b9d5848989453730d162f251a29c3">00098</a> function <a class="code" href="group__coregraphics.html#ga834b9d5848989453730d162f251a29c3">CGContextAddLineToPoint</a>(aContext, x, y)
<a name="l00099"></a>00099 {
<a name="l00100"></a>00100     _CGContextAddLineToPointCanvas(aContext, x, y);
<a name="l00101"></a>00101 }
<a name="l00102"></a>00102 
<a name="l00103"></a><a class="code" href="_c_g_context_canvas_8j.html#a9076c7c9efcc889fa980c49028fca6b8">00103</a> function <a class="code" href="group__coregraphics.html#ga9076c7c9efcc889fa980c49028fca6b8">CGContextAddPath</a>(aContext, aPath)
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105     <span class="keywordflow">if</span> (!aContext || <a class="code" href="group__coregraphics.html#ga75236063f073e7f232d97c103185f170">CGPathIsEmpty</a>(aPath))
<a name="l00106"></a>00106         <span class="keywordflow">return</span>;
<a name="l00107"></a>00107 
<a name="l00108"></a>00108     var elements = aPath.elements,
<a name="l00109"></a>00109         
<a name="l00110"></a>00110         i = 0,
<a name="l00111"></a>00111         count = aPath.count;
<a name="l00112"></a>00112     
<a name="l00113"></a>00113     <span class="keywordflow">for</span> (; i &lt; count; ++i)
<a name="l00114"></a>00114     {
<a name="l00115"></a>00115         var element = elements[i],
<a name="l00116"></a>00116             type = element.type;
<a name="l00117"></a>00117             
<a name="l00118"></a>00118         <span class="keywordflow">switch</span> (type)
<a name="l00119"></a>00119         {
<a name="l00120"></a>00120             <span class="keywordflow">case</span> <a class="code" href="_c_g_path_8j.html#afde27cddf02b40ea4c4a369736f4ddf4">kCGPathElementMoveToPoint</a>:         _CGContextMoveToPointCanvas(aContext, element.x, element.y);
<a name="l00121"></a>00121                                                     <span class="keywordflow">break</span>;
<a name="l00122"></a>00122             <span class="keywordflow">case</span> <a class="code" href="_c_g_path_8j.html#affb51bdb84af3fe68af46b6748807536">kCGPathElementAddLineToPoint</a>:      _CGContextAddLineToPointCanvas(aContext, element.x, element.y);
<a name="l00123"></a>00123                                                     <span class="keywordflow">break</span>;
<a name="l00124"></a>00124             <span class="keywordflow">case</span> <a class="code" href="_c_g_path_8j.html#a1e5ece1061fac8a78fa62f5f96958e3b">kCGPathElementAddQuadCurveToPoint</a>: _CGContextAddQuadCurveToPointCanvas(aContext, element.cpx, element.cpy, element.x, element.y);
<a name="l00125"></a>00125                                                     <span class="keywordflow">break</span>;
<a name="l00126"></a>00126             <span class="keywordflow">case</span> <a class="code" href="_c_g_path_8j.html#a17aac2a8e9d2d2b6182d1a23e7bf41eb">kCGPathElementAddCurveToPoint</a>:     _CGContextAddCurveToPointCanvas(aContext, element.cp1x, element.cp1y, element.cp2x, element.cp2y, element.x, element.y);
<a name="l00127"></a>00127                                                     <span class="keywordflow">break</span>;
<a name="l00128"></a>00128             <span class="keywordflow">case</span> <a class="code" href="_c_g_path_8j.html#afd9cd245b331cd15188c7b3e319c4b86">kCGPathElementCloseSubpath</a>:        _CGContextClosePathCanvas(aContext);
<a name="l00129"></a>00129                                                     <span class="keywordflow">break</span>;
<a name="l00130"></a>00130             <span class="keywordflow">case</span> <a class="code" href="_c_g_path_8j.html#ac1c2ae20f02a2d793033cead62938432">kCGPathElementAddArc</a>:              _CGContextAddArcCanvas(aContext, element.x, element.y, element.radius, element.startAngle, element.endAngle, element.clockwise);
<a name="l00131"></a>00131                                                     <span class="keywordflow">break</span>;
<a name="l00132"></a>00132             <span class="keywordflow">case</span> kCGPathElementAddArcTo:            <span class="comment">//_CGContextAddArcToPointCanvas(aContext, element.cp1x, element.cp1.y, element.cp2.x, element.cp2y, element.radius);</span>
<a name="l00133"></a>00133                                                     <span class="keywordflow">break</span>;
<a name="l00134"></a>00134         }
<a name="l00135"></a>00135     }
<a name="l00136"></a>00136 }
<a name="l00137"></a>00137 
<a name="l00138"></a><a class="code" href="_c_g_context_canvas_8j.html#a63142912cf5a80c8c72c29d55cd7f730">00138</a> function <a class="code" href="group__coregraphics.html#ga63142912cf5a80c8c72c29d55cd7f730">CGContextAddRect</a>(aContext, aRect)
<a name="l00139"></a>00139 {
<a name="l00140"></a>00140     _CGContextAddRectCanvas(aContext, aRect);
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142 
<a name="l00143"></a><a class="code" href="_c_g_context_canvas_8j.html#a9e2deb0c9030f957dbf60a759c8b89bf">00143</a> function <a class="code" href="group__coregraphics.html#ga9e2deb0c9030f957dbf60a759c8b89bf">CGContextAddRects</a>(aContext, rects, count)
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145     var i = 0;
<a name="l00146"></a>00146     
<a name="l00147"></a>00147     <span class="keywordflow">if</span> (arguments[<span class="stringliteral">&quot;count&quot;</span>] == NULL)
<a name="l00148"></a>00148         var count = rects.length;
<a name="l00149"></a>00149     
<a name="l00150"></a>00150     <span class="keywordflow">for</span> (; i &lt; count; ++i)
<a name="l00151"></a>00151     {
<a name="l00152"></a>00152         var rect = rects[i];
<a name="l00153"></a>00153         _CGContextAddRectCanvas(aContext, rect);
<a name="l00154"></a>00154     }
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 
<a name="l00157"></a><a class="code" href="_c_g_context_canvas_8j.html#a02cca9368e5aacc0bef423d724635376">00157</a> function <a class="code" href="group__coregraphics.html#ga02cca9368e5aacc0bef423d724635376">CGContextBeginPath</a>(aContext)
<a name="l00158"></a>00158 {
<a name="l00159"></a>00159     _CGContextBeginPathCanvas(aContext);
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161 
<a name="l00162"></a><a class="code" href="_c_g_context_canvas_8j.html#aaf20d10c7501084913e6fdee367f3efa">00162</a> function <a class="code" href="group__coregraphics.html#gaaf20d10c7501084913e6fdee367f3efa">CGContextClosePath</a>(aContext)
<a name="l00163"></a>00163 {
<a name="l00164"></a>00164     _CGContextClosePathCanvas(aContext);
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166 
<a name="l00167"></a><a class="code" href="_c_g_context_canvas_8j.html#a44dc04bb1efb98ff834308c997d10dc5">00167</a> function <a class="code" href="group__coregraphics.html#ga44dc04bb1efb98ff834308c997d10dc5">CGContextMoveToPoint</a>(aContext, x, y)
<a name="l00168"></a>00168 {
<a name="l00169"></a>00169     _CGContextMoveToPointCanvas(aContext, x, y);
<a name="l00170"></a>00170 }
<a name="l00171"></a>00171 
<a name="l00172"></a><a class="code" href="_c_g_context_canvas_8j.html#ad26b22aa810370acebe12a0656b26f8d">00172</a> function <a class="code" href="_c_g_context_canvas_8j.html#ad26b22aa810370acebe12a0656b26f8d">CGContextClearRect</a>(aContext, aRect)
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174     aContext.clearRect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect));
<a name="l00175"></a>00175 }
<a name="l00176"></a>00176 
<a name="l00177"></a><a class="code" href="_c_g_context_canvas_8j.html#a50a84bacbbad420fe66e560fd51a9e53">00177</a> function <a class="code" href="_c_g_context_canvas_8j.html#a50a84bacbbad420fe66e560fd51a9e53">CGContextDrawPath</a>(aContext, aMode)
<a name="l00178"></a>00178 {
<a name="l00179"></a>00179     <span class="keywordflow">if</span> (aMode == <a class="code" href="_c_g_context_8j.html#aac8571f0496bc11265484d681934efaf">kCGPathFill</a> || aMode == <a class="code" href="_c_g_context_8j.html#ad7123ac2c8b7a7b1a22ea0037ff42d97">kCGPathFillStroke</a>)
<a name="l00180"></a>00180         aContext.fill();
<a name="l00181"></a>00181     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (aMode == <a class="code" href="_c_g_context_8j.html#acfadf8b304c6a0713f2f26ce602656a3">kCGPathEOFill</a> || aMode == <a class="code" href="_c_g_context_8j.html#ae31316ac6d9cd297bca4045260cb723c">kCGPathEOFillStroke</a>)
<a name="l00182"></a>00182         alert(<span class="stringliteral">&quot;not implemented!!!&quot;</span>);
<a name="l00183"></a>00183     
<a name="l00184"></a>00184     <span class="keywordflow">if</span> (aMode == <a class="code" href="_c_g_context_8j.html#a8a5478dd8a6263acdc0d712c7da25c57">kCGPathStroke</a> || aMode == <a class="code" href="_c_g_context_8j.html#ad7123ac2c8b7a7b1a22ea0037ff42d97">kCGPathFillStroke</a> || aMode == <a class="code" href="_c_g_context_8j.html#ae31316ac6d9cd297bca4045260cb723c">kCGPathEOFillStroke</a>)
<a name="l00185"></a>00185         aContext.stroke();
<a name="l00186"></a>00186 }
<a name="l00187"></a>00187 
<a name="l00188"></a><a class="code" href="_c_g_context_canvas_8j.html#a74c13e165c00cc434a54bb8c2148e1ba">00188</a> function <a class="code" href="group__coregraphics.html#ga74c13e165c00cc434a54bb8c2148e1ba">CGContextFillRect</a>(aContext, aRect)
<a name="l00189"></a>00189 {
<a name="l00190"></a>00190     _CGContextFillRectCanvas(aContext, aRect);
<a name="l00191"></a>00191 }
<a name="l00192"></a>00192 
<a name="l00193"></a><a class="code" href="_c_g_context_canvas_8j.html#ae5c660cd580263dc63f6d0ae8af0232e">00193</a> function <a class="code" href="group__coregraphics.html#gae5c660cd580263dc63f6d0ae8af0232e">CGContextFillRects</a>(aContext, rects, count)
<a name="l00194"></a>00194 {
<a name="l00195"></a>00195     var i = 0;
<a name="l00196"></a>00196     
<a name="l00197"></a>00197     <span class="keywordflow">if</span> (arguments[<span class="stringliteral">&quot;count&quot;</span>] == NULL)
<a name="l00198"></a>00198         var count = rects.length;
<a name="l00199"></a>00199     
<a name="l00200"></a>00200     <span class="keywordflow">for</span> (; i &lt; count; ++i)
<a name="l00201"></a>00201     {
<a name="l00202"></a>00202         var rect = rects[i];
<a name="l00203"></a>00203         _CGContextFillRectCanvas(aContext, rect);
<a name="l00204"></a>00204     }
<a name="l00205"></a>00205 }
<a name="l00206"></a>00206 
<a name="l00207"></a><a class="code" href="_c_g_context_canvas_8j.html#a97161b64abcac5e58a722ecb0767993a">00207</a> function <a class="code" href="group__coregraphics.html#ga97161b64abcac5e58a722ecb0767993a">CGContextStrokeRect</a>(aContext, aRect)
<a name="l00208"></a>00208 {
<a name="l00209"></a>00209     aContext.strokeRect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect));
<a name="l00210"></a>00210 }
<a name="l00211"></a>00211 
<a name="l00212"></a><a class="code" href="_c_g_context_canvas_8j.html#ad01a959c797a1d1bcd719a40d82faf56">00212</a> function <a class="code" href="_c_g_context_canvas_8j.html#ad01a959c797a1d1bcd719a40d82faf56">CGContextClip</a>(aContext)
<a name="l00213"></a>00213 {
<a name="l00214"></a>00214     _CGContextClipCanvas(aContext);
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 
<a name="l00217"></a><a class="code" href="_c_g_context_canvas_8j.html#aaf1092eb35e89274bf9097e5967d5a4f">00217</a> function <a class="code" href="_c_g_context_canvas_8j.html#aaf1092eb35e89274bf9097e5967d5a4f">CGContextClipToRect</a>(aContext, aRect)
<a name="l00218"></a>00218 {
<a name="l00219"></a>00219     _CGContextBeginPathCanvas(aContext);
<a name="l00220"></a>00220     _CGContextAddRectCanvas(aContext, aRect);
<a name="l00221"></a>00221     _CGContextClosePathCanvas(aContext);
<a name="l00222"></a>00222     
<a name="l00223"></a>00223     _CGContextClipCanvas(aContext);
<a name="l00224"></a>00224 }
<a name="l00225"></a>00225 
<a name="l00226"></a><a class="code" href="_c_g_context_canvas_8j.html#a0a92f7053941b69b39a6a255f37af6f0">00226</a> function <a class="code" href="_c_g_context_canvas_8j.html#a0a92f7053941b69b39a6a255f37af6f0">CGContextClipToRects</a>(aContext, rects, count)
<a name="l00227"></a>00227 {
<a name="l00228"></a>00228     <span class="keywordflow">if</span> (arguments[<span class="stringliteral">&quot;count&quot;</span>] == NULL)
<a name="l00229"></a>00229         var count = rects.length;
<a name="l00230"></a>00230 
<a name="l00231"></a>00231     _CGContextBeginPathCanvas(aContext);
<a name="l00232"></a>00232     <a class="code" href="group__coregraphics.html#ga9e2deb0c9030f957dbf60a759c8b89bf">CGContextAddRects</a>(aContext, rects, count);
<a name="l00233"></a>00233     _CGContextClipCanvas(aContext);
<a name="l00234"></a>00234 }
<a name="l00235"></a>00235 
<a name="l00236"></a><a class="code" href="_c_g_context_canvas_8j.html#af226610351555b43c7a120bc79abb115">00236</a> function <a class="code" href="group__coregraphics.html#gaf226610351555b43c7a120bc79abb115">CGContextSetAlpha</a>(aContext, anAlpha)
<a name="l00237"></a>00237 {
<a name="l00238"></a>00238     aContext.globalAlpha = anAlpha;
<a name="l00239"></a>00239 }
<a name="l00240"></a>00240 
<a name="l00241"></a><a class="code" href="_c_g_context_canvas_8j.html#a800a3e5b0c46359d28b091376630bb0e">00241</a> function <a class="code" href="group__coregraphics.html#ga800a3e5b0c46359d28b091376630bb0e">CGContextSetFillColor</a>(aContext, aColor)
<a name="l00242"></a>00242 {
<a name="l00243"></a>00243     aContext.fillStyle = [aColor cssString];
<a name="l00244"></a>00244 }
<a name="l00245"></a>00245 
<a name="l00246"></a><a class="code" href="_c_g_context_canvas_8j.html#ac13f17a8bed76d16b9e5252106d196e0">00246</a> function <a class="code" href="group__coregraphics.html#gac13f17a8bed76d16b9e5252106d196e0">CGContextSetStrokeColor</a>(aContext, aColor)
<a name="l00247"></a>00247 {
<a name="l00248"></a>00248     aContext.strokeStyle = [aColor cssString];
<a name="l00249"></a>00249 }
<a name="l00250"></a>00250 
<a name="l00251"></a><a class="code" href="_c_g_context_canvas_8j.html#a98c027a31e3e5f63331a4b3bda776924">00251</a> function <a class="code" href="group__coregraphics.html#ga98c027a31e3e5f63331a4b3bda776924">CGContextSetShadow</a>(aContext, aSize, aBlur)
<a name="l00252"></a>00252 {
<a name="l00253"></a>00253     aContext.shadowOffsetX = aSize.width;
<a name="l00254"></a>00254     aContext.shadowOffsetY = aSize.height;
<a name="l00255"></a>00255     aContext.shadowBlur = aBlur;
<a name="l00256"></a>00256 }
<a name="l00257"></a>00257 
<a name="l00258"></a><a class="code" href="_c_g_context_canvas_8j.html#a478b28f5bf3b1854a37d456cd773bfe5">00258</a> function <a class="code" href="group__coregraphics.html#ga478b28f5bf3b1854a37d456cd773bfe5">CGContextSetShadowWithColor</a>(aContext, aSize, aBlur, aColor)
<a name="l00259"></a>00259 {
<a name="l00260"></a>00260     aContext.shadowOffsetX = aSize.width;
<a name="l00261"></a>00261     aContext.shadowOffsetY = aSize.height;
<a name="l00262"></a>00262     aContext.shadowBlur = aBlur;
<a name="l00263"></a>00263     aContext.shadowColor = [aColor cssString];
<a name="l00264"></a>00264 }
<a name="l00265"></a>00265 
<a name="l00266"></a><a class="code" href="_c_g_context_canvas_8j.html#ab03a594a5cfc77ecdd7ab6c38e33592a">00266</a> function <a class="code" href="group__coregraphics.html#gab03a594a5cfc77ecdd7ab6c38e33592a">CGContextRotateCTM</a>(aContext, anAngle)
<a name="l00267"></a>00267 {
<a name="l00268"></a>00268     aContext.rotate(anAngle);
<a name="l00269"></a>00269 }
<a name="l00270"></a>00270 
<a name="l00271"></a><a class="code" href="_c_g_context_canvas_8j.html#ac8e6ebe6d154412e36ac869e47b2e796">00271</a> function <a class="code" href="group__coregraphics.html#gac8e6ebe6d154412e36ac869e47b2e796">CGContextScaleCTM</a>(aContext, sx, sy)
<a name="l00272"></a>00272 {
<a name="l00273"></a>00273     aContext.scale(sx, sy);
<a name="l00274"></a>00274 }
<a name="l00275"></a>00275 
<a name="l00276"></a><a class="code" href="_c_g_context_canvas_8j.html#a2351bbe153eb35f881d0de33de240e02">00276</a> function <a class="code" href="group__coregraphics.html#ga2351bbe153eb35f881d0de33de240e02">CGContextTranslateCTM</a>(aContext, tx, ty)
<a name="l00277"></a>00277 {
<a name="l00278"></a>00278     aContext.translate(tx, ty);
<a name="l00279"></a>00279 }
<a name="l00280"></a>00280 
<a name="l00281"></a><a class="code" href="_c_g_context_canvas_8j.html#ac7211ba721a4fc0360d3435d268b61a0">00281</a> <span class="preprocessor">#define scale_rotate(a, b, c, d) \</span>
<a name="l00282"></a>00282 <span class="preprocessor">        var sign = (a * d &lt; 0.0 || b * c &gt; 0.0) ? -1.0 : 1.0, \</span>
<a name="l00283"></a>00283 <span class="preprocessor">            a2 = (ATAN2(b, d) + ATAN2(-sign * c, sign * a)) / 2.0, \</span>
<a name="l00284"></a>00284 <span class="preprocessor">            cos = COS(a2),\</span>
<a name="l00285"></a>00285 <span class="preprocessor">            sin = SIN(a2);\</span>
<a name="l00286"></a>00286 <span class="preprocessor">        \</span>
<a name="l00287"></a>00287 <span class="preprocessor">        if (cos == 0)\</span>
<a name="l00288"></a>00288 <span class="preprocessor">        {\</span>
<a name="l00289"></a>00289 <span class="preprocessor">            sx = -c / sin;\</span>
<a name="l00290"></a>00290 <span class="preprocessor">            sy = b / sin;\</span>
<a name="l00291"></a>00291 <span class="preprocessor">        }\</span>
<a name="l00292"></a>00292 <span class="preprocessor">        else if (sin == 0)\</span>
<a name="l00293"></a>00293 <span class="preprocessor">        {\</span>
<a name="l00294"></a>00294 <span class="preprocessor">            sx = a / cos;\</span>
<a name="l00295"></a>00295 <span class="preprocessor">            sy = d / cos;\</span>
<a name="l00296"></a>00296 <span class="preprocessor">        }\</span>
<a name="l00297"></a>00297 <span class="preprocessor">        else\</span>
<a name="l00298"></a>00298 <span class="preprocessor">        {\</span>
<a name="l00299"></a>00299 <span class="preprocessor">            abs_cos = ABS(cos);\</span>
<a name="l00300"></a>00300 <span class="preprocessor">            abs_sin = ABS(sin);\</span>
<a name="l00301"></a>00301 <span class="preprocessor">            \</span>
<a name="l00302"></a>00302 <span class="preprocessor">            sx = (abs_cos * a / cos + abs_sin * -c / sin) / (abs_cos + abs_sin);\</span>
<a name="l00303"></a>00303 <span class="preprocessor">            sy = (abs_cos * d / cos + abs_sin * b / sin) / (abs_cos + abs_sin);\</span>
<a name="l00304"></a>00304 <span class="preprocessor">        }\</span>
<a name="l00305"></a>00305 <span class="preprocessor">        </span>
<a name="l00306"></a><a class="code" href="_c_g_context_canvas_8j.html#aa084886d93ed54cf6158a8c6878551de">00306</a> <span class="preprocessor"></span><span class="preprocessor">#define rotate_scale(a, b, c, d) \</span>
<a name="l00307"></a>00307 <span class="preprocessor">        var sign = (a * d &lt; 0.0 || b * c &gt; 0.0) ? -1.0 : 1.0;\</span>
<a name="l00308"></a>00308 <span class="preprocessor">            a1 = (Math.atan2(sign * b, sign * a) + Math.atan2(-c, d)) / 2.0,\</span>
<a name="l00309"></a>00309 <span class="preprocessor">            cos = COS(a1),\</span>
<a name="l00310"></a>00310 <span class="preprocessor">            sin = SIN(a1);\</span>
<a name="l00311"></a>00311 <span class="preprocessor">               \</span>
<a name="l00312"></a>00312 <span class="preprocessor">        if (cos == 0)\</span>
<a name="l00313"></a>00313 <span class="preprocessor">        {\</span>
<a name="l00314"></a>00314 <span class="preprocessor">            sx = b / sin;\</span>
<a name="l00315"></a>00315 <span class="preprocessor">            sy = -c / sin;\</span>
<a name="l00316"></a>00316 <span class="preprocessor">        }\</span>
<a name="l00317"></a>00317 <span class="preprocessor">        else if (sin == 0)\</span>
<a name="l00318"></a>00318 <span class="preprocessor">        {\</span>
<a name="l00319"></a>00319 <span class="preprocessor">            sx = a / cos;\</span>
<a name="l00320"></a>00320 <span class="preprocessor">            sy = d / cos;\</span>
<a name="l00321"></a>00321 <span class="preprocessor">        }\</span>
<a name="l00322"></a>00322 <span class="preprocessor">        else\</span>
<a name="l00323"></a>00323 <span class="preprocessor">        {\</span>
<a name="l00324"></a>00324 <span class="preprocessor">            abs_cos = ABS(cos);\</span>
<a name="l00325"></a>00325 <span class="preprocessor">            abs_sin = ABS(sin);\</span>
<a name="l00326"></a>00326 <span class="preprocessor">            \</span>
<a name="l00327"></a>00327 <span class="preprocessor">            sx = (abs_cos * a / cos + abs_sin * b / sin) / (abs_cos + abs_sin);\</span>
<a name="l00328"></a>00328 <span class="preprocessor">            sy = (abs_cos * d / cos + abs_sin * -c / sin) / (abs_cos + abs_sin);\</span>
<a name="l00329"></a>00329 <span class="preprocessor">        }\</span>
<a name="l00330"></a>00330 <span class="preprocessor"></span>
<a name="l00331"></a><a class="code" href="_c_g_context_canvas_8j.html#a13ab3c971ccc7a4ca3b31228d81c7516">00331</a> <span class="preprocessor"></span>function <a class="code" href="_c_g_context_canvas_8j.html#a13ab3c971ccc7a4ca3b31228d81c7516">eigen</a>(anAffineTransform)
<a name="l00332"></a>00332 {
<a name="l00333"></a>00333     alert(<span class="stringliteral">&quot;IMPLEMENT ME!&quot;</span>);
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 
<a name="l00336"></a>00336 
<a name="l00337"></a><a class="code" href="_c_g_context_canvas_8j.html#ac27658e37ef0721fc08a0898a9b83385">00337</a> <span class="keywordflow">if</span> (<a class="code" href="_c_p_compatibility_8j.html#a1fbfe7ca6b2cef354ecfe78f6cfd6659">CPFeatureIsCompatible</a>(<a class="code" href="_c_p_compatibility_8j.html#a09ab65e855daf2e7c1aedbe010cd7efa">CPJavaScriptCanvasTransformFeature</a>))
<a name="l00338"></a>00338 {
<a name="l00339"></a>00339 
<a name="l00340"></a>00340 <a class="code" href="group__coregraphics.html#ga0f2dc89da432a179558067fd023a9315">CGContextConcatCTM</a> = function(aContext, anAffineTransform)
<a name="l00341"></a>00341 {
<a name="l00342"></a>00342     aContext.transform(anAffineTransform.a, anAffineTransform.b, anAffineTransform.c, anAffineTransform.d, anAffineTransform.tx, anAffineTransform.ty);
<a name="l00343"></a>00343 }
<a name="l00344"></a>00344 
<a name="l00345"></a>00345 }
<a name="l00346"></a>00346 <span class="keywordflow">else</span>
<a name="l00347"></a>00347 {
<a name="l00348"></a>00348 
<a name="l00349"></a>00349 <a class="code" href="group__coregraphics.html#ga0f2dc89da432a179558067fd023a9315">CGContextConcatCTM</a> = function(aContext, anAffineTransform)
<a name="l00350"></a>00350 {
<a name="l00351"></a>00351     var a = anAffineTransform.a,
<a name="l00352"></a>00352         b = anAffineTransform.b,
<a name="l00353"></a>00353         c = anAffineTransform.c,      
<a name="l00354"></a>00354         d = anAffineTransform.d,
<a name="l00355"></a>00355         tx = anAffineTransform.tx,
<a name="l00356"></a>00356         ty = anAffineTransform.ty,
<a name="l00357"></a>00357         sx = 1.0,
<a name="l00358"></a>00358         sy = 1.0,
<a name="l00359"></a>00359         a1 = 0.0,
<a name="l00360"></a>00360         a2 = 0.0;
<a name="l00361"></a>00361 
<a name="l00362"></a>00362     <span class="comment">// Detect the simple case of just scaling.</span>
<a name="l00363"></a>00363     <span class="keywordflow">if</span> (b == 0.0 &amp;&amp; c == 0.0)
<a name="l00364"></a>00364     {
<a name="l00365"></a>00365         sx = a;
<a name="l00366"></a>00366         sy = d;
<a name="l00367"></a>00367     }
<a name="l00368"></a>00368     
<a name="l00369"></a>00369     <span class="comment">// a scale followed by a rotate</span>
<a name="l00370"></a>00370     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (a * b == -c * d)
<a name="l00371"></a>00371     {
<a name="l00372"></a>00372         <a class="code" href="_c_g_context_canvas_8j.html#ac7211ba721a4fc0360d3435d268b61a0">scale_rotate</a>(a, b, c, d)
<a name="l00373"></a>00373     }
<a name="l00374"></a>00374         
<a name="l00375"></a>00375     <span class="comment">// rotate, then scale.</span>
<a name="l00376"></a>00376     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (a * c == -b * d)
<a name="l00377"></a>00377     {
<a name="l00378"></a>00378         <a class="code" href="_c_g_context_canvas_8j.html#aa084886d93ed54cf6158a8c6878551de">rotate_scale</a>(a, b, c, d)
<a name="l00379"></a>00379     }
<a name="l00380"></a>00380     <span class="keywordflow">else</span>
<a name="l00381"></a>00381     {
<a name="l00382"></a>00382         var transpose = <a class="code" href="_c_g_affine_transform_8j.html#a80ac67b0044fbb2cf3c9d5f47298986f">CGAffineTransformMake</a>(a, c, b, d, 0.0, 0.0), <span class="comment">// inline</span>
<a name="l00383"></a>00383             u = <a class="code" href="_c_g_context_canvas_8j.html#a13ab3c971ccc7a4ca3b31228d81c7516">eigen</a>(<a class="code" href="_c_g_affine_transform_8j.html#af365049e43d927195c26bd0352a1116f">CGAffineTransformConcat</a>(anAffineTransform, transpose)),
<a name="l00384"></a>00384             v = <a class="code" href="_c_g_context_canvas_8j.html#a13ab3c971ccc7a4ca3b31228d81c7516">eigen</a>(<a class="code" href="_c_g_affine_transform_8j.html#af365049e43d927195c26bd0352a1116f">CGAffineTransformConcat</a>(transpose, anAffineTransform)),
<a name="l00385"></a>00385             U = <a class="code" href="_c_g_affine_transform_8j.html#a80ac67b0044fbb2cf3c9d5f47298986f">CGAffineTransformMake</a>(u.vector_1.x, u.vector_2.x, u.vector_1.y, u.vector_2.y, 0.0, 0.0), <span class="comment">// inline</span>
<a name="l00386"></a>00386             VT = <a class="code" href="_c_g_affine_transform_8j.html#a80ac67b0044fbb2cf3c9d5f47298986f">CGAffineTransformMake</a>(v.vector_1.x, v.vector_1.y, v.vector_2.x, v.vector_2.y, 0.0, 0.0),
<a name="l00387"></a>00387             S = <a class="code" href="_c_g_affine_transform_8j.html#af365049e43d927195c26bd0352a1116f">CGAffineTransformConcat</a>(<a class="code" href="_c_g_affine_transform_8j.html#af365049e43d927195c26bd0352a1116f">CGAffineTransformConcat</a>(<a class="code" href="_c_g_affine_transform_8j.html#a7fbeeee49fbad301876a71a146f7995a">CGAffineTransformInvert</a>(U), anAffineTransform), <a class="code" href="_c_g_affine_transform_8j.html#a7fbeeee49fbad301876a71a146f7995a">CGAffineTransformInvert</a>(VT));        
<a name="l00388"></a>00388     
<a name="l00389"></a>00389         a = VT.a;
<a name="l00390"></a>00390         b = VT.b;
<a name="l00391"></a>00391         c = VT.c;
<a name="l00392"></a>00392         d = VT.d;
<a name="l00393"></a>00393         <a class="code" href="_c_g_context_canvas_8j.html#ac7211ba721a4fc0360d3435d268b61a0">scale_rotate</a>(a, b, c, d)
<a name="l00394"></a>00394         S.a *= sx;
<a name="l00395"></a>00395         S.d *= sy;
<a name="l00396"></a>00396         a = U.a;
<a name="l00397"></a>00397         b = U.b;
<a name="l00398"></a>00398         c = U.c;
<a name="l00399"></a>00399         d = U.d;
<a name="l00400"></a>00400         <a class="code" href="_c_g_context_canvas_8j.html#aa084886d93ed54cf6158a8c6878551de">rotate_scale</a>(a, b, c, d)
<a name="l00401"></a>00401         sx = S.a * sx;
<a name="l00402"></a>00402         sy = S.d * sy;
<a name="l00403"></a>00403     }
<a name="l00404"></a>00404     
<a name="l00405"></a>00405     <a class="code" href="_c_a_backing_store_8j.html#ad2b049b1f6911d2ffffc0769dfe601e4">if</a> (tx != 0 || ty != 0)
<a name="l00406"></a>00406         <a class="code" href="group__coregraphics.html#ga2351bbe153eb35f881d0de33de240e02">CGContextTranslateCTM</a>(aContext, tx, ty);
<a name="l00407"></a>00407     <a class="code" href="_c_a_backing_store_8j.html#ad2b049b1f6911d2ffffc0769dfe601e4">if</a> (a1 != 0.0)
<a name="l00408"></a>00408         <a class="code" href="group__coregraphics.html#gab03a594a5cfc77ecdd7ab6c38e33592a">CGContextRotateCTM</a>(aContext, a1);
<a name="l00409"></a>00409     <a class="code" href="_c_a_backing_store_8j.html#ad2b049b1f6911d2ffffc0769dfe601e4">if</a> (sx != 1.0 || sy != 1.0)
<a name="l00410"></a>00410         <a class="code" href="group__coregraphics.html#gac8e6ebe6d154412e36ac869e47b2e796">CGContextScaleCTM</a>(aContext, sx, sy);
<a name="l00411"></a>00411     <a class="code" href="_c_a_backing_store_8j.html#ad2b049b1f6911d2ffffc0769dfe601e4">if</a> (a2 != 0.0)
<a name="l00412"></a>00412         <a class="code" href="group__coregraphics.html#gab03a594a5cfc77ecdd7ab6c38e33592a">CGContextRotateCTM</a>(aContext, a2);
<a name="l00413"></a>00413 }
<a name="l00414"></a>00414 
<a name="l00415"></a>00415 }
<a name="l00416"></a>00416 
<a name="l00417"></a>00417 function <a class="code" href="_c_g_context_v_m_l_8j.html#aa73a703617b790a33f95044f29cd3193">CGContextDrawImage</a>(aContext, aRect, anImage)
<a name="l00418"></a>00418 {
<a name="l00419"></a>00419     aContext.drawImage(anImage._image, _CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect));
<a name="l00420"></a>00420 }
<a name="l00421"></a>00421 
<a name="l00422"></a>00422 function <a class="code" href="_c_g_context_v_m_l_8j.html#a44b5b8680504ac1d5cd6e28b3f899441">to_string</a>(aColor)
<a name="l00423"></a>00423 {
<a name="l00424"></a>00424     <span class="keywordflow">return</span> <span class="stringliteral">&quot;rgba(&quot;</span> + ROUND(aColor.components[0] * 255) + <span class="stringliteral">&quot;, &quot;</span> + ROUND(aColor.components[1] * 255) + <span class="stringliteral">&quot;, &quot;</span> + ROUND(255 * aColor.components[2]) + <span class="stringliteral">&quot;, &quot;</span> + aColor.components[3] + <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00425"></a>00425 }
<a name="l00426"></a>00426 
<a name="l00427"></a>00427 function <a class="code" href="_c_g_context_v_m_l_8j.html#ad5aab9a4c77342b828db694cea80e128">CGContextDrawLinearGradient</a>(aContext, aGradient, aStartPoint, anEndPoint, options)
<a name="l00428"></a>00428 {
<a name="l00429"></a>00429     var colors = aGradient.colors,
<a name="l00430"></a>00430         count = colors.length,
<a name="l00431"></a>00431         
<a name="l00432"></a>00432         linearGradient = aContext.createLinearGradient(aStartPoint.x, aStartPoint.y, anEndPoint.x, anEndPoint.y);
<a name="l00433"></a>00433 
<a name="l00434"></a>00434     <span class="keywordflow">while</span> (count--)
<a name="l00435"></a>00435         linearGradient.addColorStop(aGradient.locations[count], <a class="code" href="_c_g_context_v_m_l_8j.html#a44b5b8680504ac1d5cd6e28b3f899441">to_string</a>(colors[count]));
<a name="l00436"></a>00436     
<a name="l00437"></a>00437     aContext.fillStyle = linearGradient;
<a name="l00438"></a>00438     aContext.fill();
<a name="l00439"></a>00439 }
<a name="l00440"></a>00440 
<a name="l00441"></a>00441 function <a class="code" href="group__coregraphics.html#ga792b63f505ae560e354bdd49de62307c">CGBitmapGraphicsContextCreate</a>()
<a name="l00442"></a>00442 {
<a name="l00443"></a>00443     var DOMElement = document.createElement(<span class="stringliteral">&quot;canvas&quot;</span>),
<a name="l00444"></a>00444         context = DOMElement.getContext(<span class="stringliteral">&quot;2d&quot;</span>);
<a name="l00445"></a>00445     
<a name="l00446"></a>00446     context.DOMElement = DOMElement;
<a name="l00447"></a>00447     
<a name="l00448"></a>00448     <span class="keywordflow">return</span> context;
<a name="l00449"></a>00449 }
</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_context_canvas_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:42 GMT -->
</html>