var p; var debug = window.location.href.indexOf("?debug") > -1, get_gammaRGB = window.location.hash.indexOf("get_gammaRGB") > -1; // Array methods p=Array.prototype; p.indexof = function(v, ignore_case) { for (var i=0; i -1) ipart+=v.substr(i).length; while (v.length-1 && (data_end = src.search(_data_regexp2))>data_begin) { if (!this.data.length) { // 1st var header = lf2cr(src).substr(0, data_begin).replace(_data_format_regexp, ""); if (v = header.match(_header_regexp1)) for (i=0; i -1 && this.data_format.indexOf('CMYK_M') > -1 && this.data_format.indexOf('CMYK_Y') > -1 && this.data_format.indexOf('CMYK_K') > -1) this.device = 'CMYK'; else this.device = 'RGB'; if (comparison_criteria[this.id]) this.id = comparison_criteria[this.id].id; else this.id = this.device; return src ? true : false }; p=dataset.prototype; p.header_get = function() { var header=[], i, j, v; for (i=0; i-1) { header.push(["BEGIN_"+this.header[i][0]]); v=this.header[i][1].split("\n"); for (j=0; j 3 ? 3 : 0, // start offset for device values in fields_match (CMYK if length > 3, else RGB) devend = criteria.fields_match.length > 3 ? 6 : 2, // end offset for device values in fields_match (CMYK if length > 3, else RGB) missing_data, delta_calc_method = f['F_out'].elements['FF_delta_calc_method'].value, delta_symbol = {'ICtCp': '', 'CIE00': "'"}[delta_calc_method] || '*', weight_symbol = (delta_calc_method != "CIE76" ? '/w' : ''), delta_E_desc = delta_calc_method == 'ICtCp' ? 'ICTCP' : delta_calc_method.replace(/CIE(.+)/, 'E$1'), delta_L_desc = delta_calc_method == 'ICtCp' ? 'I' : delta_calc_method.replace(/CIE(.+)/, 'L*$1' + weight_symbol + ''), delta_C_desc = delta_calc_method == 'ICtCp' ? 'CCTCP' : delta_calc_method.replace(/CIE(.+)/, 'C' + delta_symbol + '$1' + weight_symbol + ''), delta_H_desc = delta_calc_method == 'ICtCp' ? 'HCTCP' : delta_calc_method.replace(/CIE(.+)/, 'H' + delta_symbol + '$1' + weight_symbol + ''), patch_number_html, verbosestats = f['F_out'].elements['FF_verbosestats'].checked, warn_deviation = criteria.warn_deviation, no_Lab = (this.data_format.indexof("LAB_L", true) < 0 || this.data_format.indexof("LAB_A", true) < 0 || this.data_format.indexof("LAB_B", true) < 0), no_XYZ = (this.data_format.indexof("XYZ_X", true) < 0 || this.data_format.indexof("XYZ_Y", true) < 0 || this.data_format.indexof("XYZ_Z", true) < 0), gray_balance_cal_only = f['F_out'].elements['FF_gray_balance_cal_only'].checked; if (profile_wp.length == 3) { for (var i=0; i= 1667 && colortemp < 2500) { f['F_out'].elements['FF_planckian'].checked = planckian = true; f['F_out'].elements['FF_planckian'].disabled = true; } colortemp_assumed = Math.round(colortemp / 100) * 100; if (planckian) wp_assumed = jsapi.math.color.planckianCT2XYZ(colortemp_assumed); else wp_assumed = jsapi.math.color.CIEDCorColorTemp2XYZ(colortemp_assumed); for (var i=0; i

Basic Information

', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', (e['FF_correction_matrix'].value ? '' : ''), ' ', ' ', ' ', ' ' ]; if (profile_wp[1] != 100) this.report_html = this.report_html.concat([ ' ', ' ', ' ', ' ' ]); if (profile_wp.length == 3) this.report_html = this.report_html.concat([ ' ', ' ', ' ', ' ' ]); if (wp.length == 3) this.report_html = this.report_html.concat([ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ]); if (bp.length == 3 && bp[0] > -1 && bp[1] > -1 && bp[2] > -1) this.report_html = this.report_html.concat([ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ]); this.report_html = this.report_html.concat([ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '
Device:' + e['FF_display'].value + '
Instrument:' + e['FF_instrument'].value + '
Correction:' + e['FF_correction_matrix'].value + '
Display profile:' + e['FF_profile'].value + '
Display profile luminance:' + profile_wp[1].accuracy(1) + ' cd/m²
Display profile whitepoint:' + 'xy ' + profile_wp_xy_round.join(' ') + ' (XYZ ' + profile_wp_norm_round.join(' ') + '), CCT ' + profile_colortemp + 'K
Measured luminance:' + wp[1].accuracy(1) + ' cd/m²
Measured whitepoint:' + 'xy ' + wp_xy_round.join(' ') + ' (XYZ ' + wp_norm_round.join(' ') + '), CCT ' + colortemp + 'K
Assumed target whitepoint:' + colortemp_assumed + 'K ' + (planckian ? 'blackbody' : 'daylight') + ', xy ' + wp_assumed_xy_round.join(' ') + ' (XYZ ' + wp_assumed_round.join(' ') + ')
Measured black luminance:' + bp[1].accuracy(4) + ' cd/m²
Contrast:' + (wp[1] / bp[1]).accuracy(1) + ':1
Testchart:' + this.testchart + '
Simulation profile:' + (SIMULATION_PROFILE || 'None') + '
Gamma mapping:' + (TRC_GAMMA ? (TRC ? TRC : TRC + ' ' + TRC_GAMMA.toFixed(2) + ' ' + {"b": "relative", "B": "absolute"}[TRC_GAMMA_TYPE] + ', black output offset ' + (TRC_OUTPUT_OFFSET * 100).toFixed(0) + '%') : (SIMULATION_PROFILE ? 'No' : 'N/A')) + '
Whitepoint simulation:' + (WHITEPOINT_SIMULATION ? 'Yes' + (WHITEPOINT_SIMULATION_RELATIVE ? ', relative to display profile whitepoint' : '') : (!DEVICELINK_PROFILE && SIMULATION_PROFILE ? 'No' : 'N/A')) + '
Chromatic adaptation:' + e['FF_adaption'].value + '
Devicelink profile:' + (DEVICELINK_PROFILE || 'None') + '
Evaluation criteria:' + criteria.name + '
Date:' + e['FF_datetime'].value + '
' ]); // Warn when the profile white point differs significantly from the measured // display white point (> 300 K). This typically means the profile was built // from uncalibrated measurements, e.g. the calibration video LUT was not // active during profiling or no colorimeter correction file was applied. if (profile_colortemp && colortemp && Math.abs(profile_colortemp - colortemp) > 300) { this.report_html.push( '

Warning: The profile white point (' + profile_colortemp + ' K) ' + 'differs significantly from the measured display white point (' + colortemp + ' K). ' + 'The display profile was likely built from uncalibrated measurements. ' + 'Common causes: the calibration video LUT was not active during profiling, ' + 'or no colorimeter correction file was applied. ' + 'Re-calibrating and re-profiling the display should fix this.

' ); } var result_start = this.report_html.length; this.report_html = this.report_html.concat([ '
', '

Summary

', '
', ' ', ' ', ' ', ' ' ]); var seen = []; for (var j=0; j(' + window.CAL_RGBLEVELS[0] + '/' + CAL_ENTRYCOUNT + ')'; } else { rules[j][3] = null; rules[j][4] = null; continue; } break; case 'CAL_GREENLEVELS': if (window.CAL_RGBLEVELS) { result[j].sum = (window.CAL_RGBLEVELS[1] / CAL_ENTRYCOUNT * 100).accuracy(1); result[j].htmlsum = result[j].sum + '%
(' + window.CAL_RGBLEVELS[1] + '/' + CAL_ENTRYCOUNT + ')'; } else { rules[j][3] = null; rules[j][4] = null; continue; } break; case 'CAL_BLUELEVELS': if (window.CAL_RGBLEVELS) { result[j].sum = (window.CAL_RGBLEVELS[2] / CAL_ENTRYCOUNT * 100).accuracy(1); result[j].htmlsum = result[j].sum + '%
(' + window.CAL_RGBLEVELS[2] + '/' + CAL_ENTRYCOUNT + ')'; } else { rules[j][3] = null; rules[j][4] = null; continue; } break; case 'CAL_GRAYLEVELS': if (window.CAL_RGBLEVELS) { var cal_graylevels = Math.min(CAL_RGBLEVELS[0], CAL_RGBLEVELS[1], CAL_RGBLEVELS[2]); result[j].sum = (cal_graylevels / CAL_ENTRYCOUNT * 100).accuracy(1); result[j].htmlsum = result[j].sum + '%
(' + cal_graylevels + '/' + CAL_ENTRYCOUNT + ')'; } else { rules[j][3] = null; rules[j][4] = null; continue; } break; case 'WHITEPOINT_MvsA': // Measured vs. assumed if (wp.length == 3) { target_Lab = [100, 0, 0]; actual_Lab = jsapi.math.color.XYZ2Lab(wp_norm[0], wp_norm[1], wp_norm[2], [wp_assumed[0], wp_assumed[1], wp_assumed[2]]); // alert(rules[j] + '\ntarget_Lab: ' + target_Lab + '\nactual_Lab: ' + actual_Lab); delta = jsapi.math.color.delta(target_Lab[0], target_Lab[1], target_Lab[2], actual_Lab[0], actual_Lab[1], actual_Lab[2], rules[j][5], null, null, null, [wp_assumed[0] / 100, wp_assumed[1] / 100, wp_assumed[2] / 100], (profile_wp || wp)[1], wp[1], cat); result[j].E.push(delta.E); result[j].L.push(delta.Lw); result[j].C.push(delta.Cw); result[j].H.push(delta.Hw); result[j].a.push(delta.a); result[j].b.push(delta.b); result[j].Ch.push(delta.Ch); } else { rules[j][3] = null; rules[j][4] = null; continue; } break; case 'WHITEPOINT_MvsP': // Profile vs. measured if (wp.length == 3 && profile_wp.length == 3) { target_Lab = [100, 0, 0]; actual_Lab = jsapi.math.color.XYZ2Lab(wp_norm[0], wp_norm[1], wp_norm[2], [profile_wp_norm[0], profile_wp_norm[1], profile_wp_norm[2]]); // alert(rules[j] + '\ntarget_Lab: ' + target_Lab + '\nactual_Lab: ' + actual_Lab); delta = jsapi.math.color.delta(target_Lab[0], target_Lab[1], target_Lab[2], actual_Lab[0], actual_Lab[1], actual_Lab[2], rules[j][5], null, null, null, profile_wp_norm_1, (profile_wp || wp)[1], wp[1], cat); result[j].E.push(delta.E); result[j].L.push(delta.Lw); result[j].C.push(delta.Cw); result[j].H.push(delta.Hw); result[j].a.push(delta.a); result[j].b.push(delta.b); result[j].Ch.push(delta.Ch); } else { rules[j][3] = null; rules[j][4] = null; continue; } break; } }; this.report_html.push(' '); this.report_html.push('
'); this.report_html.push(' '); this.report_html.push(' '); var bar_html = []; if (result[j].sum != null && rules[j][2] && rules[j][2].indexOf("GAMMA") < 0) { if (!rules[j][3] || (!rules[j][6] && rules[j][5] && rules[j][5].substr(3) != delta_calc_method.substr(3))) rgb = [204, 204, 204]; else { var rgb = [0, 255, 0], step = 255 / (rules[j][3] + rules[j][3] / 2); if (Math.abs(result[j].sum) <= rules[j][3]) { rgb[0] += Math.min(step * Math.abs(result[j].sum), 255); rgb[1] -= Math.min(step * Math.abs(result[j].sum), 255); var maxrg = Math.max(rgb[0], rgb[1]); rgb[0] *= (255 / maxrg); rgb[1] *= (255 / maxrg); rgb[0] = Math.round(rgb[0]); rgb[1] = Math.round(rgb[1]); } else rgb = [255, 0, 0]; }; for (var l = 0; l < actual_rgb_html.length; l ++) { bar_html.push(Math.abs(result[j].sum).accuracy(2) > 0 ? ' ' : ' '); }; }; this.report_html.push(' '); this.report_html.push(' '); if (rules[j][1] && rules[j][1].length > 1 && (rules[j][6] || rules[j][5].substr(3) == delta_calc_method.substr(3))) seen.push(rules[j][1].join(',')); }; this.report_html.push('
CriteriaNominalRecommended# Actual Result
' + rules[j][0] + '' + (rules[j][3] ? (rules[j][2] ? '<= ' + rules[j][3] : '>= ' + rules[j][3] + '%') : ' ') + '' + (rules[j][4] ? (rules[j][2] ? '<= ' + rules[j][4] : '>= ' + rules[j][4] + '%'): ' ') + ''); patch_number_html = []; actual_rgb_html = []; target_rgb_html = []; var haspatchid = false; if (rules[j][2].indexOf("_MAX") < 0 && rules[j][2].indexOf("_MIN") < 0) { for (var k=0; k 1 && seen.indexOf(rules[j][1].join(',')) < 0 && (rules[j][6] || rules[j][5].substr(3) == delta_calc_method.substr(3))) { patch_number_html.push('
 
'); haspatchid = true; if (rules[j][1][k].length == 4) // Assume CMYK target_rgb = jsapi.math.color.CMYK2RGB(rules[j][1][k][0] / 100, rules[j][1][k][1] / 100, rules[j][1][k][2] / 100, rules[j][1][k][3] / 100, 255); else // XXX Note that round(50 * 2.55) = 127, but // round(50 / 100 * 255) = 128 (the latter is what we want)! target_rgb = [rules[j][1][k][0] / 100.0 * 255, rules[j][1][k][1] / 100.0 * 255, rules[j][1][k][2] / 100.0 * 255]; target_rgb_html.push('
 
'); actual_rgb_html.push('
\u2716 
'); } }; if (rules[j][1].length) { for (var k=0; k' + n.fill(String(number_of_sets).length) + ''); haspatchid = true; } target_rgb = jsapi.math.color.Lab2RGB(target_Lab[0], target_Lab[1], target_Lab[2], target_Lab2RGB_wp_1, target_Lab2RGB_src_wp_1, 255, true, cat); actual_rgb = jsapi.math.color.Lab2RGB(actual_Lab[0], actual_Lab[1], actual_Lab[2], actual_Lab2RGB_wp_1, actual_Lab2RGB_src_wp_1, 255, true, cat); target_rgb_html[k] = ('
 
'); actual_rgb_html[k] = ('
 
'); }; matched = true } } } else matched = true; if (matched) { delta = jsapi.math.color.delta(target_Lab[0], target_Lab[1], target_Lab[2], actual_Lab[0], actual_Lab[1], actual_Lab[2], rules[j][5], null, null, null, absolute && (use_profile_wp_as_ref ? profile_wp_norm_1 : 'D50'), (profile_wp || wp)[1], wp[1], cat); result[j].E.push(delta.E); result[j].L.push(delta.Lw); result[j].C.push(delta.Cw); result[j].H.push(delta.Hw); result[j].a.push(delta.a); result[j].b.push(delta.b); result[j].Ch.push(delta.Ch); if (actual.gamma) result[j].g.push(actual.gamma); if ((rules[j][1].length || rules[j][2].indexOf('_MAX') > -1 || rules[j][2].indexOf('_MIN') > -1) && (rules[j][2].indexOf('GAMMA') < 0 || actual.gamma)) result[j].matches.push([i, i, n]) } }; this.report_html = this.report_html.concat(patch_number_html); var number_of_sets = n; if (!rules[j][1].length || ((rules[j][1][0] == 'WHITEPOINT_MvsA' || (rules[j][1][0] == 'WHITEPOINT_MvsP' && profile_wp.length == 3)) && wp.length == 3) || result[j].matches.length >= rules[j][1].length) switch (rules[j][2]) { case DELTA_A_MAX: result[j].sum = jsapi.math.absmax(result[j].a); break; case DELTA_A_AVG: result[j].sum = jsapi.math.avgabs(result[j].a); break; case DELTA_A_MED: result[j].sum = jsapi.math.median(result[j].a); break; case DELTA_A_MAD: result[j].sum = jsapi.math.mad(result[j].a); break; case DELTA_A_PERCENTILE_95: result[j].sum = jsapi.math.percentile(result[j].a, 0.95); break; case DELTA_A_PERCENTILE_99: result[j].sum = jsapi.math.percentile(result[j].a, 0.99); break; case DELTA_A_RANGE: result[j].sum = jsapi.math.max(result[j].a) - jsapi.math.min(result[j].a); break; case DELTA_A_STDDEV: result[j].sum = jsapi.math.stddev(result[j].a); break; case DELTA_A_B_RANGE: var ab = result[j].a.concat(result[j].b); result[j].sum = jsapi.math.max(ab) - jsapi.math.min(ab); break; case DELTA_CH_MAX: result[j].sum = jsapi.math.max(result[j].Ch); break; case DELTA_CH_AVG: result[j].sum = jsapi.math.avg(result[j].Ch); break; case DELTA_B_MAX: result[j].sum = jsapi.math.absmax(result[j].b); break; case DELTA_B_AVG: result[j].sum = jsapi.math.avgabs(result[j].b); break; case DELTA_B_MED: result[j].sum = jsapi.math.median(result[j].b); break; case DELTA_B_MAD: result[j].sum = jsapi.math.mad(result[j].b); break; case DELTA_B_PERCENTILE_95: result[j].sum = jsapi.math.percentile(result[j].B, 0.95); break; case DELTA_B_PERCENTILE_99: result[j].sum = jsapi.math.percentile(result[j].B, 0.99); break; case DELTA_B_RANGE: result[j].sum = jsapi.math.max(result[j].b) - jsapi.math.min(result[j].b); break; case DELTA_B_STDDEV: result[j].sum = jsapi.math.stddev(result[j].b); break; case DELTA_E_MAX: result[j].sum = jsapi.math.absmax(result[j].E); break; case DELTA_E_AVG: result[j].sum = jsapi.math.avg(result[j].E); break; case DELTA_E_MED: result[j].sum = jsapi.math.median(result[j].E); break; case DELTA_E_MAD: result[j].sum = jsapi.math.mad(result[j].E); break; case DELTA_E_PERCENTILE_95: result[j].sum = jsapi.math.percentile(result[j].E, 0.95); break; case DELTA_E_PERCENTILE_99: result[j].sum = jsapi.math.percentile(result[j].E, 0.99); break; case DELTA_E_RANGE: result[j].sum = jsapi.math.max(result[j].E) - jsapi.math.min(result[j].E); break; case DELTA_E_STDDEV: result[j].sum = jsapi.math.stddev(result[j].E); break; case DELTA_L_MAX: result[j].sum = jsapi.math.absmax(result[j].L); break; case DELTA_L_AVG: result[j].sum = jsapi.math.avgabs(result[j].L); break; case DELTA_L_MED: result[j].sum = jsapi.math.median(result[j].L); break; case DELTA_L_MAD: result[j].sum = jsapi.math.mad(result[j].L); break; case DELTA_L_PERCENTILE_95: result[j].sum = jsapi.math.percentile(result[j].L, 0.95); break; case DELTA_L_PERCENTILE_99: result[j].sum = jsapi.math.percentile(result[j].L, 0.99); break; case DELTA_L_RANGE: result[j].sum = jsapi.math.max(result[j].L) - jsapi.math.min(result[j].L); break; case DELTA_L_STDDEV: result[j].sum = jsapi.math.stddev(result[j].L); break; case DELTA_C_MAX: result[j].sum = jsapi.math.absmax(result[j].C); break; case DELTA_C_AVG: result[j].sum = jsapi.math.avgabs(result[j].C); break; case DELTA_C_MED: result[j].sum = jsapi.math.median(result[j].C); break; case DELTA_C_MAD: result[j].sum = jsapi.math.mad(result[j].C); break; case DELTA_C_PERCENTILE_95: result[j].sum = jsapi.math.percentile(result[j].C, 0.95); break; case DELTA_C_PERCENTILE_99: result[j].sum = jsapi.math.percentile(result[j].C, 0.99); break; case DELTA_C_RANGE: result[j].sum = jsapi.math.max(result[j].C) - jsapi.math.min(result[j].C); break; case DELTA_C_STDDEV: result[j].sum = jsapi.math.stddev(result[j].C); break; case DELTA_H_MAX: result[j].sum = jsapi.math.absmax(result[j].H); break; case DELTA_H_AVG: result[j].sum = jsapi.math.avgabs(result[j].H); break; case DELTA_H_MED: result[j].sum = jsapi.math.median(result[j].H); break; case DELTA_H_MAD: result[j].sum = jsapi.math.mad(result[j].H); break; case DELTA_H_PERCENTILE_95: result[j].sum = jsapi.math.percentile(result[j].H, 0.95); break; case DELTA_H_PERCENTILE_99: result[j].sum = jsapi.math.percentile(result[j].H, 0.99); break; case DELTA_H_RANGE: result[j].sum = jsapi.math.max(result[j].H) - jsapi.math.min(result[j].H); break; case DELTA_H_STDDEV: result[j].sum = jsapi.math.stddev(result[j].H); break; case GAMMA_MAX: if (result[j].g.length) result[j].sum = jsapi.math.max(result[j].g); break; case GAMMA_MIN: if (result[j].g.length) result[j].sum = jsapi.math.min(result[j].g); break; case GAMMA_AVG: if (result[j].g.length) result[j].sum = jsapi.math.avg(result[j].g); break; case GAMMA_MED: if (result[j].g.length) result[j].sum = jsapi.math.median(result[j].g); break; case GAMMA_MAD: if (result[j].g.length) result[j].sum = jsapi.math.mad(result[j].g); break; case GAMMA_PERCENTILE_95: if (result[j].g.length) result[j].sum = jsapi.math.percentile(result[j].g, 0.95); break; case GAMMA_PERCENTILE_99: if (result[j].g.length) result[j].sum = jsapi.math.percentile(result[j].g, 0.99); break; case GAMMA_RANGE: if (result[j].g.length) result[j].sum = jsapi.math.max(result[j].g) - jsapi.math.min(result[j].g); break; case GAMMA_STDDEV: if (result[j].g.length) result[j].sum = jsapi.math.stddev(result[j].g); break; } else if (!rules[j][1].length || (rules[j][1][0] + '').indexOf('LEVELS') < 0) missing_data = true; if (result[j].matches.length) { matched = false; for (var k=0; k' + result[j].finalmatch[2].fill(String(number_of_sets).length) + ''); haspatchid = true; var colors = get_colors(target, actual, o, no_Lab, no_XYZ, gray_balance_cal_only, true, profile_wp_norm, wp_norm, absolute, cat, use_profile_wp_as_ref); target_Lab = colors.target_Lab; actual_Lab = colors.actual_Lab; target_rgb = jsapi.math.color.Lab2RGB(target_Lab[0], target_Lab[1], target_Lab[2], target_Lab2RGB_wp_1, target_Lab2RGB_src_wp_1, 255, true, cat); actual_rgb = jsapi.math.color.Lab2RGB(actual_Lab[0], actual_Lab[1], actual_Lab[2], actual_Lab2RGB_wp_1, actual_Lab2RGB_src_wp_1, 255, true, cat); target_rgb_html.push('
 
'); actual_rgb_html.push('
 
'); }; } if (!target_rgb_html.length) { target_rgb_html.push(' '); actual_rgb_html.push(' '); }; if (!haspatchid) this.report_html.push('
 
'); this.report_html.push('
' + target_rgb_html.join('') + '' + actual_rgb_html.join('') + '' + (result[j].sum != null ? result[j].htmlsum || result[j].sum.accuracy(2) : ' ') + '' + (bar_html.join('') || ' ') + 'OK ✔' : (result[j].sum != null && rules[j][3] ? 'warn">OK \u26a0' : 'statonly">')) + '✔' : '"> ')) : 'ko">' + (result[j].sum != null ? 'NOT OK' : '') + ' \u2716') + '
'); var pass, overachieve; for (var j=0; j rules[j][3] : Math.abs(result[j].sum) < rules[j][3])) pass = false; if (!rules[j][4]) continue; if (missing_data || isNaN(result[j].sum) || (rules[j][2] ? Math.abs(result[j].sum) > rules[j][4] : Math.abs(result[j].sum) < rules[j][4])) overachieve = false; } if (rules[j][5] && rules[j][5].substr(3) == delta_calc_method.substr(3)) for (var k=0; k -1) { this.data[result[j].matches[k][1]].actual_DE = Math.abs(rules[j][2].indexOf('_MAX') < 0 ? result[j].sum : result[j].E[k]); this.data[result[j].matches[k][1]].tolerance_DE = rules[j][3]; } else if (rules[j][2].indexOf('_L_') > -1) { this.data[result[j].matches[k][1]].actual_DL = Math.abs(rules[j][2].indexOf('_MAX') < 0 ? result[j].sum : result[j].L[k]); this.data[result[j].matches[k][1]].tolerance_DL = rules[j][3]; } else if (rules[j][2].indexOf('_A_') > -1) { this.data[result[j].matches[k][1]].actual_Da = Math.abs(rules[j][2].indexOf('_MAX') < 0 ? result[j].sum : result[j].a[k]); this.data[result[j].matches[k][1]].tolerance_Da = rules[j][3]; } else if (rules[j][2].indexOf('_B_') > -1) { this.data[result[j].matches[k][1]].actual_Db = Math.abs(rules[j][2].indexOf('_MAX') < 0 ? result[j].sum : result[j].b[k]); this.data[result[j].matches[k][1]].tolerance_Db = rules[j][3]; } else if (rules[j][2].indexOf('_C_') > -1) { this.data[result[j].matches[k][1]].actual_DC = Math.abs(rules[j][2].indexOf('_MAX') < 0 ? result[j].sum : result[j].C[k]); this.data[result[j].matches[k][1]].tolerance_DC = rules[j][3]; } else if (rules[j][2].indexOf('_H_') > -1) { this.data[result[j].matches[k][1]].actual_DH = Math.abs(rules[j][2].indexOf('_MAX') < 0 ? result[j].sum : result[j].H[k]); this.data[result[j].matches[k][1]].tolerance_DH = rules[j][3]; } }; }; this.report_html.push(''); this.result_html = this.report_html.slice(result_start); this.report_html.push('
'); this.report_html.push('
'); this.report_html.push('

Overview

'); this.report_html.push(' '); this.report_html.push(' '); var device_labels = fields_match.slice(devstart, devend + 1), device_channels = device_labels.join('').replace(/(?:CMYK|RGB)_/g, ''); this.report_html.push(' '); this.report_html.push(' '); this.report_html.push(' '); if (mode == 'Lab') labels = 'L*,a*,b*'; else if (mode == 'XYZ') labels = 'X,Y,Z'; else if (mode == 'xyY') labels = 'x,y,Y'; else if (mode == "Lu'v'") labels = "L*,u',v'"; else if (mode == "ICtCp") labels = "I,Ct,Cp"; this.report_html.push(' ' + (criteria.fields_match.join(',').indexOf('CMYK') < 0 ? '' : '') + '' + (criteria.fields_match.join(',').indexOf('CMYK') < 0 ? '' : '') + '' + /* '' + */ ''); this.report_html.push(' '); var grayscale_values = [], gamut_values = []; for (var i=0, n=0; i'); var bar_html = [], rgb; if (actual.tolerance_DE == null) actual.tolerance_DE = warn_deviation; if (actual.actual_DE == null) actual.actual_DE = delta.E; if (actual.delta == null) actual.delta = delta; if (warn_deviation != null) { rgb = [0, 255, 0]; var step = 255 / (actual.tolerance_DE + actual.tolerance_DE / 2); if (actual.actual_DE <= actual.tolerance_DE) { rgb[0] += Math.min(step * actual.actual_DE, 255); rgb[1] -= Math.min(step * actual.actual_DE, 255); var maxrg = Math.max(rgb[0], rgb[1]); rgb[0] *= (255 / maxrg); rgb[1] *= (255 / maxrg); rgb[0] = Math.round(rgb[0]); rgb[1] = Math.round(rgb[1]); } else rgb = [255, 0, 0]; } else rgb = [204, 204, 204]; bar_html.push(actual.actual_DE.accuracy(2) > 0 ? ' ' : ' '); if (criteria.fields_match.join(',').indexOf('CMYK') > -1) var device = current_cmyk; else { var device = current_rgb; // XXX Note that round(50 * 2.55) = 127, but // round(50 / 100 * 255) = 128 (the latter is what we want)! for (var j=0; j' + n.fill(String(number_of_sets).length) + '' + (criteria.fields_match.join(',').indexOf('CMYK') < 0 ? '' : '') + '' + (criteria.fields_match.join(',').indexOf('CMYK') < 0 ? '' : '') + '' + /* '' + */ ''); this.report_html.push(' '); }; this.report_html.push('
#Device ValuesNominal Values Measured ValuesColor distance 
 ' + device_labels.join('').replace(/\w+_/g, '') + '' + labels.split(',').join('') + 'γ  ' + labels.split(',').join('') + 'γΔ' + delta_L_desc + 'ΔaΔbΔ' + delta_C_desc + 'Δ' + delta_H_desc + 'Δ' + delta_E_desc + ' 
' + device.join('') + '' + target_color[0].accuracy(accuracy) + '' + target_color[1].accuracy(accuracy) + '' + target_color[2].accuracy(accuracy) + '' + (target.gamma ? target.gamma.accuracy(2) : ' ') + '
 
 
' + actual_color[0].accuracy(accuracy) + '' + actual_color[1].accuracy(accuracy) + '' + actual_color[2].accuracy(accuracy) + '' + (actual.gamma ? actual.gamma.accuracy(2) : ' ') + '' + delta.Lw.accuracy(2) + '' + delta.a.accuracy(2) + '' + delta.b.accuracy(2) + '' + delta.Cw.accuracy(2) + '' + delta.Hw.accuracy(2) + '' + delta.E.accuracy(2) + '' + bar_html.join('') + '
'); this.report_html.push('
'); if (grayscale_values.length) { grayscale_values.sort(function(a, b) { // Compare signal level if (a[0][0] < b[0][0]) return -1; if (a[0][0] > b[0][0]) return 1; // If same signal level, compare target L* if (a[3][0] < b[3][0]) return -1; if (a[3][0] > b[3][0]) return 1; return 0; }); // CCT var CCT = [], hwidth = 100 / 18, width = (100 - hwidth) / grayscale_values.length, rows = 17, start = 10500, end = 2500, rstep = (start - end) / (rows - 1), rowh = 30; CCT.push('
'); CCT.push('

Correlated Color Temperature

'); CCT.push(' '); CCT.push(''); debug && window.console && console.log('CCT'); for (var i = 0; i < grayscale_values.length; i ++) { var target_XYZ = jsapi.math.color.Lab2XYZ(grayscale_values[i][3][0], grayscale_values[i][3][1], grayscale_values[i][3][2], absolute && use_profile_wp_as_ref && profile_wp_norm, 100.0), actual_XYZ = jsapi.math.color.Lab2XYZ(grayscale_values[i][4][0], grayscale_values[i][4][1], grayscale_values[i][4][2], absolute && use_profile_wp_as_ref && profile_wp_norm, 100.0); if (!absolute) { // Make absolute target_XYZ = jsapi.math.color.adapt(target_XYZ[0], target_XYZ[1], target_XYZ[2], [96.42, 100, 82.49], profile_wp_norm, cat); actual_XYZ = jsapi.math.color.adapt(actual_XYZ[0], actual_XYZ[1], actual_XYZ[2], [96.42, 100, 82.49], wp_norm, cat); } debug && window.console && console.log('Target XYZ', target_XYZ.join(', '), 'Actual XYZ', actual_XYZ.join(', ')); var target_CCT = jsapi.math.color.XYZ2CorColorTemp(target_XYZ[0], target_XYZ[1], target_XYZ[2]), actual_CCT = jsapi.math.color.XYZ2CorColorTemp(actual_XYZ[0], actual_XYZ[1], actual_XYZ[2]), target_Lab = jsapi.math.color.XYZ2Lab(target_XYZ[0], target_XYZ[1], target_XYZ[2], absolute && use_profile_wp_as_ref && profile_wp_norm), actual_Lab = jsapi.math.color.XYZ2Lab(actual_XYZ[0], actual_XYZ[1], actual_XYZ[2], absolute && use_profile_wp_as_ref && profile_wp_norm), delta = jsapi.math.color.delta(target_Lab[0], target_Lab[1], target_Lab[2], actual_Lab[0], actual_Lab[1], actual_Lab[2], delta_calc_method, null, null, null, (absolute && use_profile_wp_as_ref && profile_wp_norm_1) || 'D50', (profile_wp || wp)[1], wp[1], cat), delta_CH = Math.sqrt(Math.pow(delta.Cw, 2) + Math.pow(delta.Hw, 2)); var rgb = jsapi.math.color.XYZ2RGB(actual_XYZ[0] / actual_XYZ[1] * 0.75, actual_XYZ[1] / actual_XYZ[1] * 0.75, actual_XYZ[2] / actual_XYZ[1] * 0.75, null, 255), brgb = []; for (var j = 0; j < 3; j ++) brgb[j] = Math.round(rgb[j] * .8); CCT.push(''); } CCT.push(''); for (var i = start - rstep; i >= end; i -= rstep) { CCT.push(''); } CCT.push(''); for (var i = 0; i < grayscale_values.length; i ++) { CCT.push(''); } CCT.push('
' + start + 'K
' + i + 'K
%' + (grayscale_values[i][0][0] / 255 * 100).accuracy(0) + '
'); //var idx = this.report_html.indexOf('
'); //this.report_html.splice(idx, 0, CCT.join('\n')); this.report_html = this.report_html.concat(CCT); // Gamma tracking var numgamma = 0, gamma_max = 3, gamma_min = 1.4; for (var i = 0; i < grayscale_values.length; i ++) { if (grayscale_values[i][1].gamma && grayscale_values[i][2].gamma) { numgamma ++; gamma_max = Math.max(gamma_max, grayscale_values[i][1].gammaR, grayscale_values[i][2].gammaR, grayscale_values[i][1].gammaG, grayscale_values[i][2].gammaG, grayscale_values[i][1].gammaB, grayscale_values[i][2].gammaB); gamma_min = Math.min(gamma_min, grayscale_values[i][1].gammaR, grayscale_values[i][2].gammaR, grayscale_values[i][1].gammaG, grayscale_values[i][2].gammaG, grayscale_values[i][1].gammaB, grayscale_values[i][2].gammaB); } } if (numgamma > 0) { var gamma_tracking = [], hwidth = 100 / 31, width = (100 - hwidth) / numgamma, start = Math.ceil(gamma_max * 10), end = Math.floor(gamma_min * 10), rows = start - end + 1, rstep = (start - end) / (rows - 1), rowh = 30; gamma_tracking.push('
'); gamma_tracking.push('

Gamma

'); gamma_tracking.push(' '); gamma_tracking.push(''); for (var i = 0; i < grayscale_values.length; i ++) { if (!grayscale_values[i][1].gamma || !grayscale_values[i][2].gamma) continue; var target_Lab = grayscale_values[i][3], actual_Lab = grayscale_values[i][4], target_gamma = grayscale_values[i][1].gamma, actual_gamma = grayscale_values[i][2].gamma, gamma = 2.2 + target_gamma - actual_gamma, Eprime = Math.pow(Math.pow(0.75, 2.2), (1 / gamma)), rgb = [], brgb = [], delta = jsapi.math.color.delta(target_Lab[0], target_Lab[1], target_Lab[2], actual_Lab[0], actual_Lab[1], actual_Lab[2], delta_calc_method, null, null, null, absolute && (use_profile_wp_as_ref ? profile_wp_norm_1 : 'D50'), (profile_wp || wp)[1], wp[1], cat); for (var j = 0; j < 3; j ++) { rgb.push(Math.round(Eprime * 255)); brgb.push(Math.round(Eprime * 204)); } gamma_tracking.push(''); } gamma_tracking.push(''); for (var i = start - rstep; i >= end; i -= rstep) { gamma_tracking.push(''); } gamma_tracking.push(''); for (var i = 0; i < grayscale_values.length; i ++) { if (!grayscale_values[i][1].gamma || !grayscale_values[i][2].gamma) continue; gamma_tracking.push(''); } gamma_tracking.push('
' + (start / 10).toFixed(1) + '
' + (get_gammaRGB ? '
' : '') + '
' + (i / 10).toFixed(1) + '
%' + (grayscale_values[i][0][0] / 255 * 100).accuracy(0) + '
'); //var idx = this.report_html.indexOf('
'); //this.report_html.splice(idx, 0, gamma_tracking.join('\n')); this.report_html = this.report_html.concat(gamma_tracking); } // numgamma > 0 // RGB Balance var rgb_balance = [], hwidth = 100 / 21, width = (100 - hwidth) / grayscale_values.length, rows = 17, start = 40, end = -40, rstep = (start - end) / (rows - 1), rowh = 30, actual_white_Y = jsapi.math.color.Lab2XYZ(grayscale_values[grayscale_values.length - 1][4][0], 0, 0)[1]; rgb_balance.push('
'); rgb_balance.push('

RGB Gray Balance

'); rgb_balance.push(' '); rgb_balance.push(''); debug && window.console && console.log('RGB Gray Balance'); for (var i = 0; i < grayscale_values.length; i ++) { var target_Lab = grayscale_values[i][3], actual_Lab = grayscale_values[i][4], target_XYZ = jsapi.math.color.Lab2XYZ(target_Lab[0], target_Lab[1], target_Lab[2], absolute && use_profile_wp_as_ref && profile_wp_norm, 100.0), actual_XYZ = jsapi.math.color.Lab2XYZ(actual_Lab[0], actual_Lab[1], actual_Lab[2], absolute && use_profile_wp_as_ref && profile_wp_norm, 100.0), target_rgb = [target_XYZ[0] / target_XYZ[1], target_XYZ[1] / target_XYZ[1], target_XYZ[2] / target_XYZ[1]], //target_rgb = jsapi.math.color.XYZ2RGB(target_rgb[0], target_rgb[1], target_rgb[2], absolute && wp_norm_1, 1, false, false), target_rgb = jsapi.math.color.xyz_to_rgb_matrix(0.6400, 0.3300, 0.3000, 0.6000, 0.1500, 0.0600, (absolute && wp_norm_1) || "D65", 1.0).multiply(target_rgb), fact = 1, actual_xyY = jsapi.math.color.XYZ2xyY(actual_XYZ[0], actual_XYZ[1], actual_XYZ[2]), actual_rgb = [actual_xyY[0] / actual_xyY[1] * fact, fact, (1 - (actual_xyY[0] + actual_xyY[1])) / actual_xyY[1] * fact], //actual_rgb = jsapi.math.color.XYZ2RGB(actual_rgb[0], actual_rgb[1], actual_rgb[2], absolute && wp_norm_1, 1, false, false), actual_rgb = jsapi.math.color.xyz_to_rgb_matrix(0.6400, 0.3300, 0.3000, 0.6000, 0.1500, 0.0600, (absolute && wp_norm_1) || "D65", 1.0).multiply(actual_rgb), delta = jsapi.math.color.delta(target_Lab[0], target_Lab[1], target_Lab[2], actual_Lab[0], actual_Lab[1], actual_Lab[2], delta_calc_method, null, null, null, absolute && (use_profile_wp_as_ref ? profile_wp_norm_1 : 'D50'), (profile_wp || wp)[1], wp[1], cat); debug && window.console && console.log('Target XYZ', target_XYZ.join(', '), 'Actual XYZ', actual_XYZ.join(', ')); debug && window.console && console.log('Target RGB', target_rgb.join(', '), 'Actual RGB', actual_rgb.join(', ')); if (isNaN(jsapi.math.min(target_rgb)) || isNaN(jsapi.math.min(actual_rgb))) { rgb_balance.push(''); continue; } rgb_balance.push(''); } rgb_balance.push(''); for (var i = start - rstep; i >= end; i -= rstep) { rgb_balance.push(''); } rgb_balance.push(''); for (var i = 0; i < grayscale_values.length; i ++) { rgb_balance.push(''); } rgb_balance.push('
+' + start + '%
' + (i > 0 ? '+' : '') + i + '%
%' + (grayscale_values[i][0][0] / 255 * 100).accuracy(0) + '
'); //var idx = this.report_html.indexOf('
'); //this.report_html.splice(idx, 0, rgb_balance.join('\n')); this.report_html = this.report_html.concat(rgb_balance); } if (gamut_values.length) { var accuracy, offset, multiplier; switch (mode) { case "Lu'v'": xy = "u'v'"; accuracy = 4; offset = [10, 95]; multiplier = 1200; break; case 'XYZ': xy = 'XZ'; accuracy = 2; offset = [5, 95]; multiplier = 8; break; case 'xyY': xy = 'xy'; accuracy = 4; offset = [10, 95]; multiplier = 1000; break; case "ICtCp": xy = 'CtCp'; accuracy = 4; offset = [50, 50]; multiplier = 1000; break; default: xy = 'a*b*'; accuracy = 2; offset = [50, 50]; multiplier = 3; } this.report_html.push('
'); this.report_html.push('

Gamut ' + xy + '

'); this.report_html.push('
'); // Sort by L* gamut_values.sort(function (a, b) { if (a[4][0] < b[4][0]) return -1; if (a[4][0] > b[4][0]) return 1; return 0; }); for (var i = 0; i < gamut_values.length; i ++) { var n = gamut_values[i][0], device_channels = gamut_values[i][1], device = gamut_values[i][2], target_color = gamut_values[i][3], target_xy, actual_color = gamut_values[i][5], actual_xy, target_rgb = gamut_values[i][6], actual_rgb = gamut_values[i][7], delta_calc_method = gamut_values[i][8], deltaE = gamut_values[i][9]; switch (mode) { case 'XYZ': target_xy = [target_color[2], target_color[0]]; actual_xy = [actual_color[2], actual_color[0]]; break; case 'xyY': target_xy = target_color; actual_xy = actual_color; break; default: target_xy = target_color.slice(1); actual_xy = actual_color.slice(1); } this.report_html.push('
'); } this.report_html.push('
'); } return this.report_html.join('\n') }; function bggridlines(rowh) { return window.btoa ? 'background-image: url(data:image/svg+xml;base64,' + btoa('') + ');' : ''; }; function trim(txt) { return txt.replace(/^\s+|\s+$/g, "") }; function lf2cr(txt) { return txt.replace(/\r\n/g, "\r").replace(/\n/g, "\r") }; function cr2lf(txt) { // CR LF = Windows // CR = Mac OS 9 // LF = Unix/Linux/Mac OS X return txt.replace(/\r\n/g, "\n").replace(/\r/g, "\n") }; function compact(txt, collapse_whitespace) { txt = trim(txt).replace(/\n\s+|\s+\n/g, "\n"); return collapse_whitespace?txt.replace(/\s+/g, " "):txt }; function comma2point(txt) { return decimal(txt) }; function decimal(txt, sr, re) { if (!sr) sr = "\\,"; if (!re) re = "."; return txt.replace(new RegExp("((^|\\s)\\-?\\d+)"+sr+"(\\d+(\\s|$))", "g"), "$1"+re+"$3") }; function toarray(txt, level) { txt=comma2point(compact(cr2lf(txt))); if (!txt) return []; if (level) { txt=txt.split(/\s/) } else { txt=txt.split("\n"); for (var i=0; i -1) current_cmyk = [actual[fields_extract_indexes_i[3]], actual[fields_extract_indexes_i[4]], actual[fields_extract_indexes_i[5]], actual[fields_extract_indexes_i[6]]]; } else { current_rgb = [actual[fields_extract_indexes_i[4]], actual[fields_extract_indexes_i[5]], actual[fields_extract_indexes_i[6]]]; if (fields_match.join(',').indexOf('CMYK') > -1) current_cmyk = [actual[fields_extract_indexes_i[0]], actual[fields_extract_indexes_i[1]], actual[fields_extract_indexes_i[2]], actual[fields_extract_indexes_i[3]]]; } for (var l=0; l 0 && current_rgb[0] < 100 && target_Lab[0] > 0 && actual_Lab[0] > 0) { if (!absolute) { target_XYZ = jsapi.math.color.Lab2XYZ(target_Lab[0], target_Lab[1], target_Lab[2], null, 100.0); actual_XYZ = jsapi.math.color.Lab2XYZ(actual_Lab[0], actual_Lab[1], actual_Lab[2], null, 100.0); } target.gamma = Math.log(target_XYZ[1] / 100) / Math.log(current_rgb[0] / 100); actual.gamma = Math.log(actual_XYZ[1] / 100) / Math.log(current_rgb[0] / 100); if (get_gammaRGB) { var profile_wp_norm_1 = [profile_wp_norm[0] / 100.0, profile_wp_norm[1] / 100.0, profile_wp_norm[2] / 100.0], wp_norm_1 = [wp_norm[0] / 100.0, wp_norm[1] / 100.0, wp_norm[2] / 100.0], target_RGB = jsapi.math.color.xyz_to_rgb_matrix(0.6400, 0.3300, 0.3000, 0.6000, 0.1500, 0.0600, (absolute && profile_wp_norm_1) || "D50", 1.0).multiply(target_XYZ), actual_RGB = jsapi.math.color.xyz_to_rgb_matrix(0.6400, 0.3300, 0.3000, 0.6000, 0.1500, 0.0600, (absolute && wp_norm_1) || "D50", 1.0).multiply(actual_XYZ); target.gammaR = Math.log(target_RGB[0] / 100) / Math.log(current_rgb[0] / 100); target.gammaG = Math.log(target_RGB[1] / 100) / Math.log(current_rgb[0] / 100); target.gammaB = Math.log(target_RGB[2] / 100) / Math.log(current_rgb[0] / 100); actual.gammaR = Math.log(actual_RGB[0] / 100) / Math.log(current_rgb[0] / 100); actual.gammaG = Math.log(actual_RGB[1] / 100) / Math.log(current_rgb[0] / 100); actual.gammaB = Math.log(actual_RGB[2] / 100) / Math.log(current_rgb[0] / 100); } else { target.gammaR = target.gamma; target.gammaG = target.gamma; target.gammaB = target.gamma; actual.gammaR = actual.gamma; actual.gammaG = actual.gamma; actual.gammaB = actual.gamma; } } } return {target_Lab: target_Lab, actual_Lab: actual_Lab, current_rgb: current_rgb, current_cmyk: current_cmyk, target_XYZ: target_XYZ, actual_XYZ: actual_XYZ}; }; function get_data(which) { var f=document.forms; if (which == "r" || !which) { data_ref=new dataset(f["F_data"].elements["FF_data_ref"].value) }; if (which == "i" || !which) { data_in=new dataset(f["F_data"].elements["FF_data_in"].value) }; if (which == "r" || !which) { if (!data_ref.data_format.length) return false; if (!data_ref.data.length) return false }; if (which == "i" || !which) { if (!data_in.data_format.length) return false; if (!data_in.data.length) return false }; return true }; function compare(set_delta_calc_method) { form_elements_set_disabled(null, true); var fe = document.forms["F_out"].elements, fe2 = document.forms["F_data"].elements; if (fe2["FF_variables"]) try { eval(fe2["FF_variables"].value); window.comparison_criteria = comparison_criteria; if (debug) alert("Comparsion criteria: " + (comparison_criteria.toSource ? comparison_criteria.toSource() : comparison_criteria)) } catch (e) { alert("Error parsing variable:\n" + e + "\nUsing default values.") }; var report = data_in.generate_report(set_delta_calc_method), criteria = comparison_criteria[fe['FF_criteria'].value]; document.getElementById('result').innerHTML = report; layout(); document.getElementById('reporttitle').style.visibility = "visible"; document.getElementById('report').style.visibility = "visible"; form_elements_set_disabled(null, false); form_element_set_disabled(fe['FF_absolute'], !!criteria.lock_use_absolute_values); form_element_set_disabled(fe['FF_use_profile_wp_as_ref'], !fe['FF_absolute'].checked); if (document.getElementsByClassName) { var canvas = document.getElementsByClassName('canvas'), inner_coords, mouse_is_down, mouse_down_coords; document.addEventListener('mouseup', function (e) { for (var i = 0; i < canvas.length; i ++) { jsapi.dom.attributeRemoveWord(canvas[i], 'class', 'dragging'); } mouse_is_down = false; }); for (var i = 0; i < canvas.length; i ++) { var act = Array.prototype.slice.apply(canvas[i].getElementsByClassName('act')), ref = Array.prototype.slice.apply(canvas[i].getElementsByClassName('ref')), pts = act.concat(ref); for (var j = 0; j < pts.length; j ++) { pts[j].addEventListener('mouseenter', function (e) { var linked = this.parentNode.parentNode.getElementsByClassName('patch-' + jsapi.dom.attr(this, 'data-index')); jsapi.dom.attributeAddWord(this.parentNode.parentNode, 'class', 'hover'); for (var k = 0; k < linked.length; k ++) { jsapi.dom.attributeAddWord(linked[k].parentNode, 'class', 'hover'); if (jsapi.dom.attributeHasWord(linked[k], 'class', 'ref')) { linked[k].style.backgroundColor = jsapi.dom.attr(linked[k], 'data-bgcolor'); linked[k].style.borderColor = jsapi.dom.attr(linked[k], 'data-bordercolor'); } } }); pts[j].addEventListener('mouseleave', function (e) { var linked = this.parentNode.parentNode.getElementsByClassName('patch-' + jsapi.dom.attr(this, 'data-index')); jsapi.dom.attributeRemoveWord(this.parentNode.parentNode, 'class', 'hover'); for (var k = 0; k < linked.length; k ++) { jsapi.dom.attributeRemoveWord(linked[k].parentNode, 'class', 'hover'); if (jsapi.dom.attributeHasWord(linked[k], 'class', 'ref')) { linked[k].style.backgroundColor = ''; linked[k].style.borderColor = ''; } } }); } // Reset viewport canvas[i].addEventListener('dblclick', function () { var inner = this.getElementsByClassName('inner')[0]; this.style.fontSize = '1px'; inner.style.marginLeft = ''; inner.style.marginTop = ''; }); // Click drag viewport canvas[i].addEventListener('mousedown', function (e) { var inner = this.getElementsByClassName('inner')[0]; inner_coords = [parseFloat(inner.style.marginLeft) || 0, parseFloat(inner.style.marginTop) || 0]; jsapi.dom.attributeAddWord(this, 'class', 'dragging'); mouse_is_down = true; mouse_down_coords = [e.pageX, e.pageY]; e.preventDefault(); }); canvas[i].addEventListener('mousemove', function (e) { if (mouse_is_down) { var fontSize = parseFloat(this.style.fontSize) || 1, inner = this.getElementsByClassName('inner')[0]; inner.style.marginLeft = inner_coords[0] + (e.pageX - mouse_down_coords[0]) / fontSize + 'em'; inner.style.marginTop = inner_coords[1] + (e.pageY - mouse_down_coords[1]) / fontSize + 'em'; } }); // Mousewheel zoom canvas[i].addEventListener('wheel', function (e) { var fontSize = parseFloat(this.style.fontSize) || 1; if ((e.deltaY < 0 && fontSize < 1000) || (e.deltaY > 0 && fontSize > 1)) { if (e.deltaY < 0) fontSize += fontSize / 4; else fontSize = Math.max(fontSize - fontSize / 4, 1); this.style.fontSize = fontSize + 'px'; e.preventDefault(); } }); } } return true }; function layout() { var padding = 0, borderwidth = 0, margin = 20, maxwidth = (document.getElementById("report").offsetWidth || 900) - padding * 2 - borderwidth * 2, tables = document.getElementsByTagName("table"); for (var i = 0; i < tables.length; i ++) { if (tables[i].offsetWidth > maxwidth) { maxwidth = tables[i].offsetWidth; document.body.style.width = (maxwidth + padding * 2 + borderwidth * 2) + 'px'; } } for (var i = 0; i < tables.length; i ++) tables[i].style.width = maxwidth + 'px'; } function form_element_set_disabled(form_element, disabled) { if (!form_element || form_element.readOnly || form_element.type == "hidden" || form_element.type == "file" || jsapi.dom.attributeHasWord(form_element, "class", "fakefile") || jsapi.dom.attributeHasWord(form_element, "class", "save") || jsapi.dom.attributeHasWord(form_element, "class", "delete")) return; if (form_element.name == "FF_delta_calc_method") disabled = form_element.disabled; disabled = disabled ? "disabled" : ""; form_element.disabled = disabled; if (disabled && !jsapi.dom.attributeHasWord(form_element, "class", "disabled")) jsapi.dom.attributeAddWord(form_element, "class", "disabled"); else if (!disabled && jsapi.dom.attributeHasWord(form_element, "class", "disabled")) jsapi.dom.attributeRemoveWord(form_element, "class", "disabled"); var labels = document.getElementsByTagName("label"); for (var i=0; i/g, '').replace(/CTCP/g, ' CtCp'); }; function plaintext(which) { var e = document.forms['F_data'].elements; if (which == 'ref') var f = 'FF_data_ref'; else var f = 'FF_data_in'; var win = window.open(); win.document.write('
' + e[f].value);
	win.document.close();
};