Source

cappuccino-docs / cappuccino docs / cappuccino.org / learn / documentation / _c_g_color_space_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_color_space_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/CGColorSpace.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/CGColorSpace.j</h1><a href="_c_g_color_space_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"> * CGColorSpace.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_color_space_8j.html#a5241c32439f432f24660683423995dee">00023</a> <a class="code" href="_c_g_color_space_8j.html#a5241c32439f432f24660683423995dee">kCGColorSpaceModelUnknown</a>       = -1;
<a name="l00024"></a><a class="code" href="_c_g_color_space_8j.html#a221e5b77e44dbcf8da7ed8ebe4aa53eb">00024</a> <a class="code" href="_c_g_color_space_8j.html#a221e5b77e44dbcf8da7ed8ebe4aa53eb">kCGColorSpaceModelMonochrome</a>    = 0;
<a name="l00025"></a><a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">00025</a> <a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>           = 1;
<a name="l00026"></a><a class="code" href="_c_g_color_space_8j.html#a6848acd25d29734bbab4fc4d3b368349">00026</a> <a class="code" href="_c_g_color_space_8j.html#a6848acd25d29734bbab4fc4d3b368349">kCGColorSpaceModelCMYK</a>          = 2;
<a name="l00027"></a><a class="code" href="_c_g_color_space_8j.html#ae61706a300573f7db77972133e97b3d3">00027</a> <a class="code" href="_c_g_color_space_8j.html#ae61706a300573f7db77972133e97b3d3">kCGColorSpaceModelLab</a>           = 3;
<a name="l00028"></a><a class="code" href="_c_g_color_space_8j.html#acf69af09a216e37c2fb3ebcfa8254bc5">00028</a> <a class="code" href="_c_g_color_space_8j.html#acf69af09a216e37c2fb3ebcfa8254bc5">kCGColorSpaceModelDeviceN</a>       = 4;
<a name="l00029"></a><a class="code" href="_c_g_color_space_8j.html#af9bd57493469f0b78a224a76f2cd5439">00029</a> <a class="code" href="_c_g_color_space_8j.html#af9bd57493469f0b78a224a76f2cd5439">kCGColorSpaceModelIndexed</a>       = 5;
<a name="l00030"></a><a class="code" href="_c_g_color_space_8j.html#a42d3df5af54d6d5930bcad2c19e3615f">00030</a> <a class="code" href="_c_g_color_space_8j.html#a42d3df5af54d6d5930bcad2c19e3615f">kCGColorSpaceModelPattern</a>       = 6;
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="comment">/*</span>
<a name="l00033"></a>00033 <span class="comment">    @global</span>
<a name="l00034"></a>00034 <span class="comment">    @group CGColorSpace</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a><a class="code" href="_c_g_color_space_8j.html#aa1b291eba9c196199be8853605cf0b65">00036</a> <a class="code" href="_c_g_color_space_8j.html#aa1b291eba9c196199be8853605cf0b65">kCGColorSpaceGenericGray</a>        = <span class="stringliteral">&quot;CGColorSpaceGenericGray&quot;</span>;
<a name="l00037"></a>00037 <span class="comment">/*</span>
<a name="l00038"></a>00038 <span class="comment">    @global</span>
<a name="l00039"></a>00039 <span class="comment">    @group CGColorSpace</span>
<a name="l00040"></a>00040 <span class="comment">*/</span>
<a name="l00041"></a><a class="code" href="_c_g_color_space_8j.html#ab050f60e13598944af8a65e2a8e6bf2e">00041</a> <a class="code" href="_c_g_color_space_8j.html#ab050f60e13598944af8a65e2a8e6bf2e">kCGColorSpaceGenericRGB</a>         = <span class="stringliteral">&quot;CGColorSpaceGenericRGB&quot;</span>;
<a name="l00042"></a>00042 <span class="comment">/*</span>
<a name="l00043"></a>00043 <span class="comment">    @global</span>
<a name="l00044"></a>00044 <span class="comment">    @group CGColorSpace</span>
<a name="l00045"></a>00045 <span class="comment">*/</span>
<a name="l00046"></a><a class="code" href="_c_g_color_space_8j.html#a7fc3859099303bd98b20d4d123bf12b2">00046</a> <a class="code" href="_c_g_color_space_8j.html#a7fc3859099303bd98b20d4d123bf12b2">kCGColorSpaceGenericCMYK</a>        = <span class="stringliteral">&quot;CGColorSpaceGenericCMYK&quot;</span>;
<a name="l00047"></a>00047 <span class="comment">/*</span>
<a name="l00048"></a>00048 <span class="comment">    @global</span>
<a name="l00049"></a>00049 <span class="comment">    @group CGColorSpace</span>
<a name="l00050"></a>00050 <span class="comment">*/</span>
<a name="l00051"></a><a class="code" href="_c_g_color_space_8j.html#a248488774c4cb766e8e0438541863521">00051</a> <a class="code" href="_c_g_color_space_8j.html#a248488774c4cb766e8e0438541863521">kCGColorSpaceGenericRGBLinear</a>   = <span class="stringliteral">&quot;CGColorSpaceGenericRGBLinear&quot;</span>;
<a name="l00052"></a>00052 <span class="comment">/*</span>
<a name="l00053"></a>00053 <span class="comment">    @global</span>
<a name="l00054"></a>00054 <span class="comment">    @group CGColorSpace</span>
<a name="l00055"></a>00055 <span class="comment">*/</span>
<a name="l00056"></a><a class="code" href="_c_g_color_space_8j.html#af7731e112cfa42ca94171f115ecd4420">00056</a> <a class="code" href="_c_g_color_space_8j.html#af7731e112cfa42ca94171f115ecd4420">kCGColorSpaceGenericRGBHDR</a>      = <span class="stringliteral">&quot;CGColorSpaceGenericRGBHDR&quot;</span>;
<a name="l00057"></a>00057 <span class="comment">/*</span>
<a name="l00058"></a>00058 <span class="comment">    @global</span>
<a name="l00059"></a>00059 <span class="comment">    @group CGColorSpace</span>
<a name="l00060"></a>00060 <span class="comment">*/</span>
<a name="l00061"></a><a class="code" href="_c_g_color_space_8j.html#a91400f0df9643e352ef96cb08e161e27">00061</a> <a class="code" href="_c_g_color_space_8j.html#a91400f0df9643e352ef96cb08e161e27">kCGColorSpaceAdobeRGB1998</a>       = <span class="stringliteral">&quot;CGColorSpaceAdobeRGB1998&quot;</span>;
<a name="l00062"></a>00062 <span class="comment">/*</span>
<a name="l00063"></a>00063 <span class="comment">    @global</span>
<a name="l00064"></a>00064 <span class="comment">    @group CGColorSpace</span>
<a name="l00065"></a>00065 <span class="comment">*/</span>
<a name="l00066"></a><a class="code" href="_c_g_color_space_8j.html#ab27f85ac2bb741511afc9a5d1654bd24">00066</a> <a class="code" href="_c_g_color_space_8j.html#ab27f85ac2bb741511afc9a5d1654bd24">kCGColorSpaceSRGB</a>               = <span class="stringliteral">&quot;CGColorSpaceSRGB&quot;</span>;
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 var _CGNamedColorSpaces         = {};
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 <span class="preprocessor">#define _CGColorSpaceCreateWithModel(aModel, aComponentCount, aBaseColorSpace) \</span>
<a name="l00071"></a>00071 <span class="preprocessor">    { model:aModel, count:aComponentCount, base:aBaseColorSpace }</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span>
<a name="l00073"></a><a class="code" href="_c_g_color_space_8j.html#a33be47ba2b240ac4990c3cf46ef95a44">00073</a> function <a class="code" href="_c_g_color_space_8j.html#a33be47ba2b240ac4990c3cf46ef95a44">CGColorSpaceCreateCalibratedGray</a>(aWhitePoint, aBlackPoint, gamma)
<a name="l00074"></a>00074 {
<a name="l00075"></a>00075     <span class="keywordflow">return</span> _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a221e5b77e44dbcf8da7ed8ebe4aa53eb">kCGColorSpaceModelMonochrome</a>, 1, NULL);
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 
<a name="l00078"></a><a class="code" href="_c_g_color_space_8j.html#aaa2b227955e39d81bf0965af336f1f0c">00078</a> function <a class="code" href="_c_g_color_space_8j.html#aaa2b227955e39d81bf0965af336f1f0c">CGColorSpaceCreateCalibratedRGB</a>(aWhitePoint, aBlackPoint, gamma)
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080     <span class="keywordflow">return</span> _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>, 1, NULL);
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082 
<a name="l00083"></a><a class="code" href="_c_g_color_space_8j.html#a779b775e4ed5be7a59535992b9b59d94">00083</a> function <a class="code" href="_c_g_color_space_8j.html#a779b775e4ed5be7a59535992b9b59d94">CGColorSpaceCreateICCBased</a>(aComponentCount, range, profile, alternate)
<a name="l00084"></a>00084 {
<a name="l00085"></a>00085     <span class="comment">// FIXME: Do we need to support this?</span>
<a name="l00086"></a>00086     <span class="keywordflow">return</span> NULL;
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00089"></a><a class="code" href="_c_g_color_space_8j.html#a43ab79510085648ceed71fbd6d12927b">00089</a> function <a class="code" href="_c_g_color_space_8j.html#a43ab79510085648ceed71fbd6d12927b">CGColorSpaceCreateLab</a>(aWhitePoint, aBlackPoint, aRange)
<a name="l00090"></a>00090 {
<a name="l00091"></a>00091     <span class="comment">// FIXME: Do we need to support this?</span>
<a name="l00092"></a>00092     <span class="keywordflow">return</span> NULL;
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094 
<a name="l00095"></a><a class="code" href="_c_g_color_space_8j.html#ae5886af141c8c8d044e3c509dea811f7">00095</a> function <a class="code" href="_c_g_color_space_8j.html#ae5886af141c8c8d044e3c509dea811f7">CGColorSpaceCreateDeviceCMYK</a>()
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097     <span class="keywordflow">return</span> <a class="code" href="_c_g_color_space_8j.html#afbb4d05d15dd22fab40234ee42b6c5c4">CGColorSpaceCreateWithName</a>(<a class="code" href="_c_g_color_space_8j.html#a7fc3859099303bd98b20d4d123bf12b2">kCGColorSpaceGenericCMYK</a>);
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099 
<a name="l00100"></a><a class="code" href="_c_g_color_space_8j.html#adaa6f1f347edec05cbdfb99d0a8e242a">00100</a> function <a class="code" href="_c_g_color_space_8j.html#adaa6f1f347edec05cbdfb99d0a8e242a">CGColorSpaceCreateDeviceGray</a>()
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102     <span class="keywordflow">return</span> <a class="code" href="_c_g_color_space_8j.html#afbb4d05d15dd22fab40234ee42b6c5c4">CGColorSpaceCreateWithName</a>(<a class="code" href="_c_g_color_space_8j.html#aa1b291eba9c196199be8853605cf0b65">kCGColorSpaceGenericGray</a>);
<a name="l00103"></a>00103 }
<a name="l00104"></a>00104 
<a name="l00105"></a><a class="code" href="_c_g_color_space_8j.html#a775e411191b3539566c438fb961b62df">00105</a> function <a class="code" href="_c_g_color_space_8j.html#a775e411191b3539566c438fb961b62df">CGColorSpaceCreateDeviceRGB</a>()
<a name="l00106"></a>00106 {
<a name="l00107"></a>00107     <span class="keywordflow">return</span> <a class="code" href="_c_g_color_space_8j.html#afbb4d05d15dd22fab40234ee42b6c5c4">CGColorSpaceCreateWithName</a>(<a class="code" href="_c_g_color_space_8j.html#ab050f60e13598944af8a65e2a8e6bf2e">kCGColorSpaceGenericRGB</a>);
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109 
<a name="l00110"></a><a class="code" href="_c_g_color_space_8j.html#a722372ce05b8d346475415c4e114dccf">00110</a> function <a class="code" href="_c_g_color_space_8j.html#a722372ce05b8d346475415c4e114dccf">CGColorSpaceCreateWithPlatformColorSpace</a>()
<a name="l00111"></a>00111 {
<a name="l00112"></a>00112     <span class="comment">// FIXME: This for sure we don&apos;t need.</span>
<a name="l00113"></a>00113     <span class="keywordflow">return</span> NULL;
<a name="l00114"></a>00114 }
<a name="l00115"></a>00115 
<a name="l00116"></a><a class="code" href="_c_g_color_space_8j.html#a9aef3333a0eddbbfc2dc2d2d0254949d">00116</a> function <a class="code" href="_c_g_color_space_8j.html#a9aef3333a0eddbbfc2dc2d2d0254949d">CGColorSpaceCreateIndexed</a>(aBaseColorSpace, lastIndex, colorTable)
<a name="l00117"></a>00117 {
<a name="l00118"></a>00118     <span class="comment">// FIXME: Do we need to support this?</span>
<a name="l00119"></a>00119     <span class="keywordflow">return</span> NULL;
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121 
<a name="l00122"></a><a class="code" href="_c_g_color_space_8j.html#ad254e24b7c522f7c588375c9143370f0">00122</a> function <a class="code" href="_c_g_color_space_8j.html#ad254e24b7c522f7c588375c9143370f0">CGColorSpaceCreatePattern</a>(aBaseColorSpace)
<a name="l00123"></a>00123 {
<a name="l00124"></a>00124     <span class="keywordflow">if</span> (aBaseColorSpace)
<a name="l00125"></a>00125         <span class="keywordflow">return</span> _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a42d3df5af54d6d5930bcad2c19e3615f">kCGColorSpaceModelPattern</a>, aBaseColorSpace.count, aBaseColorSpace);
<a name="l00126"></a>00126     
<a name="l00127"></a>00127     <span class="keywordflow">return</span> _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a42d3df5af54d6d5930bcad2c19e3615f">kCGColorSpaceModelPattern</a>, 0, NULL);
<a name="l00128"></a>00128 }
<a name="l00129"></a>00129 
<a name="l00130"></a><a class="code" href="_c_g_color_space_8j.html#afbb4d05d15dd22fab40234ee42b6c5c4">00130</a> function <a class="code" href="_c_g_color_space_8j.html#afbb4d05d15dd22fab40234ee42b6c5c4">CGColorSpaceCreateWithName</a>(aName)
<a name="l00131"></a>00131 {
<a name="l00132"></a>00132     var colorSpace = _CGNamedColorSpaces[aName];
<a name="l00133"></a>00133     
<a name="l00134"></a>00134     <span class="keywordflow">if</span> (colorSpace)
<a name="l00135"></a>00135         <span class="keywordflow">return</span> colorSpace;
<a name="l00136"></a>00136     
<a name="l00137"></a>00137     <span class="keywordflow">switch</span> (aName)
<a name="l00138"></a>00138     {
<a name="l00139"></a>00139         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#aa1b291eba9c196199be8853605cf0b65">kCGColorSpaceGenericGray</a>:      <span class="keywordflow">return</span> _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a221e5b77e44dbcf8da7ed8ebe4aa53eb">kCGColorSpaceModelMonochrome</a>, 1, NULL);
<a name="l00140"></a>00140         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#ab050f60e13598944af8a65e2a8e6bf2e">kCGColorSpaceGenericRGB</a>:       <span class="keywordflow">return</span> _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>, 3, NULL);
<a name="l00141"></a>00141         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#a7fc3859099303bd98b20d4d123bf12b2">kCGColorSpaceGenericCMYK</a>:      <span class="keywordflow">return</span> _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a6848acd25d29734bbab4fc4d3b368349">kCGColorSpaceModelCMYK</a>, 4, NULL);
<a name="l00142"></a>00142         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#a248488774c4cb766e8e0438541863521">kCGColorSpaceGenericRGBLinear</a>: <span class="keywordflow">return</span> _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>, 3, NULL);
<a name="l00143"></a>00143         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#af7731e112cfa42ca94171f115ecd4420">kCGColorSpaceGenericRGBHDR</a>:    <span class="keywordflow">return</span> _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>, 3, NULL);
<a name="l00144"></a>00144         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#a91400f0df9643e352ef96cb08e161e27">kCGColorSpaceAdobeRGB1998</a>:     <span class="keywordflow">return</span> _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>, 3, NULL);
<a name="l00145"></a>00145         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#ab27f85ac2bb741511afc9a5d1654bd24">kCGColorSpaceSRGB</a>:             <span class="keywordflow">return</span> _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(<a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>, 3, NULL);
<a name="l00146"></a>00146     }
<a name="l00147"></a>00147     
<a name="l00148"></a>00148     <span class="keywordflow">return</span> NULL;
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 
<a name="l00151"></a>00151 <span class="comment">// Getting Information About Color Spaces</span>
<a name="l00152"></a>00152 
<a name="l00153"></a><a class="code" href="_c_g_color_space_8j.html#a67fa9d717c2752a6a958e6b67df6e767">00153</a> function <a class="code" href="_c_g_color_space_8j.html#a67fa9d717c2752a6a958e6b67df6e767">CGColorSpaceCopyICCProfile</a>(aColorSpace)
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155     <span class="keywordflow">return</span> NULL;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a><a class="code" href="_c_g_color_space_8j.html#ad2453cb192a03c96e5ca6cad8ff9e1e8">00158</a> function <a class="code" href="_c_g_color_space_8j.html#ad2453cb192a03c96e5ca6cad8ff9e1e8">CGColorSpaceGetNumberOfComponents</a>(aColorSpace)
<a name="l00159"></a>00159 {
<a name="l00160"></a>00160     <span class="keywordflow">return</span> aColorSpace.count;
<a name="l00161"></a>00161 }
<a name="l00162"></a>00162 
<a name="l00163"></a><a class="code" href="_c_g_color_space_8j.html#af1c2eb705de6169ce90d2e731b23f743">00163</a> function <a class="code" href="_c_g_color_space_8j.html#af1c2eb705de6169ce90d2e731b23f743">CGColorSpaceGetTypeID</a>(aColorSpace)
<a name="l00164"></a>00164 {
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166 
<a name="l00167"></a><a class="code" href="_c_g_color_space_8j.html#a9c4ce130ec32defe6d8dee356f3811fd">00167</a> function <a class="code" href="_c_g_color_space_8j.html#a9c4ce130ec32defe6d8dee356f3811fd">CGColorSpaceGetModel</a>(aColorSpace)
<a name="l00168"></a>00168 {
<a name="l00169"></a>00169     <span class="keywordflow">return</span> aColorSpace.model;
<a name="l00170"></a>00170 }
<a name="l00171"></a>00171 
<a name="l00172"></a><a class="code" href="_c_g_color_space_8j.html#aa79dc32d435797e068f5c2e276bab7fd">00172</a> function <a class="code" href="_c_g_color_space_8j.html#aa79dc32d435797e068f5c2e276bab7fd">CGColorSpaceGetBaseColorSpace</a>(aColorSpace)
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175 
<a name="l00176"></a><a class="code" href="_c_g_color_space_8j.html#a232fa579372650ccb9e752334f54e4a5">00176</a> function <a class="code" href="_c_g_color_space_8j.html#a232fa579372650ccb9e752334f54e4a5">CGColorSpaceGetColorTableCount</a>(aColorSpace)
<a name="l00177"></a>00177 {
<a name="l00178"></a>00178 }
<a name="l00179"></a>00179 
<a name="l00180"></a><a class="code" href="_c_g_color_space_8j.html#af172550254d8417ea8a94a09781b94a6">00180</a> function <a class="code" href="_c_g_color_space_8j.html#af172550254d8417ea8a94a09781b94a6">CGColorSpaceGetColorTable</a>(aColorSpace)
<a name="l00181"></a>00181 {
<a name="l00182"></a>00182 }
<a name="l00183"></a>00183 
<a name="l00184"></a>00184 <span class="comment">// Retaining and Releasing Color Spaces</span>
<a name="l00185"></a>00185 
<a name="l00186"></a><a class="code" href="_c_g_color_space_8j.html#a2493cc8c70cc67b37ac807d79eb26f3e">00186</a> function <a class="code" href="_c_g_color_space_8j.html#a2493cc8c70cc67b37ac807d79eb26f3e">CGColorSpaceRelease</a>(aColorSpace)
<a name="l00187"></a>00187 {
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00190"></a><a class="code" href="_c_g_color_space_8j.html#a67e24cfcaed2ebdc1b3076ed4ed7fae1">00190</a> function <a class="code" href="_c_g_color_space_8j.html#a67e24cfcaed2ebdc1b3076ed4ed7fae1">CGColorSpaceRetain</a>(aColorSpace)
<a name="l00191"></a>00191 {
<a name="l00192"></a>00192     <span class="keywordflow">return</span> aColorSpace;
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194 
<a name="l00195"></a>00195 <span class="comment">// FIXME: We should refer to some default values.</span>
<a name="l00196"></a><a class="code" href="_c_g_color_space_8j.html#ad991f75e63a0b4c8707bbd924aa720cc">00196</a> <span class="preprocessor">#define STANDARDIZE(components, index, minimum, maximum, multiplier)    \</span>
<a name="l00197"></a>00197 <span class="preprocessor">{ \</span>
<a name="l00198"></a>00198 <span class="preprocessor">    if (index &gt; components.length) \</span>
<a name="l00199"></a>00199 <span class="preprocessor">    { \</span>
<a name="l00200"></a>00200 <span class="preprocessor">        components[index] = maximum; \</span>
<a name="l00201"></a>00201 <span class="preprocessor">        return; \</span>
<a name="l00202"></a>00202 <span class="preprocessor">    } \</span>
<a name="l00203"></a>00203 <span class="preprocessor">\</span>
<a name="l00204"></a>00204 <span class="preprocessor">    var component = components[index]; \</span>
<a name="l00205"></a>00205 <span class="preprocessor">    \</span>
<a name="l00206"></a>00206 <span class="preprocessor">    if (component &lt; minimum) \</span>
<a name="l00207"></a>00207 <span class="preprocessor">        components[index] = minimum; \</span>
<a name="l00208"></a>00208 <span class="preprocessor">    else if (component &gt; maximum) \</span>
<a name="l00209"></a>00209 <span class="preprocessor">        components[index] = maximum; \</span>
<a name="l00210"></a>00210 <span class="preprocessor">    else \</span>
<a name="l00211"></a>00211 <span class="preprocessor">        components[index] = ROUND(component * multiplier) / multiplier; \</span>
<a name="l00212"></a>00212 <span class="preprocessor">}</span>
<a name="l00213"></a>00213 <span class="preprocessor"></span>
<a name="l00214"></a><a class="code" href="_c_g_color_space_8j.html#ab068206608a9ff34736370347cc44f34">00214</a> function <a class="code" href="_c_g_color_space_8j.html#ab068206608a9ff34736370347cc44f34">CGColorSpaceStandardizeComponents</a>(aColorSpace, components)
<a name="l00215"></a>00215 {
<a name="l00216"></a>00216     var count = aColorSpace.count;
<a name="l00217"></a>00217     
<a name="l00218"></a>00218     <span class="comment">// Standardize the alpha value.  We allow the alpha value to have a </span>
<a name="l00219"></a>00219     <span class="comment">// higher precision than other components since it is not ultimately </span>
<a name="l00220"></a>00220     <span class="comment">// bound to 256 bits like RGB.</span>
<a name="l00221"></a>00221     <a class="code" href="_c_g_color_space_8j.html#ad991f75e63a0b4c8707bbd924aa720cc">STANDARDIZE</a>(components, count, 0, 1, 1000);
<a name="l00222"></a>00222 
<a name="l00223"></a>00223     <span class="keywordflow">if</span> (aColorSpace.base)
<a name="l00224"></a>00224         aColorSpace = aColorSpace.base;
<a name="l00225"></a>00225 
<a name="l00226"></a>00226     <span class="keywordflow">switch</span> (aColorSpace.model)
<a name="l00227"></a>00227     {
<a name="l00228"></a>00228         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#a221e5b77e44dbcf8da7ed8ebe4aa53eb">kCGColorSpaceModelMonochrome</a>:
<a name="l00229"></a>00229         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#a5d612635acac765cf4e6c06eaade1a36">kCGColorSpaceModelRGB</a>:
<a name="l00230"></a>00230         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#a6848acd25d29734bbab4fc4d3b368349">kCGColorSpaceModelCMYK</a>:
<a name="l00231"></a>00231         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#acf69af09a216e37c2fb3ebcfa8254bc5">kCGColorSpaceModelDeviceN</a>:     <span class="keywordflow">while</span> (count--)
<a name="l00232"></a>00232                                                 <a class="code" href="_c_g_color_space_8j.html#ad991f75e63a0b4c8707bbd924aa720cc">STANDARDIZE</a>(components, count, 0, 1, 255);
<a name="l00233"></a>00233                                             <span class="keywordflow">break</span>;
<a name="l00234"></a>00234                                             
<a name="l00235"></a>00235         <span class="comment">// We don&apos;t currently support these color spaces.</span>
<a name="l00236"></a>00236         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#af9bd57493469f0b78a224a76f2cd5439">kCGColorSpaceModelIndexed</a>:
<a name="l00237"></a>00237         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#ae61706a300573f7db77972133e97b3d3">kCGColorSpaceModelLab</a>:
<a name="l00238"></a>00238         <span class="keywordflow">case</span> <a class="code" href="_c_g_color_space_8j.html#a42d3df5af54d6d5930bcad2c19e3615f">kCGColorSpaceModelPattern</a>:     <span class="keywordflow">break</span>;
<a name="l00239"></a>00239     }
<a name="l00240"></a>00240 }
</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_color_space_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:42 GMT -->
</html>