NOBUG: Fixed file access permissions
[moodle.git] / lib / yuilib / 3.13.0 / color-hsv / color-hsv-coverage.js
blob164ef8e3fda8d9b1642b02bced92bf9f81ca5408
1 /*
2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
8 if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
9 if (!__coverage__['build/color-hsv/color-hsv.js']) {
10    __coverage__['build/color-hsv/color-hsv.js'] = {"path":"build/color-hsv/color-hsv.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0,0,0,0,0],"8":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":40}}},"2":{"name":"(anonymous_2)","line":54,"loc":{"start":{"line":54,"column":11},"end":{"line":54,"column":26}}},"3":{"name":"(anonymous_3)","line":67,"loc":{"start":{"line":67,"column":12},"end":{"line":67,"column":27}}},"4":{"name":"(anonymous_4)","line":82,"loc":{"start":{"line":82,"column":15},"end":{"line":82,"column":39}}},"5":{"name":"(anonymous_5)","line":134,"loc":{"start":{"line":134,"column":15},"end":{"line":134,"column":39}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":182,"column":43}},"2":{"start":{"line":17,"column":0},"end":{"line":174,"column":2}},"3":{"start":{"line":55,"column":8},"end":{"line":55,"column":49}},"4":{"start":{"line":56,"column":8},"end":{"line":56,"column":33}},"5":{"start":{"line":68,"column":8},"end":{"line":68,"column":50}},"6":{"start":{"line":69,"column":8},"end":{"line":69,"column":33}},"7":{"start":{"line":83,"column":8},"end":{"line":90,"column":30}},"8":{"start":{"line":92,"column":8},"end":{"line":100,"column":9}},"9":{"start":{"line":93,"column":12},"end":{"line":93,"column":18}},"10":{"start":{"line":94,"column":15},"end":{"line":100,"column":9}},"11":{"start":{"line":95,"column":12},"end":{"line":95,"column":37}},"12":{"start":{"line":96,"column":15},"end":{"line":100,"column":9}},"13":{"start":{"line":97,"column":12},"end":{"line":97,"column":45}},"14":{"start":{"line":99,"column":12},"end":{"line":99,"column":45}},"15":{"start":{"line":102,"column":8},"end":{"line":102,"column":46}},"16":{"start":{"line":105,"column":8},"end":{"line":107,"column":9}},"17":{"start":{"line":106,"column":12},"end":{"line":106,"column":21}},"18":{"start":{"line":108,"column":8},"end":{"line":108,"column":17}},"19":{"start":{"line":109,"column":8},"end":{"line":109,"column":26}},"20":{"start":{"line":112,"column":8},"end":{"line":112,"column":32}},"21":{"start":{"line":115,"column":8},"end":{"line":115,"column":34}},"22":{"start":{"line":117,"column":8},"end":{"line":119,"column":9}},"23":{"start":{"line":118,"column":12},"end":{"line":118,"column":29}},"24":{"start":{"line":121,"column":8},"end":{"line":121,"column":63}},"25":{"start":{"line":135,"column":8},"end":{"line":146,"column":40}},"26":{"start":{"line":148,"column":8},"end":{"line":161,"column":9}},"27":{"start":{"line":149,"column":12},"end":{"line":149,"column":18}},"28":{"start":{"line":150,"column":12},"end":{"line":150,"column":18}},"29":{"start":{"line":151,"column":12},"end":{"line":151,"column":18}},"30":{"start":{"line":153,"column":12},"end":{"line":160,"column":13}},"31":{"start":{"line":154,"column":24},"end":{"line":154,"column":30}},"32":{"start":{"line":154,"column":31},"end":{"line":154,"column":37}},"33":{"start":{"line":154,"column":38},"end":{"line":154,"column":44}},"34":{"start":{"line":154,"column":45},"end":{"line":154,"column":51}},"35":{"start":{"line":155,"column":24},"end":{"line":155,"column":30}},"36":{"start":{"line":155,"column":31},"end":{"line":155,"column":37}},"37":{"start":{"line":155,"column":38},"end":{"line":155,"column":44}},"38":{"start":{"line":155,"column":45},"end":{"line":155,"column":51}},"39":{"start":{"line":156,"column":24},"end":{"line":156,"column":30}},"40":{"start":{"line":156,"column":31},"end":{"line":156,"column":37}},"41":{"start":{"line":156,"column":38},"end":{"line":156,"column":44}},"42":{"start":{"line":156,"column":45},"end":{"line":156,"column":51}},"43":{"start":{"line":157,"column":24},"end":{"line":157,"column":30}},"44":{"start":{"line":157,"column":31},"end":{"line":157,"column":37}},"45":{"start":{"line":157,"column":38},"end":{"line":157,"column":44}},"46":{"start":{"line":157,"column":45},"end":{"line":157,"column":51}},"47":{"start":{"line":158,"column":24},"end":{"line":158,"column":30}},"48":{"start":{"line":158,"column":31},"end":{"line":158,"column":37}},"49":{"start":{"line":158,"column":38},"end":{"line":158,"column":44}},"50":{"start":{"line":158,"column":45},"end":{"line":158,"column":51}},"51":{"start":{"line":159,"column":24},"end":{"line":159,"column":30}},"52":{"start":{"line":159,"column":31},"end":{"line":159,"column":37}},"53":{"start":{"line":159,"column":38},"end":{"line":159,"column":44}},"54":{"start":{"line":159,"column":45},"end":{"line":159,"column":51}},"55":{"start":{"line":163,"column":8},"end":{"line":163,"column":47}},"56":{"start":{"line":164,"column":8},"end":{"line":164,"column":47}},"57":{"start":{"line":165,"column":8},"end":{"line":165,"column":47}},"58":{"start":{"line":167,"column":8},"end":{"line":169,"column":9}},"59":{"start":{"line":168,"column":12},"end":{"line":168,"column":29}},"60":{"start":{"line":171,"column":8},"end":{"line":171,"column":63}},"61":{"start":{"line":176,"column":0},"end":{"line":176,"column":32}},"62":{"start":{"line":178,"column":0},"end":{"line":178,"column":67}},"63":{"start":{"line":179,"column":0},"end":{"line":179,"column":79}}},"branchMap":{"1":{"line":92,"type":"if","locations":[{"start":{"line":92,"column":8},"end":{"line":92,"column":8}},{"start":{"line":92,"column":8},"end":{"line":92,"column":8}}]},"2":{"line":94,"type":"if","locations":[{"start":{"line":94,"column":15},"end":{"line":94,"column":15}},{"start":{"line":94,"column":15},"end":{"line":94,"column":15}}]},"3":{"line":96,"type":"if","locations":[{"start":{"line":96,"column":15},"end":{"line":96,"column":15}},{"start":{"line":96,"column":15},"end":{"line":96,"column":15}}]},"4":{"line":102,"type":"cond-expr","locations":[{"start":{"line":102,"column":26},"end":{"line":102,"column":27}},{"start":{"line":102,"column":30},"end":{"line":102,"column":45}}]},"5":{"line":117,"type":"if","locations":[{"start":{"line":117,"column":8},"end":{"line":117,"column":8}},{"start":{"line":117,"column":8},"end":{"line":117,"column":8}}]},"6":{"line":148,"type":"if","locations":[{"start":{"line":148,"column":8},"end":{"line":148,"column":8}},{"start":{"line":148,"column":8},"end":{"line":148,"column":8}}]},"7":{"line":153,"type":"switch","locations":[{"start":{"line":154,"column":16},"end":{"line":154,"column":51}},{"start":{"line":155,"column":16},"end":{"line":155,"column":51}},{"start":{"line":156,"column":16},"end":{"line":156,"column":51}},{"start":{"line":157,"column":16},"end":{"line":157,"column":51}},{"start":{"line":158,"column":16},"end":{"line":158,"column":51}},{"start":{"line":159,"column":16},"end":{"line":159,"column":51}}]},"8":{"line":167,"type":"if","locations":[{"start":{"line":167,"column":8},"end":{"line":167,"column":8}},{"start":{"line":167,"column":8},"end":{"line":167,"column":8}}]}},"code":["(function () { YUI.add('color-hsv', function (Y, NAME) {","","/**","Color provides static methods for color conversion hsv values.","","    Y.Color.toHSV('f00'); // hsv(0, 100%, 100%)","","    Y.Color.toHSVA('rgb(255, 255, 0'); // hsva(60, 100%, 100%, 1)","","","@module color","@submodule color-hsv","@class HSV","@namespace Color","@since 3.8.0","**/","Color = {","","    /**","    @static","    @property REGEX_HSV","    @type RegExp","    @default /hsva?\\(([.\\d]*), ?([.\\d]*)%, ?([.\\d]*)%,? ?([.\\d]*)?\\)/","    @since 3.8.0","    **/","    REGEX_HSV: /hsva?\\(([.\\d]*), ?([.\\d]*)%, ?([.\\d]*)%,? ?([.\\d]*)?\\)/,","","    /**","    @static","    @property STR_HSV","    @type String","    @default hsv({*}, {*}%, {*}%)","    @since 3.8.0","    **/","    STR_HSV: 'hsv({*}, {*}%, {*}%)',","","    /**","    @static","    @property STR_HSVA","    @type String","    @default hsva({*}, {*}%, {*}%, {*})","    @since 3.8.0","    **/","    STR_HSVA: 'hsva({*}, {*}%, {*}%, {*})',","","    /**","    Converts provided color value to an HSV string.","    @public","    @method toHSV","    @param {String} str","    @return {String}","    @since 3.8.0","    **/","    toHSV: function (str) {","        var clr = Y.Color._convertTo(str, 'hsv');","        return clr.toLowerCase();","    },","","    /**","    Converts provided color value to an HSVA string.","    @public","    @method toHSVA","    @param {String} str","    @return {String}","    @since 3.8.0","    **/","    toHSVA: function (str) {","        var clr = Y.Color._convertTo(str, 'hsva');","        return clr.toLowerCase();","    },","","    /**","    Parses the RGB string into h, s, v values. Will return an Array","        of values or an HSV string.","    @protected","    @method _rgbToHsv","    @param {String} str","    @param {Boolean} [toArray]","    @return {String|Array}","    @since 3.8.0","    **/","    _rgbToHsv: function (str, toArray) {","        var h, s, v,","            rgb = Y.Color.REGEX_RGB.exec(str),","            r = rgb[1] / 255,","            g = rgb[2] / 255,","            b = rgb[3] / 255,","            max = Math.max(r, g, b),","            min = Math.min(r, g, b),","            delta = max - min;","","        if (max === min) {","            h = 0;","        } else if (max === r) {","            h = 60 * (g - b) / delta;","        } else if (max === g) {","            h = (60 * (b - r) / delta) + 120;","        } else { // max === b","            h = (60 * (r - g) / delta) + 240;","        }","","        s = (max === 0) ? 0 : 1 - (min / max);","","        // ensure h is between 0 and 360","        while (h < 0) {","            h += 360;","        }","        h %= 360;","        h = Math.round(h);","","        // saturation is percentage","        s = Math.round(s * 100);","","        // value is percentage","        v = Math.round(max * 100);","","        if (toArray) {","            return [h, s, v];","        }","","        return Y.Color.fromArray([h, s, v], Y.Color.TYPES.HSV);","    },","","    /**","    Parses the HSV string into r, b, g values. Will return an Array","        of values or an RGB string.","    @protected","    @method _hsvToRgb","    @param {String} str","    @param {Boolean} [toArray]","    @return {String|Array}","    @since 3.8.0","    **/","    _hsvToRgb: function (str, toArray) {","        var hsv = Y.Color.REGEX_HSV.exec(str),","            h = parseInt(hsv[1], 10),","            s = parseInt(hsv[2], 10) / 100, // 0 - 1","            v = parseInt(hsv[3], 10) / 100, // 0 - 1","            r,","            g,","            b,","            i = Math.floor(h / 60) % 6,","            f = (h / 60) - i,","            p = v * (1 - s),","            q = v * (1 - (s * f)),","            t = v * (1 - (s * (1 - f)));","","        if (s === 0) {","            r = v;","            g = v;","            b = v;","        } else {","            switch (i) {","                case 0: r = v; g = t; b = p; break;","                case 1: r = q; g = v; b = p; break;","                case 2: r = p; g = v; b = t; break;","                case 3: r = p; g = q; b = v; break;","                case 4: r = t; g = p; b = v; break;","                case 5: r = v; g = p; b = q; break;","            }","        }","","        r = Math.min(255, Math.round(r * 256));","        g = Math.min(255, Math.round(g * 256));","        b = Math.min(255, Math.round(b * 256));","","        if (toArray) {","            return [r, g, b];","        }","","        return Y.Color.fromArray([r, g, b], Y.Color.TYPES.RGB);","    }","","};","","Y.Color = Y.mix(Color, Y.Color);","","Y.Color.TYPES = Y.mix(Y.Color.TYPES, {'HSV':'hsv', 'HSVA':'hsva'});","Y.Color.CONVERTS = Y.mix(Y.Color.CONVERTS, {'hsv': 'toHSV', 'hsva': 'toHSVA'});","","","}, '3.13.0', {\"requires\": [\"color-base\"]});","","}());"]};
12 var __cov_gkUHEbEF94xsw7IRi1jHzg = __coverage__['build/color-hsv/color-hsv.js'];
13 __cov_gkUHEbEF94xsw7IRi1jHzg.s['1']++;YUI.add('color-hsv',function(Y,NAME){__cov_gkUHEbEF94xsw7IRi1jHzg.f['1']++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['2']++;Color={REGEX_HSV:/hsva?\(([.\d]*), ?([.\d]*)%, ?([.\d]*)%,? ?([.\d]*)?\)/,STR_HSV:'hsv({*}, {*}%, {*}%)',STR_HSVA:'hsva({*}, {*}%, {*}%, {*})',toHSV:function(str){__cov_gkUHEbEF94xsw7IRi1jHzg.f['2']++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['3']++;var clr=Y.Color._convertTo(str,'hsv');__cov_gkUHEbEF94xsw7IRi1jHzg.s['4']++;return clr.toLowerCase();},toHSVA:function(str){__cov_gkUHEbEF94xsw7IRi1jHzg.f['3']++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['5']++;var clr=Y.Color._convertTo(str,'hsva');__cov_gkUHEbEF94xsw7IRi1jHzg.s['6']++;return clr.toLowerCase();},_rgbToHsv:function(str,toArray){__cov_gkUHEbEF94xsw7IRi1jHzg.f['4']++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['7']++;var h,s,v,rgb=Y.Color.REGEX_RGB.exec(str),r=rgb[1]/255,g=rgb[2]/255,b=rgb[3]/255,max=Math.max(r,g,b),min=Math.min(r,g,b),delta=max-min;__cov_gkUHEbEF94xsw7IRi1jHzg.s['8']++;if(max===min){__cov_gkUHEbEF94xsw7IRi1jHzg.b['1'][0]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['9']++;h=0;}else{__cov_gkUHEbEF94xsw7IRi1jHzg.b['1'][1]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['10']++;if(max===r){__cov_gkUHEbEF94xsw7IRi1jHzg.b['2'][0]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['11']++;h=60*(g-b)/delta;}else{__cov_gkUHEbEF94xsw7IRi1jHzg.b['2'][1]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['12']++;if(max===g){__cov_gkUHEbEF94xsw7IRi1jHzg.b['3'][0]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['13']++;h=60*(b-r)/delta+120;}else{__cov_gkUHEbEF94xsw7IRi1jHzg.b['3'][1]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['14']++;h=60*(r-g)/delta+240;}}}__cov_gkUHEbEF94xsw7IRi1jHzg.s['15']++;s=max===0?(__cov_gkUHEbEF94xsw7IRi1jHzg.b['4'][0]++,0):(__cov_gkUHEbEF94xsw7IRi1jHzg.b['4'][1]++,1-min/max);__cov_gkUHEbEF94xsw7IRi1jHzg.s['16']++;while(h<0){__cov_gkUHEbEF94xsw7IRi1jHzg.s['17']++;h+=360;}__cov_gkUHEbEF94xsw7IRi1jHzg.s['18']++;h%=360;__cov_gkUHEbEF94xsw7IRi1jHzg.s['19']++;h=Math.round(h);__cov_gkUHEbEF94xsw7IRi1jHzg.s['20']++;s=Math.round(s*100);__cov_gkUHEbEF94xsw7IRi1jHzg.s['21']++;v=Math.round(max*100);__cov_gkUHEbEF94xsw7IRi1jHzg.s['22']++;if(toArray){__cov_gkUHEbEF94xsw7IRi1jHzg.b['5'][0]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['23']++;return[h,s,v];}else{__cov_gkUHEbEF94xsw7IRi1jHzg.b['5'][1]++;}__cov_gkUHEbEF94xsw7IRi1jHzg.s['24']++;return Y.Color.fromArray([h,s,v],Y.Color.TYPES.HSV);},_hsvToRgb:function(str,toArray){__cov_gkUHEbEF94xsw7IRi1jHzg.f['5']++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['25']++;var hsv=Y.Color.REGEX_HSV.exec(str),h=parseInt(hsv[1],10),s=parseInt(hsv[2],10)/100,v=parseInt(hsv[3],10)/100,r,g,b,i=Math.floor(h/60)%6,f=h/60-i,p=v*(1-s),q=v*(1-s*f),t=v*(1-s*(1-f));__cov_gkUHEbEF94xsw7IRi1jHzg.s['26']++;if(s===0){__cov_gkUHEbEF94xsw7IRi1jHzg.b['6'][0]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['27']++;r=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['28']++;g=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['29']++;b=v;}else{__cov_gkUHEbEF94xsw7IRi1jHzg.b['6'][1]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['30']++;switch(i){case 0:__cov_gkUHEbEF94xsw7IRi1jHzg.b['7'][0]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['31']++;r=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['32']++;g=t;__cov_gkUHEbEF94xsw7IRi1jHzg.s['33']++;b=p;__cov_gkUHEbEF94xsw7IRi1jHzg.s['34']++;break;case 1:__cov_gkUHEbEF94xsw7IRi1jHzg.b['7'][1]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['35']++;r=q;__cov_gkUHEbEF94xsw7IRi1jHzg.s['36']++;g=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['37']++;b=p;__cov_gkUHEbEF94xsw7IRi1jHzg.s['38']++;break;case 2:__cov_gkUHEbEF94xsw7IRi1jHzg.b['7'][2]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['39']++;r=p;__cov_gkUHEbEF94xsw7IRi1jHzg.s['40']++;g=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['41']++;b=t;__cov_gkUHEbEF94xsw7IRi1jHzg.s['42']++;break;case 3:__cov_gkUHEbEF94xsw7IRi1jHzg.b['7'][3]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['43']++;r=p;__cov_gkUHEbEF94xsw7IRi1jHzg.s['44']++;g=q;__cov_gkUHEbEF94xsw7IRi1jHzg.s['45']++;b=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['46']++;break;case 4:__cov_gkUHEbEF94xsw7IRi1jHzg.b['7'][4]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['47']++;r=t;__cov_gkUHEbEF94xsw7IRi1jHzg.s['48']++;g=p;__cov_gkUHEbEF94xsw7IRi1jHzg.s['49']++;b=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['50']++;break;case 5:__cov_gkUHEbEF94xsw7IRi1jHzg.b['7'][5]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['51']++;r=v;__cov_gkUHEbEF94xsw7IRi1jHzg.s['52']++;g=p;__cov_gkUHEbEF94xsw7IRi1jHzg.s['53']++;b=q;__cov_gkUHEbEF94xsw7IRi1jHzg.s['54']++;break;}}__cov_gkUHEbEF94xsw7IRi1jHzg.s['55']++;r=Math.min(255,Math.round(r*256));__cov_gkUHEbEF94xsw7IRi1jHzg.s['56']++;g=Math.min(255,Math.round(g*256));__cov_gkUHEbEF94xsw7IRi1jHzg.s['57']++;b=Math.min(255,Math.round(b*256));__cov_gkUHEbEF94xsw7IRi1jHzg.s['58']++;if(toArray){__cov_gkUHEbEF94xsw7IRi1jHzg.b['8'][0]++;__cov_gkUHEbEF94xsw7IRi1jHzg.s['59']++;return[r,g,b];}else{__cov_gkUHEbEF94xsw7IRi1jHzg.b['8'][1]++;}__cov_gkUHEbEF94xsw7IRi1jHzg.s['60']++;return Y.Color.fromArray([r,g,b],Y.Color.TYPES.RGB);}};__cov_gkUHEbEF94xsw7IRi1jHzg.s['61']++;Y.Color=Y.mix(Color,Y.Color);__cov_gkUHEbEF94xsw7IRi1jHzg.s['62']++;Y.Color.TYPES=Y.mix(Y.Color.TYPES,{'HSV':'hsv','HSVA':'hsva'});__cov_gkUHEbEF94xsw7IRi1jHzg.s['63']++;Y.Color.CONVERTS=Y.mix(Y.Color.CONVERTS,{'hsv':'toHSV','hsva':'toHSVA'});},'3.13.0',{'requires':['color-base']});