aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js/RrdGfxPdf.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/RrdGfxPdf.js')
-rw-r--r--js/RrdGfxPdf.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/js/RrdGfxPdf.js b/js/RrdGfxPdf.js
index 7cde098..868d521 100644
--- a/js/RrdGfxPdf.js
+++ b/js/RrdGfxPdf.js
@@ -154,20 +154,20 @@ RrdGfxPdf.CORE_FONTS= {
154 154
155RrdGfxPdf.prototype.parse_color = function(str) 155RrdGfxPdf.prototype.parse_color = function(str)
156{ 156{
157 var bits; 157 var bits;
158 if ((bits = /^#?([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(str))) { 158 if ((bits = /^#?([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(str))) {
159 return [parseInt(bits[1]+bits[1], 16), parseInt(bits[2]+bits[2], 16), parseInt(bits[3]+bits[3], 16), 1.0]; 159 return [parseInt(bits[1]+bits[1], 16), parseInt(bits[2]+bits[2], 16), parseInt(bits[3]+bits[3], 16), 1.0];
160 } else if ((bits = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(str))) { 160 } else if ((bits = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(str))) {
161 return [parseInt(bits[1], 16), parseInt(bits[2], 16), parseInt(bits[3], 16), 1.0]; 161 return [parseInt(bits[1], 16), parseInt(bits[2], 16), parseInt(bits[3], 16), 1.0];
162 } else if ((bits = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(str))) { 162 } else if ((bits = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(str))) {
163 return [parseInt(bits[1], 16), parseInt(bits[2], 16), parseInt(bits[3], 16), parseInt(bits[4], 16)/255]; 163 return [parseInt(bits[1], 16), parseInt(bits[2], 16), parseInt(bits[3], 16), parseInt(bits[4], 16)/255];
164 } else if ((bits = /^rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)$/.exec(str))) { 164 } else if ((bits = /^rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)$/.exec(str))) {
165 return [parseInt(bits[1], 10), parseInt(bits[2], 10), parseInt(bits[3], 10), 1.0]; 165 return [parseInt(bits[1], 10), parseInt(bits[2], 10), parseInt(bits[3], 10), 1.0];
166 } else if ((bits = /^rgba\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([0-9.]+)\)$/.exec(str))) { 166 } else if ((bits = /^rgba\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([0-9.]+)\)$/.exec(str))) {
167 return [parseInt(bits[1], 10), parseInt(bits[2], 10), parseInt(bits[3], 10), parseFloat(bits[4], 10)]; 167 return [parseInt(bits[1], 10), parseInt(bits[2], 10), parseInt(bits[3], 10), parseFloat(bits[4], 10)];
168 } else { 168 } else {
169 throw "Unknow color format '"+str+"'"; 169 throw "Unknow color format '"+str+"'";
170 } 170 }
171}; 171};
172 172
173RrdGfxPdf.prototype.size = function (width, height) 173RrdGfxPdf.prototype.size = function (width, height)
@@ -358,12 +358,12 @@ RrdGfxPdf.prototype.text = function (x, y, color, font, tabwidth, angle, h_align
358 358
359 var tm = []; 359 var tm = [];
360 tm[0] = Math.cos(angle*Math.PI/180.0); 360 tm[0] = Math.cos(angle*Math.PI/180.0);
361 tm[1] = Math.sin(angle*Math.PI/180.0); 361 tm[1] = Math.sin(angle*Math.PI/180.0);
362 tm[2] = -tm[1]; 362 tm[2] = -tm[1];
363 tm[3] = tm[0]; 363 tm[3] = tm[0];
364 364
365 tm[4] = x + (tm[1] * y) - (tm[0] * x); 365 tm[4] = x + (tm[1] * y) - (tm[0] * x);
366 tm[5] = y - (tm[0] * y) - (tm[1] * x); 366 tm[5] = y - (tm[0] * y) - (tm[1] * x);
367 367
368 var rgba = this.parse_color(color); 368 var rgba = this.parse_color(color);
369 this._save(); 369 this._save();