PageRenderTime 12ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Frameworks/Debug/AppKit/browser.platform/CGColor.j

http://github.com/jfahrenkrug/MapKit-HelloWorld
Unknown | 110 lines | 109 code | 1 blank | 0 comment | 0 complexity | 5a5cc9aec6fefa9e44a60c0b6d212a90 MD5 | raw file
  1i;14;CGColorSpace.jc;3028;
  2var CFTypeGlobalCount = 0;
  3CFHashCode= function(aCFObject)
  4{
  5    if (!aCFObject.hash)
  6        aCFObject.hash = ++CFTypeGlobalCount;
  7    return aCFObject;
  8}
  9kCGColorWhite = "kCGColorWhite";
 10kCGColorBlack = "kCGColorBlack";
 11kCGColorClear = "kCGColorClear";
 12var _CGColorMap = { };
 13CGColorGetConstantColor= function(aColorName)
 14{
 15    alert("FIX ME");
 16}
 17CGColorRetain= function(aColor)
 18{
 19    return aColor;
 20}
 21CGColorRelease= function()
 22{
 23}
 24CGColorCreate= function(aColorSpace, components)
 25{
 26    if (!aColorSpace || !components)
 27        return NULL;
 28    var components = components.slice();
 29    CGColorSpaceStandardizeComponents(aColorSpace, components);
 30    var UID = CFHashCode(aColorSpace) + components.join("");
 31    if (_CGColorMap[UID])
 32        return _CGColorMap[UID];
 33    return _CGColorMap[UID] = { colorspace:aColorSpace, pattern:NULL, components:components };
 34}
 35CGColorCreateCopy= function(aColor)
 36{
 37    return aColor;
 38}
 39CGColorCreateGenericGray= function(gray, alpha)
 40{
 41    return CGColorCreate(0, [gray, alpha]);
 42}
 43CGColorCreateGenericRGB= function(red, green, blue, alpha)
 44{
 45    return CGColorCreate(0, [red, green, blue, alpha]);
 46}
 47CGColorCreateGenericCMYK= function(cyan, magenta, yellow, black, alpha)
 48{
 49    return CGColorCreate(0, [cyan, magenta, yellow, black, alpha]);
 50}
 51CGColorCreateCopyWithAlpha= function(aColor, anAlpha)
 52{
 53    var components = aColor.components;
 54    if (!aColor || anAlpha == components[components.length - 1])
 55     return aColor;
 56    if (aColor.pattern)
 57        var copy = CGColorCreateWithPattern(aColor.colorspace, aColor.pattern, components);
 58    else
 59        var copy = CGColorCreate(aColor.colorspace, components);
 60    copy.components[components.length - 1] = anAlpha;
 61    return copy;
 62}
 63CGColorCreateWithPattern= function(aColorSpace, aPattern, components)
 64{
 65    if (!aColorSpace || !aPattern || !components)
 66        return NULL;
 67    return { colorspace:aColorSpace, pattern:aPattern, components:components.slice() };
 68}
 69CGColorEqualToColor= function(lhs, rhs)
 70{
 71    if (lhs == rhs)
 72        return true;
 73    if (!lhs || !rhs)
 74        return false;
 75    var lhsComponents = lhs.components,
 76        rhsComponents = rhs.components,
 77        lhsComponentCount = lhsComponents.length;
 78    if (lhsComponentCount != rhsComponents.length)
 79        return false;
 80    while (lhsComponentCount--)
 81        if (lhsComponents[lhsComponentCount] != rhsComponents[lhsComponentCount])
 82            return false;
 83    if (lhs.pattern != rhs.pattern)
 84        return false;
 85    if (CGColorSpaceEqualToColorSpace(lhs.colorspace, rhs.colorspace))
 86        return false;
 87    return true;
 88}
 89CGColorGetAlpha= function(aColor)
 90{
 91    var components = aColor.components;
 92    return components[components.length - 1];
 93}
 94CGColorGetColorSpace= function(aColor)
 95{
 96    return aColor.colorspace;
 97}
 98CGColorGetComponents= function(aColor)
 99{
100    return aColor.components;
101}
102CGColorGetNumberOfComponents= function(aColor)
103{
104    return aColor.components.length;
105}
106CGColorGetPattern= function(aColor)
107{
108    return aColor.pattern;
109}
110