source: trunk/phpgwapi/js/htmlarea/plugins/UploadImage/popups/ImageEditor/jscripts/wz_jsgraphics.js @ 2

Revision 2, 20.3 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1/***********************************************************************
2** Title.........:  Javascript Graphics
3** Version.......:  1.0
4** Author........:  Xiang Wei ZHUO <wei@zhuo.org>
5** Filename......:  wz_jsgraphics.js
6** Last changed..:  31 Aug 2003 
7** Notes.........:  Modified for Image Editor, added extra commands
8**/
9
10/* This notice must be untouched at all times.
11
12wz_jsgraphics.js    v. 2.03
13The latest version is available at
14http://www.walterzorn.com
15or http://www.devira.com
16or http://www.walterzorn.de
17
18Copyright (c) 2002-2003 Walter Zorn. All rights reserved.
19Created 3. 11. 2002 by Walter Zorn <walter@kreuzotter.de>
20Last modified: 11. 6. 2003
21
22High Performance JavaScript Graphics Library.
23Provides methods
24- to draw lines, rectangles, ellipses, polygons
25  with specifiable line thickness,
26- to fill rectangles and ellipses
27- to draw text.
28NOTE: Operations, functions and branching have rather been optimized
29to efficiency and speed than to shortness of source code.
30
31This program is free software;
32you can redistribute it and/or modify it under the terms of the
33GNU General Public License as published by the Free Software Foundation;
34either version 2 of the License, or (at your option) any later version.
35This program is distributed in the hope that it will be useful,
36but WITHOUT ANY WARRANTY;
37without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
38See the GNU General Public License
39at http://www.gnu.org/copyleft/gpl.html for more details.
40*/
41
42
43
44
45
46var jg_ihtm, jg_ie, jg_dom,
47jg_n4 = (document.layers && typeof document.classes != "undefined");
48
49
50
51
52
53function chkDHTM(x, i)
54{
55    x = document.body || null;
56    jg_ie = (x && typeof x.insertAdjacentHTML != "undefined");
57    jg_dom = (x && !jg_ie &&
58        typeof x.appendChild != "undefined" &&
59        typeof document.createRange != "undefined" &&
60        typeof (i = document.createRange()).setStartBefore != "undefined" &&
61        typeof i.createContextualFragment != "undefined");
62    jg_ihtm = (!jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined");
63}
64
65
66
67
68
69function pntDoc()
70{
71    this.wnd.document.write(this.htm);
72    this.htm = '';
73}
74
75
76
77
78
79function pntCnvDom()
80{
81    var x = document.createRange();
82    x.setStartBefore(this.cnv);
83    x = x.createContextualFragment(this.htm);
84    this.cnv.appendChild(x);
85    this.htm = '';
86}
87
88
89
90
91
92function pntCnvIe()
93{
94    this.cnv.insertAdjacentHTML("BeforeEnd", this.htm);
95    this.htm = '';
96}
97
98
99
100
101
102function pntCnvIhtm()
103{
104    this.cnv.innerHTML += this.htm;
105    this.htm = '';
106}
107
108
109
110
111
112function pntCnv()
113{
114    this.htm = '';
115}
116
117
118
119
120
121function mkDiv(x, y, w, h)
122{
123    this.htm += '<div style="position:absolute;'+
124        'left:' + x + 'px;'+
125        'top:' + y + 'px;'+
126        'width:' + w + 'px;'+
127        'height:' + h + 'px;'+
128        'clip:rect(0,'+w+'px,'+h+'px,0);'+
129        'overflow:hidden;background-color:' + this.color + ';'+
130        '"><\/div>';
131
132    //alert(this.htm);
133}
134
135
136
137
138function mkDivPrint(x, y, w, h)
139{
140    this.htm += '<div style="position:absolute;'+
141        'border-left:' + w + 'px solid ' + this.color + ';'+
142        'left:' + x + 'px;'+
143        'top:' + y + 'px;'+
144        'width:' + w + 'px;'+
145        'height:' + h + 'px;'+
146        'clip:rect(0,'+w+'px,'+h+'px,0);'+
147        'overflow:hidden;background-color:' + this.color + ';'+
148        '"><\/div>';
149}
150
151
152
153
154
155function mkLyr(x, y, w, h)
156{
157    this.htm += '<layer '+
158        'left="' + x + '" '+
159        'top="' + y + '" '+
160        'width="' + w + '" '+
161        'height="' + h + '" '+
162        'bgcolor="' + this.color + '"><\/layer>\n';
163}
164
165
166
167
168
169function mkLbl(txt, x, y)
170{
171    this.htm += '<div style="position:absolute;white-space:nowrap;'+
172        'left:' + x + 'px;'+
173        'top:' + y + 'px;'+
174        'font-family:' +  this.ftFam + ';'+
175        'font-size:' + this.ftSz + ';'+
176        'color:' + this.color + ';' + this.ftSty + '">'+
177        txt +
178        '<\/div>';
179}
180
181
182
183
184
185function mkLin(x1, y1, x2, y2)
186{
187    if (x1 > x2)
188    {
189        var _x2 = x2;
190        var _y2 = y2;
191        x2 = x1;
192        y2 = y1;
193        x1 = _x2;
194        y1 = _y2;
195    }
196    var dx = x2-x1, dy = Math.abs(y2-y1),
197    x = x1, y = y1,
198    yIncr = (y1 > y2)? -1 : 1;
199
200    if (dx >= dy)
201    {
202        var pr = dy<<1,
203        pru = pr - (dx<<1),
204        p = pr-dx,
205        ox = x;
206        while ((dx--) > 0)
207        {
208            ++x;
209            if (p > 0)
210            {
211                this.mkDiv(ox, y, x-ox, 1);
212                y += yIncr;
213                p += pru;
214                ox = x;
215            }
216            else p += pr;
217        }
218        this.mkDiv(ox, y, x2-ox+1, 1);
219    }
220
221    else
222    {
223        var pr = dx<<1,
224        pru = pr - (dy<<1),
225        p = pr-dy,
226        oy = y;
227        if (y2 <= y1)
228        {
229            while ((dy--) > 0)
230            {
231                if (p > 0)
232                {
233                    this.mkDiv(x++, y, 1, oy-y+1);
234                    y += yIncr;
235                    p += pru;
236                    oy = y;
237                }
238                else
239                {
240                    y += yIncr;
241                    p += pr;
242                }
243            }
244            this.mkDiv(x2, y2, 1, oy-y2+1);
245        }
246        else
247        {
248            while ((dy--) > 0)
249            {
250                y += yIncr;
251                if (p > 0)
252                {
253                    this.mkDiv(x++, oy, 1, y-oy);
254                    p += pru;
255                    oy = y;
256                }
257                else p += pr;
258            }
259            this.mkDiv(x2, oy, 1, y2-oy+1);
260        }
261    }
262}
263
264
265
266
267
268function mkLin2D(x1, y1, x2, y2)
269{
270    if (x1 > x2)
271    {
272        var _x2 = x2;
273        var _y2 = y2;
274        x2 = x1;
275        y2 = y1;
276        x1 = _x2;
277        y1 = _y2;
278    }
279    var dx = x2-x1, dy = Math.abs(y2-y1),
280    x = x1, y = y1,
281    yIncr = (y1 > y2)? -1 : 1;
282
283
284    var s = this.stroke;
285    if (dx >= dy)
286    {
287        if (s-0x3 > 0)
288        {
289            var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;
290            _s = (!(s-0x4)? Math.ceil(_s) : Math.round(_s)) + 1;
291        }
292        else var _s = s;
293        var ad = Math.ceil(s/2);
294
295        var pr = dy<<1,
296        pru = pr - (dx<<1),
297        p = pr-dx,
298        ox = x;
299        while ((dx--) > 0)
300        {
301            ++x;
302            if (p > 0)
303            {
304                this.mkDiv(ox, y, x-ox+ad, _s);
305                y += yIncr;
306                p += pru;
307                ox = x;
308            }
309            else p += pr;
310        }
311        this.mkDiv(ox, y, x2-ox+ad+1, _s);
312    }
313
314    else
315    {
316        if (s-0x3 > 0)
317        {
318            var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;
319            _s = (!(s-0x4)? Math.ceil(_s) : Math.round(_s)) + 1;
320        }
321        else var _s = s;
322        var ad = Math.round(s/2);
323
324        var pr = dx<<1,
325        pru = pr - (dy<<1),
326        p = pr-dy,
327        oy = y;
328        if (y2 <= y1)
329        {
330            ++ad;
331            while ((dy--) > 0)
332            {
333                if (p > 0)
334                {
335                    this.mkDiv(x++, y, _s, oy-y+ad);
336                    y += yIncr;
337                    p += pru;
338                    oy = y;
339                }
340                else
341                {
342                    y += yIncr;
343                    p += pr;
344                }
345            }
346            this.mkDiv(x2, y2, _s, oy-y2+ad);
347        }
348        else
349        {
350            while ((dy--) > 0)
351            {
352                y += yIncr;
353                if (p > 0)
354                {
355                    this.mkDiv(x++, oy, _s, y-oy+ad);
356                    p += pru;
357                    oy = y;
358                }
359                else p += pr;
360            }
361            this.mkDiv(x2, oy, _s, y2-oy+ad+1);
362        }
363    }
364}
365
366
367
368
369
370function mkLinDott(x1, y1, x2, y2)
371{
372    if (x1 > x2)
373    {
374        var _x2 = x2;
375        var _y2 = y2;
376        x2 = x1;
377        y2 = y1;
378        x1 = _x2;
379        y1 = _y2;
380    }
381    var dx = x2-x1, dy = Math.abs(y2-y1),
382    x = x1, y = y1,
383    yIncr = (y1 > y2)? -1 : 1,
384    drw = true;
385    if (dx >= dy)
386    {
387        var pr = dy<<1,
388        pru = pr - (dx<<1),
389        p = pr-dx;
390        while ((dx--) > 0)
391        {
392            if (drw) this.mkDiv(x, y, 1, 1);
393            drw = !drw;
394            if (p > 0)
395            {
396                y += yIncr;
397                p += pru;
398            }
399            else p += pr;
400            ++x;
401        }
402        if (drw) this.mkDiv(x, y, 1, 1);
403    }
404
405    else
406    {
407        var pr = dx<<1,
408        pru = pr - (dy<<1),
409        p = pr-dy;
410        while ((dy--) > 0)
411        {
412            if (drw) this.mkDiv(x, y, 1, 1);
413            drw = !drw;
414            y += yIncr;
415            if (p > 0)
416            {
417                ++x;
418                p += pru;
419            }
420            else p += pr;
421        }
422        if (drw) this.mkDiv(x, y, 1, 1);
423    }
424}
425
426
427
428
429
430function mkOv(left, top, width, height)
431{
432    var a = width>>1, b = height>>1,
433    wod = width&1, hod = (height&1)+1,
434    cx = left+a, cy = top+b,
435    x = 0, y = b,
436    ox = 0, oy = b,
437    aa = (a*a)<<1, bb = (b*b)<<1,
438    st = (aa>>1)*(1-(b<<1)) + bb,
439    tt = (bb>>1) - aa*((b<<1)-1),
440    w, h;
441    while (y > 0)
442    {
443        if (st < 0)
444        {
445            st += bb*((x<<1)+0x3);
446            tt += (bb<<1)*(++x);
447        }
448        else if (tt < 0)
449        {
450            st += bb*((x<<1)+0x3) - (aa<<1)*(y-1);
451            tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3);
452            w = x-ox;
453            h = oy-y;
454            if (w&0x2 && h&0x2)
455            {
456                this.mkOvQds(cx, cy, -x+0x2, ox+wod, -oy, oy-1+hod, 1, 1);
457                this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1);
458            }
459            else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h);
460            ox = x;
461            oy = y;
462        }
463        else
464        {
465            tt -= aa*((y<<1)-0x3);
466            st -= (aa<<1)*(--y);
467        }
468    }
469    this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod);
470    this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod);
471}
472
473
474
475
476
477function mkOv2D(left, top, width, height)
478{
479    var s = this.stroke;
480    width += s-1;
481    height += s-1;
482    var a = width>>1, b = height>>1,
483    wod = width&1, hod = (height&1)+1,
484    cx = left+a, cy = top+b,
485    x = 0, y = b,
486    aa = (a*a)<<1, bb = (b*b)<<1,
487    st = (aa>>1)*(1-(b<<1)) + bb,
488    tt = (bb>>1) - aa*((b<<1)-1);
489
490
491    if (s-0x4 < 0 && (!(s-0x2) || width-0x33 > 0 && height-0x33 > 0))
492    {
493        var ox = 0, oy = b,
494        w, h,
495        pxl, pxr, pxt, pxb, pxw;
496        while (y > 0)
497        {
498            if (st < 0)
499            {
500                st += bb*((x<<1)+0x3);
501                tt += (bb<<1)*(++x);
502            }
503            else if (tt < 0)
504            {
505                st += bb*((x<<1)+0x3) - (aa<<1)*(y-1);
506                tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3);
507                w = x-ox;
508                h = oy-y;
509
510                if (w-1)
511                {
512                    pxw = w+1+(s&1);
513                    h = s;
514                }
515                else if (h-1)
516                {
517                    pxw = s;
518                    h += 1+(s&1);
519                }
520                else pxw = h = s;
521                this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h);
522                ox = x;
523                oy = y;
524            }
525            else
526            {
527                tt -= aa*((y<<1)-0x3);
528                st -= (aa<<1)*(--y);
529            }
530        }
531        this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);
532        this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod);
533    }
534
535
536    else
537    {
538        var _a = (width-((s-1)<<1))>>1,
539        _b = (height-((s-1)<<1))>>1,
540        _x = 0, _y = _b,
541        _aa = (_a*_a)<<1, _bb = (_b*_b)<<1,
542        _st = (_aa>>1)*(1-(_b<<1)) + _bb,
543        _tt = (_bb>>1) - _aa*((_b<<1)-1),
544
545        pxl = new Array(),
546        pxt = new Array(),
547        _pxb = new Array();
548        pxl[0] = 0;
549        pxt[0] = b;
550        _pxb[0] = _b-1;
551        while (y > 0)
552        {
553            if (st < 0)
554            {
555                st += bb*((x<<1)+0x3);
556                tt += (bb<<1)*(++x);
557                pxl[pxl.length] = x;
558                pxt[pxt.length] = y;
559            }
560            else if (tt < 0)
561            {
562                st += bb*((x<<1)+0x3) - (aa<<1)*(y-1);
563                tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3);
564                pxl[pxl.length] = x;
565                pxt[pxt.length] = y;
566            }
567            else
568            {
569                tt -= aa*((y<<1)-0x3);
570                st -= (aa<<1)*(--y);
571            }
572
573            if (_y > 0)
574            {
575                if (_st < 0)
576                {
577                    _st += _bb*((_x<<1)+0x3);
578                    _tt += (_bb<<1)*(++_x);
579                    _pxb[_pxb.length] = _y-1;
580                }
581                else if (_tt < 0)
582                {
583                    _st += _bb*((_x<<1)+0x3) - (_aa<<1)*(_y-1);
584                    _tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-0x3);
585                    _pxb[_pxb.length] = _y-1;
586                }
587                else
588                {
589                    _tt -= _aa*((_y<<1)-0x3);
590                    _st -= (_aa<<1)*(--_y);
591                    _pxb[_pxb.length-1]--;
592                }
593            }
594        }
595
596        var ox = 0, oy = b,
597        _oy = _pxb[0],
598        l = pxl.length,
599        w, h;
600        for (var i = 0; i < l; i++)
601        {
602            if (typeof _pxb[i] != "undefined")
603            {
604                if (_pxb[i] < _oy || pxt[i] < oy)
605                {
606                    x = pxl[i];
607                    this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy);
608                    ox = x;
609                    oy = pxt[i];
610                    _oy = _pxb[i];
611                }
612            }
613            else
614            {
615                x = pxl[i];
616                this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod);
617                this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
618                ox = x;
619                oy = pxt[i];
620            }
621        }
622        this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);
623        this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
624    }
625}
626
627
628
629
630
631function mkOvDott(left, top, width, height)
632{
633    var a = width>>1, b = height>>1,
634    wod = width&1, hod = height&1,
635    cx = left+a, cy = top+b,
636    x = 0, y = b,
637    aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,
638    st = (aa2>>1)*(1-(b<<1)) + bb,
639    tt = (bb>>1) - aa2*((b<<1)-1),
640    drw = true;
641    while (y > 0)
642    {
643        if (st < 0)
644        {
645            st += bb*((x<<1)+0x3);
646            tt += (bb<<1)*(++x);
647        }
648        else if (tt < 0)
649        {
650            st += bb*((x<<1)+0x3) - aa4*(y-1);
651            tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-0x3);
652        }
653        else
654        {
655            tt -= aa2*((y<<1)-0x3);
656            st -= aa4*(--y);
657        }
658        if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1);
659        drw = !drw;
660    }
661}
662
663
664
665
666
667function mkRect(x, y, w, h)
668{
669    var s = this.stroke;
670    this.mkDiv(x, y, w, s);
671    this.mkDiv(x+w, y, s, h);
672    this.mkDiv(x, y+h, w+s, s);
673    this.mkDiv(x, y+s, s, h-s);
674}
675
676
677
678
679
680function mkRectDott(x, y, w, h)
681{
682    this.drawLine(x, y, x+w, y);
683    this.drawLine(x+w, y, x+w, y+h);
684    this.drawLine(x, y+h, x+w, y+h);
685    this.drawLine(x, y, x, y+h);
686}
687
688
689
690
691
692function jsgFont()
693{
694    this.PLAIN = 'font-weight:normal;';
695    this.BOLD = 'font-weight:bold;';
696    this.ITALIC = 'font-style:italic;';
697    this.ITALIC_BOLD = this.ITALIC + this.BOLD;
698    this.BOLD_ITALIC = this.ITALIC_BOLD;
699}
700var Font = new jsgFont();
701
702
703
704
705
706function jsgStroke()
707{
708    this.DOTTED = -1;
709}
710var Stroke = new jsgStroke();
711
712
713
714
715
716function jsGraphics(id, wnd)
717{
718    this.setColor = new Function('arg', 'this.color = arg;');
719
720
721    this.getColor = new Function('return this.color');
722
723    this.setStroke = function(x)
724    {
725        this.stroke = x;
726        if (!(x+1))
727        {
728            this.drawLine = mkLinDott;
729            this.mkOv = mkOvDott;
730            this.drawRect = mkRectDott;
731        }
732        else if (x-1 > 0)
733        {
734            this.drawLine = mkLin2D;
735            this.mkOv = mkOv2D;
736            this.drawRect = mkRect;
737        }
738        else
739        {
740            this.drawLine = mkLin;
741            this.mkOv = mkOv;
742            this.drawRect = mkRect;
743        }
744    };
745
746
747
748    this.setPrintable = function(arg)
749    {
750        this.printable = arg;
751        this.mkDiv = jg_n4? mkLyr : arg? mkDivPrint : mkDiv;
752    };
753
754
755
756    this.setFont = function(fam, sz, sty)
757    {
758        this.ftFam = fam;
759        this.ftSz = sz;
760        this.ftSty = sty || Font.PLAIN;
761    };
762
763
764
765    this.drawPolyline = this.drawPolyLine = function(x, y, s)
766    {
767        var i = x.length-1; while (i >= 0)
768            this.drawLine(x[i], y[i], x[--i], y[i]);
769    };
770
771
772
773    this.fillRect = function(x, y, w, h)
774    {
775        this.mkDiv(x, y, w, h);
776    };
777
778
779    this.fillRectPattern = function(x, y, w, h, url)
780    {
781        this.htm += '<div style="position:absolute;'+
782            'left:' + x + 'px;'+
783            'top:' + y + 'px;'+
784            'width:' + w + 'px;'+
785            'height:' + h + 'px;'+
786            'clip:rect(0,'+w+'px,'+h+'px,0);'+
787            'overflow:hidden;'+
788            //'background-color:' + this.color + ';'+
789            "background-image: url('" + url + "');"+
790            "layer-background-image: url('" + url + "');"+
791            'z-index:100;"><\/div>';
792        //alert(this.htm);
793    }
794
795    this.drawHandle = function(x, y, w, h, cursor)
796    {
797       
798        this.htm += '<div style="position:absolute;'+
799        'left:' + x + 'px;'+
800        'top:' + y + 'px;'+
801        'width:' + w + 'px;'+
802        'height:' + h + 'px;'+
803        'clip:rect(0,'+w+'px,'+h+'px,0);'+
804        'padding: 2px;overflow:hidden;'+
805        "cursor: '" + cursor + "';"+
806        '" class="handleBox" id="' + cursor + '" ><\/div>';
807    }
808
809    this.drawHandleBox = function(x, y, w, h, cursor)
810    {
811       
812        this.htm += '<div style="position:absolute;'+
813        'left:' + x + 'px;'+
814        'top:' + y + 'px;'+
815        'width:' + w + 'px;'+
816        'height:' + h + 'px;'+
817        'clip:rect(0,'+(w+2)+'px,'+(h+2)+'px,0);'+
818        'overflow:hidden; border: solid 1px '+ this.color+';'+
819        "cursor: '" + cursor + "';"+
820        '" class="handleBox" id="' + cursor + '" ><\/div>';
821
822       
823    }
824
825    this.drawPolygon = function(x, y)
826    {
827        this.drawPolyline(x, y);
828        this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);
829    };
830
831
832
833    this.drawEllipse = this.drawOval = function(x, y, w, h)
834    {
835        this.mkOv(x, y, w, h);
836    };
837
838
839
840    this.fillEllipse = this.fillOval = function(left, top, w, h)
841    {
842        var a = (w -= 1)>>1, b = (h -= 1)>>1,
843        wod = (w&1)+1, hod = (h&1)+1,
844        cx = left+a, cy = top+b,
845        x = 0, y = b,
846        ox = 0, oy = b,
847        aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,
848        st = (aa2>>1)*(1-(b<<1)) + bb,
849        tt = (bb>>1) - aa2*((b<<1)-1),
850        pxl, dw, dh;
851        if (w+1) while (y > 0)
852        {
853            if (st < 0)
854            {
855                st += bb*((x<<1)+0x3);
856                tt += (bb<<1)*(++x);
857            }
858            else if (tt < 0)
859            {
860                st += bb*((x<<1)+0x3) - aa4*(y-1);
861                pxl = cx-x;
862                dw = (x<<1)+wod;
863                tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-0x3);
864                dh = oy-y;
865                this.mkDiv(pxl, cy-oy, dw, dh);
866                this.mkDiv(pxl, cy+oy-dh+hod, dw, dh);
867                ox = x;
868                oy = y;
869            }
870            else
871            {
872                tt -= aa2*((y<<1)-0x3);
873                st -= aa4*(--y);
874            }
875        }
876        this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod);
877    };
878
879
880
881    this.drawString = mkLbl;
882
883
884
885    this.clear = function()
886    {
887        this.htm = "";
888        if (this.cnv) this.cnv.innerHTML = this.defhtm;
889       
890    };
891
892
893
894    this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h)
895    {
896        this.mkDiv(xr+cx, yt+cy, w, h);
897        this.mkDiv(xr+cx, yb+cy, w, h);
898        this.mkDiv(xl+cx, yb+cy, w, h);
899        this.mkDiv(xl+cx, yt+cy, w, h);
900    };
901
902
903    this.setStroke(1);
904    this.setPrintable(false);
905    this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN);
906    this.color = '#000000';
907    this.htm = '';
908    this.wnd = wnd || window;
909
910
911    if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM();
912    if (typeof id != 'string' || !id) this.paint = pntDoc;
913    else
914    {
915        this.cnv = document.all? (this.wnd.document.all[id] || null)
916            : document.getElementById? (this.wnd.document.getElementById(id) || null)
917            : null;
918        this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : '';
919        this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv;
920    }
921}
Note: See TracBrowser for help on using the repository browser.