TSpectrum2Painter.cxx

Go to the documentation of this file.
00001 // @(#)root/spectrumpainter:$Id: TSpectrum2Painter.cxx,v 1.00
00002 // Author: Miroslav Morhac 29/09/06
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 
00013 //______________________________________________________________________________
00014 //
00015 // Two-dimensional graphics function
00016 //
00017 // TSpectrum2Painter is a set of graphical functions developed by Miroslav
00018 // Morhac to paint 2D-histograms in three dimensions. This package is accessed
00019 // via THistPainter in a transparent way. For the ROOT user it is enough to use
00020 // the "SPEC" option to draw a 2D-Histogram. This option offers many
00021 // functionalities detailed in the header of the PaintSpectrum function.
00022 //
00023 // Reference:
00024 // Morhac M., Kliman J., Matousek V., Turzo I.: Sophisticated visualization
00025 // algorithms for analysis of multidimensional experimental nuclear data. Acta
00026 // Pysica Slovaca Vol. 54/ 4 (2004), pp. 385-400.
00027 
00028 
00029 #include "TROOT.h"
00030 #include "TClass.h"
00031 #include "TClass.h"
00032 #include "TColor.h"
00033 #include "TMath.h"
00034 #include "TLine.h"
00035 #include "TEllipse.h"
00036 #include "TPad.h"
00037 #include "TBox.h"
00038 #include "TF1.h"
00039 #include "TH2.h"
00040 #include "TGaxis.h"
00041 #include "THLimitsFinder.h"
00042 #include "TSpectrum2Painter.h"
00043 
00044 ClassImp (TSpectrum2Painter)
00045 
00046 
00047 //______________________________________________________________________________
00048 TSpectrum2Painter::TSpectrum2Painter(TH2* h2, Int_t bs)
00049    : TNamed ("Spectrum Painter2","Miroslav Morhac Painter")
00050 {
00051    // TSpectrum2Painter normal constructor
00052 
00053    int i, j;
00054    double val;
00055    gPad->Range(0, 0, 1 ,1);
00056    fXmin = 0;
00057    fXmax = h2->GetNbinsX() - 1;
00058    fYmin = 0;
00059    fYmax = h2->GetNbinsY() - 1;
00060    fZmin = 0, fZmax = 0;
00061    fMaximumXScreenResolution = bs;
00062 
00063    for (i = 0;i <= fXmax; i++) {
00064       for (j = 0;j <= fYmax; j++) {
00065          val = h2->GetBinContent(i + 1,j + 1);
00066          if (val > fZmax) fZmax = val;
00067       }
00068    }
00069 
00070    fBx1 = gPad->XtoPixel(0.1); //axis positions
00071    fBx2 = gPad->XtoPixel(0.99);
00072    fBy1 = gPad->YtoPixel(0.99);
00073    fBy2 = gPad->YtoPixel(0.05);
00074 
00075    fModeGroup = kModeGroupLightHeight;
00076 
00077    fDisplayMode = kDisplayModeSurface;
00078 
00079    fZscale = kZScaleLinear; // Scale linear, log.
00080 
00081    fNodesx = fXmax-fXmin+1; // Number of nodes in x dimension of grid
00082    fNodesy = fYmax-fYmin+1; // Number of nodes in y dimension of grid
00083 
00084    fContWidth = 50; // Width between contours,
00085                     // applies only for contours display mode.
00086    fAlpha     = 20; // Angles of display,alfa+beta must be less or equal to 90,
00087                     // alpha- angle between base line of Canvas and left lower
00088                     // edge of picture picture base plane
00089    fBeta      = 60; // Angle between base line of Canvas and right lower edge
00090                     // of picture base plane
00091    fViewAngle = 0;  // Rotation angle of the view,
00092                     // it can be 0, 90, 180, 270 degrees.
00093 
00094    fLevels       = 256; // Number of color levels for rainbowed display modes,
00095                         // It does not apply for simple display modes
00096                         // algorithm group
00097    fRainbow1Step = 1;   // Determines the first component step for
00098                         // neighbouring color levels, applies only for
00099                         // rainbowed display modes, it does not apply for
00100                         // simple display modes algorithm group.
00101    fRainbow2Step = 1;   // Determines the second component step for
00102                         // neighbouring color levels, applies only for
00103                         // rainbowed display modes, it does not apply for
00104                         // simple display modes algorithm group.
00105    fRainbow3Step = 1;   // Determines the third component step for
00106                         // neighbouring color levels, applies only for
00107                         // rainbowed display modes, it does not apply for
00108                         // simple display modes algorithm group.
00109 
00110    fColorAlg = kColorAlgRgbSmooth; // Applies only for rainbowed display modes
00111                                    // (rgb smooth alorithm, rgb modulo color
00112                                    // component, cmy smooth algorithm, cmy
00113                                    // modulo color component, cie smooth
00114                                    // algorithm, cie modulo color component,
00115                                    // yiq smooth algorithm, yiq modulo color
00116                                    // component, hsv smooth algorithm, hsv
00117                                    // modulo color component, it does not
00118                                    // apply for simple display modes
00119                                    // algorithm group.
00120 
00121    fLHweight = 0.5; // Weight between shading according to fictive light
00122                     // source and according to channels counts, applies only
00123                     // for kModeGroupLightHeight modes group.
00124 
00125    fXlight   = 1000; // X position of fictive light source, applies only for
00126                      // rainbowed display modes with shading according to light.
00127    fYlight   = 1000; // Y position of fictive light source, applies only for
00128                      // rainbowed display modes with shading according to light.
00129    fZlight   = 1000; // Z position of fictive light source, applies only for
00130                      // rainbowed display modes with shading according to light.
00131 
00132    fShadow   = kShadowsNotPainted; // Determines whether shadow will be drawn
00133                                    // (no shadow, shadow), for rainbowed
00134                                    // display modes with shading according to
00135                                    // light.
00136 
00137    fShading  = kShaded; // Determines whether the picture will shaded,
00138                         // smoothed (no shading, shading), for rainbowed
00139                         // display modes only.
00140 
00141    fBezier   = kNoBezierInterpol; // Determines Bezier interpolation (applies
00142                                   // only for simple display modes group for
00143                                   // grid, x_lines, y_lines display modes).
00144 
00145    fPenColor = kBlack;         // Color of spectrum.
00146    fPenWidth = 1;              // Width of line.
00147    fPenDash  = kPenStyleSolid; // Style of pen.
00148 
00149    fChanmarkEnDis  = kChannelMarksNotDrawn; // Decides whether the channel
00150                                             // marks are shown.
00151    fChanmarkColor  = kBlue;                 // Color of channel marks.
00152    fChanmarkWidth  = 8;                     // Width of channel marks.
00153    fChanmarkHeight = 8;                     // Height of channel marks.
00154    fChanmarkStyle  = kChannelMarksStyleDot; // Style of channel marks.
00155 
00156    fChanlineEnDis   = kChannelGridNotDrawn; // Decides whether the channel lines
00157                                             // (grid) are shown.
00158    fChanlineColor   = kRed;                 // Color of channel marks.
00159    fNewColor        = 0;
00160    fEnvelope        = new Short_t [fMaximumXScreenResolution];
00161    fEnvelopeContour = new Short_t [fMaximumXScreenResolution];
00162    for (i=0;i<fMaximumXScreenResolution;i++) {
00163       fEnvelope[i]        = fBy2;
00164       fEnvelopeContour[i] = fBy2;
00165    }
00166    fH2 = h2;
00167 }
00168 
00169 
00170 //______________________________________________________________________________
00171 TSpectrum2Painter::~TSpectrum2Painter()
00172 {
00173    // TSpectrum2Painter destructor
00174 
00175    TColor* col;
00176    for (int i=0; i<256; i++) {
00177       col = gROOT->GetColor(250+i);
00178       if (col) delete col;
00179    }
00180 }
00181 
00182 
00183 //______________________________________________________________________________
00184 void TSpectrum2Painter::Transform(Int_t it,Int_t jt,Int_t zmt)
00185 {
00186    // Reads out the value from histogram and calculates screen coordinates
00187    //
00188    // Parameters:
00189    //    -it - node in x- direction
00190    //    -jt - node in y- direction
00191    //    -zmt - control variable
00192 
00193    Int_t lxt,lyt,ix,iy;
00194    Double_t zf = 0;
00195    Double_t p1,p2;
00196    p1        = fXmin+fKx*(Double_t)it;
00197    p2        = fYmin+fKy*(Double_t)jt;
00198    ix        = (Int_t)p1;
00199    iy        = (Int_t)p2;
00200    fDxspline = p1;
00201    fDyspline = p2;
00202    if ((zmt==0)||(zmt==-3)||(zmt==-4)) {
00203       zf = fH2->GetBinContent(ix+1,iy+1);
00204    } else if (zmt==-2) zf = fZPresetValue;
00205    if (zf<fZmin) zf = fZmin;
00206    fZeq = zf;
00207    switch (fZscale) {
00208       case kZScaleLog:
00209          if (zf>=1.0) zf = log(zf);
00210          else         zf = 0;
00211          break;
00212       case kZScaleSqrt:
00213          if (zf>0) zf = sqrt(zf);
00214          else      zf = 0;
00215          break;
00216    }
00217    lxt = (Int_t)(fTxx*(Double_t)it+fTxy*(Double_t)jt+fVx);
00218    lyt = (Int_t)(fTyx*(Double_t)it+fTyy*(Double_t)jt+fTyz*zf+fVy);
00219    if (lxt<fBx1) lxt = fBx1;
00220    if (lxt>fBx2) lxt = fBx2;
00221    if (lyt<fBy1) lyt = fBy1;
00222    if (lyt>fBy2) lyt = fBy2;
00223    fXt = lxt;
00224    fYt = lyt;
00225    fZ  = zf;
00226    return;
00227 }
00228 
00229 
00230 //______________________________________________________________________________
00231 Double_t TSpectrum2Painter::ColorCalculation(
00232          Double_t dx1, Double_t dy1, Double_t z1,
00233          Double_t dx2, Double_t dy2, Double_t z2,
00234          Double_t dx3, Double_t dy3, Double_t z3)
00235 {
00236    // Calculates and returns color value for the surface triangle
00237    // given by function parameters:
00238    //    -dx1,dy1,z1 coordinates of the first point in 3d space
00239    //    -dx2,dy2,z2 coordinates of the second point in 3d space
00240    //    -dx3,dy3,z3 coordinates of the third point in 3d space
00241 
00242    Double_t da,db,dc=0,dd,dl,dm,dn,xtaz,ytaz,ztaz,v=0,v1;
00243    Double_t pi=3.1415927;
00244    Int_t i;
00245    switch (fZscale) {
00246       case kZScaleLog:
00247          if (z1>900) z1 = 900;
00248          z1 = exp(z1);
00249          if (z2>900) z2 = 900;
00250          z2 = exp(z2);
00251          if (z3>900) z3 = 900;
00252          z3 = exp(z3);
00253          break;
00254       case kZScaleSqrt:
00255          z1 = z1*z1;
00256          z2 = z2*z2;
00257          z3 = z3*z3;
00258          break;
00259    }
00260    i = fViewAngle;
00261    i = i/90;
00262    if ((i==1)||(i==3)) {
00263       da  = dx1;
00264       dx1 = dx2;
00265       dx2 = da;
00266       da  = dy1;
00267       dy1 = dy2;
00268       dy2 = da;
00269       da  = z1;
00270       z1  = z2;
00271       z2  = da;
00272    }
00273    xtaz = (dx1+dx2+dx3)/3;
00274    ytaz = (dy1+dy2+dy3)/3;
00275    ztaz = (z1+z2+z3)/3;
00276    if (fModeGroup==kModeGroupLight) {
00277       dn = (Double_t)fZlight-ztaz;
00278       dm = (Double_t)fYlight-ytaz;
00279       dl = (Double_t)fXlight-xtaz;
00280       da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
00281       db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
00282       dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
00283       dd = (da*da+db*db+dc*dc)*(dl*dl+dm*dm+dn*dn);
00284       dd = sqrt(dd);
00285       if (dd!=0) v = (da*dl+db*dm+dc*dn)/dd;
00286       else       v = 0;
00287       if (v<-1) v=-1;
00288       if (v>1) v=1;
00289       v = asin(v);
00290       v = v+pi/2;
00291       v = v/pi;
00292    } else if (fModeGroup==kModeGroupHeight) {
00293       da = fZmax-fZmin;
00294       if (ztaz<fZmin) ztaz=fZmin;
00295       if (ztaz>=fZmax) ztaz=fZmax-1;
00296       db = ztaz-fZmin;
00297       if (da!=0) {
00298          switch (fZscale) {
00299             case kZScaleLinear:
00300                dc = db/da;
00301                break;
00302             case kZScaleLog:
00303                if (da>=1) da=log(da);
00304                if (db>=1) db=log(db);
00305                if (da!=0) dc=db/da;
00306                else dc=0;
00307                break;
00308             case kZScaleSqrt:
00309                da = sqrt(da);
00310                db = sqrt(db);
00311                dc = db/da;
00312                break;
00313          }
00314       } else {
00315          dc=0;
00316       }
00317       i = (Int_t)dc;
00318       v = dc-i;
00319    } else if (fModeGroup==kModeGroupLightHeight) {
00320       dn = (Double_t)fZlight-ztaz;
00321       dm = (Double_t)fYlight-ytaz;
00322       dl = (Double_t)fXlight-xtaz;
00323       da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
00324       db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
00325       dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
00326       dd = (da*da+db*db+dc*dc)*(dl*dl+dm*dm+dn*dn);
00327       dd = sqrt(dd);
00328       if (dd!=0) v = (da*dl+db*dm+dc*dn)/dd;
00329       else v = 0;
00330       if (v<-1) v=-1;
00331       if (v>1) v=1;
00332       v  = asin(v);
00333       v  = v+pi/2;
00334       v  = v/pi;
00335       da = fZmax-fZmin;
00336       if (ztaz<fZmin)  ztaz = fZmin;
00337       if (ztaz>=fZmax) ztaz = fZmax-1;
00338       db = ztaz-fZmin;
00339       if (da!=0) {
00340          switch (fZscale) {
00341             case kZScaleLinear:
00342                dc = db/da;
00343                break;
00344             case kZScaleLog:
00345                if (da>=1) da = log(da);
00346                if (db>=1) db = log(db);
00347                if (da!=0) dc = db/da;
00348                else       dc = 0;
00349                break;
00350             case kZScaleSqrt:
00351                da = sqrt(da);
00352                db = sqrt(db);
00353                dc = db/da;
00354                break;
00355          }
00356       } else {
00357          dc = 0;
00358       }
00359       i  = (Int_t)dc;
00360       v1 = dc-i;
00361       v  = fLHweight*v+(1-fLHweight)*v1;
00362    }
00363    if (fShadow==kShadowsNotPainted) {
00364       da = 1.0/(Double_t)fLevels;
00365       if (v<da) v = da;
00366    } else {
00367       da = 2.0/(Double_t)fLevels;
00368       if (v<da) v = da;
00369    }
00370    return(v);
00371 }
00372 
00373 
00374 //______________________________________________________________________________
00375 Double_t TSpectrum2Painter::ShadowColorCalculation(Double_t xtaz, Double_t ytaz,
00376                                                    Double_t ztaz,
00377                                                    Double_t shad_noise)
00378 {
00379    // Determines whether the center of the triangle in 3-d space
00380    // given by function parameters:
00381    //   -xtaz,ytaz,ztaz
00382    //   is in shadow or not. If yes it return 1 otherwise it returns 0.
00383 
00384    Int_t sx2,sy2,sz1,sz2,skrokx,skroky,xmax,ymax;
00385    Double_t sx1,sy1;
00386    Double_t pom1,pom2,sdx1=0,sdx2=0,sdy1,sdy2,spriz;
00387    switch (fZscale) {
00388       case kZScaleLog:
00389          if (ztaz>900) ztaz = 900;
00390          ztaz = exp(ztaz);
00391          if (ztaz>32767) ztaz = 32767;
00392          break;
00393       case kZScaleSqrt:
00394          ztaz = ztaz*ztaz;
00395          break;
00396    }
00397    spriz = 0;
00398    sx1   = xtaz;
00399    sy1   = ytaz;
00400    sz1   = (Int_t)ztaz;
00401    sx2   = fXlight;
00402    sy2   = fYlight;
00403    sz2   = fZlight;
00404    xmax  = fXmax;
00405    ymax  = fYmax;
00406    if (sx1!=sx2) {
00407       if (sx1<sx2) skrokx =  1;
00408       else         skrokx = -1;
00409       if (sy1<sy2) skroky =  1;
00410       else         skroky = -1;
00411       pom1 = sx2-sx1;
00412       pom2 = sy2-sy1;
00413       if (TMath::Abs(pom1)>0.0000001) sdx1 = pom2/pom1;
00414       pom1 = sx1;
00415       pom2 = sy1;
00416       sdy1 = pom2-sdx1*pom1;
00417       pom1 = sx2-sx1;
00418       pom2 = sz2-sz1;
00419       if (TMath::Abs(pom1)>0.0000001) sdx2 = pom2/pom1;
00420       pom1  = sx1;
00421       pom2  = sz1;
00422       sdy2  = pom2-sdx2*pom1;
00423       spriz = 0;
00424       pom1  = sx1;
00425       pom2  = pom1*sdx1+sdy1;
00426       sy1   = pom2;
00427       for (;(sx1>(fXmin-skrokx)) && (sx1<(xmax-skrokx)) &&
00428             (sy1>(fYmin-skroky)) && (sy1<(ymax-skroky)) &&
00429             (spriz==0);sx1+=skrokx) {
00430          pom1 = sx1;
00431          pom2 = pom1*sdx1+sdy1;
00432          sy1  = pom2+skroky;
00433          if ((sy1>=fYmin)&&(sy1<=fYmax)) {
00434             sz1  = (Int_t)(fH2->GetBinContent((Int_t)sx1+1,(Int_t)sy1+1));
00435             pom2 = pom1*sdx2+sdy2;
00436             sz2  = (Int_t)(pom2+shad_noise);
00437             if (sz1>sz2) spriz = 1;
00438          }
00439       }
00440    } else if (sy1!=sy2) {
00441       if (sy1<sy2) skroky =  1;
00442       else         skroky = -1;
00443       pom1 = sy2-sy1;
00444       pom2 = sz2-sz1;
00445       if (TMath::Abs(pom1)>0.0000001) sdx2 = pom2/pom1;
00446       pom1  = sy1;
00447       pom2  = sz1;
00448       sdy2  = pom2-sdx2*pom1;
00449       spriz = 0;
00450       for (;(sy1>(fYmin-skroky)) && (sy1<(ymax-skroky)) &&
00451             (spriz==0);sy1+=skroky) {
00452          sz1  = (Int_t)(fH2->GetBinContent((Int_t)sx1+1,(Int_t)sy1+1));
00453          pom1 = sy1;
00454          pom2 = pom1*sdx2+sdy2;
00455          sz2  = (Int_t)(pom2+shad_noise);
00456          if (sz1>sz2) spriz=1;
00457       }
00458    }
00459    return(spriz);
00460 }
00461 
00462 
00463 //______________________________________________________________________________
00464 void TSpectrum2Painter::ColorModel(unsigned ui, unsigned ui1, unsigned ui2,
00465                                    unsigned ui3)
00466 {
00467    // This function calculates color for one palette entry
00468    // given by function parameter ui. Other parameters
00469    //    -ui1,ui2,ui3
00470    //    represent r, g, b color components of the basic pen color.
00471 
00472    unsigned uinc1=0,uinc2=0,uinc3=0,upom,i;
00473    Double_t a,b,c,d,h,v,s,f;
00474    Int_t j,iv=ui;
00475    Double_t red=0,green=0,blue=0;
00476    if (iv<0)        iv = 0;
00477    else if (iv>255) iv = 255;
00478    if (gROOT->GetColor(250+iv)) {
00479       fNewColorIndex = 250+iv;
00480       return;
00481    }
00482    if (fColorAlg%2==0) {
00483       a     = fRainbow1Step;
00484       a     = ui*a;
00485       a     = ui1+a;
00486       uinc1 = (Int_t)a;
00487       upom  = uinc1%256;
00488       i     = (uinc1-upom)/256;
00489       if ((i%2)==0) uinc1 = upom;
00490       else          uinc1 = 255-upom;
00491       b     = fRainbow2Step;
00492       b     = ui*b;
00493       b     = ui2+b;
00494       uinc2 = (Int_t)b;
00495       upom  = uinc2%256;
00496       i     = (uinc2-upom)/256;
00497       if ((i%2)==0) uinc2 = upom;
00498       else          uinc2 = 255-upom;
00499       c     = fRainbow3Step;
00500       c     = ui*c;
00501       c     = ui3+c;
00502       uinc3 = (Int_t)c;
00503       upom  = uinc3%256;
00504       i     = (uinc3-upom)/256;
00505       if ((i%2)==0) uinc3 = upom;
00506       else          uinc3 = 255-upom;
00507       if (fColorAlg==kColorAlgCmySmooth) {
00508          uinc1 = 255-uinc1;
00509          uinc2 = 255-uinc2;
00510          uinc3 = 255-uinc3;
00511       } else if (fColorAlg==kColorAlgCieSmooth) {
00512          a = uinc1;
00513          b = uinc2;
00514          c = uinc3;
00515          d = a+b+c;
00516          if (d!=0) {
00517             a = a/d;
00518             b = b/d;
00519             c = c/d;
00520          }
00521          red   = a*255;
00522          green = b*255;
00523          blue  = c*255;
00524          uinc1 = (Int_t)red;
00525          uinc2 = (Int_t)green;
00526          uinc3 = (Int_t)blue;
00527       } else if (fColorAlg==kColorAlgYiqSmooth) {
00528          a     = uinc1;
00529          b     = uinc2;
00530          c     = uinc3;
00531          a     = a/256;
00532          b     = b/256;
00533          c     = c/256;
00534          red   = a+0.956*b+0.62*c;
00535          green = a-0.272*b-0.647*c;
00536          blue  = a-1.108*b+1.705*c;
00537          if (red>=2)       red   = red-2;
00538          else if (red>=1)  red   = 2-red;
00539          if (green<0)      green = -green;
00540          if (blue>=2)      blue  = blue-2;
00541          else if (blue>=1) blue  = 2-blue;
00542          else if (blue<-1) blue  = 2+blue;
00543          else if (blue<0)  blue  = -blue;
00544          red   = red*255;
00545          green = green*255;
00546          blue  = blue*255;
00547          uinc1 = (Int_t)red;
00548          uinc2 = (Int_t)green;
00549          uinc3 = (Int_t)blue;
00550       } else if (fColorAlg==kColorAlgHvsSmooth) {
00551          h = uinc1;
00552          v = uinc2;
00553          s = uinc3;
00554          h = h/256;
00555          v = v/256;
00556          s = s/256;
00557          if (s==0) {
00558             red   = v;
00559             green = v;
00560             blue  = v;
00561          } else {
00562             if (h==1.0) h=0;
00563             h = 6.0*h;
00564             j = (Int_t)h;
00565             f = h-j;
00566             a = v*(1-s);
00567             b = v*(1-s*f);
00568             c = v*(1-s*(1-f));
00569             switch (j) {
00570                case 0:
00571                   red   = v;
00572                   green = c;
00573                   blue  = a;
00574                   break;
00575                case 1:
00576                   red   = b;
00577                   green = v;
00578                   blue  = a;
00579                   break;
00580                case 2:
00581                   red   = a;
00582                   green = v;
00583                   blue  = c;
00584                   break;
00585                case 3:
00586                   red   = a;
00587                   green = b;
00588                   blue  = v;
00589                   break;
00590                case 4:
00591                   red   = c;
00592                   green = a;
00593                   blue  = v;
00594                   break;
00595                case 5:
00596                   red   = v;
00597                   green = a;
00598                   blue  = b;
00599                   break;
00600             }
00601          }
00602          red   = red*255;
00603          green = green*255;
00604          blue  = blue*255;
00605          uinc1 = (Int_t)red;
00606          uinc2 = (Int_t)green;
00607          uinc3 = (Int_t)blue;
00608       }
00609       ui = uinc1+uinc2*256+uinc3*65536;
00610    } else if (fColorAlg%2==1) {
00611       a     = fRainbow1Step;
00612       a     = ui*a;
00613       a     = ui1/2+a;
00614       uinc1 = (Int_t)a;
00615       uinc1 = uinc1%256;
00616       b     = fRainbow2Step;
00617       b     = ui*b;
00618       b     = ui2/2+b;
00619       uinc2 = (Int_t)b;
00620       uinc2 = uinc2%256;
00621       c     = fRainbow3Step;
00622       c     = ui*c;
00623       c     = ui3/2+c;
00624       uinc3 = (Int_t)c;
00625       uinc3 = uinc3%256;
00626       if (fColorAlg==kColorAlgCmyModulo) {
00627          uinc1 = 255-uinc1;
00628          uinc2 = 255-uinc2;
00629          uinc3 = 255-uinc3;
00630       } else if (fColorAlg==kColorAlgCieModulo) {
00631          a = uinc1;
00632          b = uinc2;
00633          c = uinc3;
00634          d = a+b+c;
00635          if (d!=0) {
00636             a = a/d;
00637             b = b/d;
00638             c = c/d;
00639          }
00640          red   = a*255;
00641          green = b*255;
00642          blue  = c*255;
00643          uinc1 = (Int_t)red;
00644          uinc2 = (Int_t)green;
00645          uinc3 = (Int_t)blue;
00646       } else if (fColorAlg==kColorAlgYiqModulo) {
00647          a     = uinc1;
00648          b     = uinc2;
00649          c     = uinc3;
00650          a     = a/256;
00651          b     = b/256;
00652          c     = c/256;
00653          red   = a+0.956*b+0.62*c;
00654          green = a-0.272*b-0.647*c;
00655          blue  = a-1.108*b+1.705*c;
00656          if (red>=2)       red   = red-2;
00657          else if (red>=1)  red   = red-1;
00658          if (green<0)      green = 1+green;
00659          if (blue>=2)      blue  = blue-2;
00660          else if (blue>=1) blue  = blue-1;
00661          else if (blue<-1) blue  = 2+blue;
00662          else if (blue<0)  blue  = 1+blue;
00663          red   = red*255;
00664          green = green*255;
00665          blue  = blue*255;
00666          uinc1 = (Int_t)red;
00667          uinc2 = (Int_t)green;
00668          uinc3 = (Int_t)blue;
00669       } else if (fColorAlg==kColorAlgHvsModulo) {
00670          h = uinc1;
00671          v = uinc2;
00672          s = uinc3;
00673          h = h/256;
00674          v = v/256;
00675          s = s/256;
00676          if (s==0) {
00677             red   = v;
00678             green = v;
00679             blue  = v;
00680          } else {
00681             if (h==1.0) h = 0;
00682             h = 6.0*h;
00683             j = (Int_t)h;
00684             f = h-j;
00685             a = v*(1-s);
00686             b = v*(1-s*f);
00687             c = v*(1-s*(1-f));
00688             switch (j) {
00689                case 0:
00690                   red   = v;
00691                   green = c;
00692                   blue  = a;
00693                   break;
00694                case 1:
00695                   red   = b;
00696                   green = v;
00697                   blue  = a;
00698                   break;
00699                case 2:
00700                   red   = a;
00701                   green = v;
00702                   blue  = c;
00703                   break;
00704                case 3:
00705                   red   = a;
00706                   green = b;
00707                   blue  = v;
00708                   break;
00709                case 4:
00710                   red   = c;
00711                   green = a;
00712                   blue  = v;
00713                   break;
00714                case 5:
00715                   red   = v;
00716                   green = a;
00717                   blue  = b;
00718                   break;
00719             }
00720          }
00721          red   = red*255;
00722          green = green*255;
00723          blue  = blue*255;
00724          uinc1 = (Int_t)red;
00725          uinc2 = (Int_t)green;
00726          uinc3 = (Int_t)blue;
00727       }
00728       ui = uinc1+uinc2*256+uinc3*65536;
00729    }
00730    red            = uinc1;
00731    green          = uinc2;
00732    blue           = uinc3;
00733    red            = red/255.0;
00734    green          = green/255.0;
00735    blue           = blue/255.0;
00736    fNewColor      = new TColor(250+iv,red,green,blue);
00737    fNewColorIndex = 250+iv;
00738    return;
00739 }
00740 
00741 
00742 //______________________________________________________________________________
00743 Int_t TSpectrum2Painter::BezC(Int_t i)
00744 {
00745    // This function is called from BezierBlend function.
00746 
00747    Int_t j,a;
00748    a = 1;
00749    for (j=i+1;j<=3;j++) a = a*j;
00750    for (j=1;j<=3-i;j++) a = a/j;
00751    return a;
00752 }
00753 
00754 
00755 //______________________________________________________________________________
00756 Double_t TSpectrum2Painter::BezierBlend(Int_t i,Double_t bezf)
00757 {
00758    // This function calculates Bezier approximation.
00759 
00760    Int_t j;
00761    Double_t v;
00762    v = BezC(i);
00763    for (j=1;j<=i;j++)   v = v*bezf;
00764    for (j=1;j<=3-i;j++) v = v*(1-bezf);
00765    return v;
00766 }
00767 
00768 
00769 //______________________________________________________________________________
00770 void TSpectrum2Painter::BezierSmoothing(Double_t bezf)
00771 {
00772    // Calculates screen coordinates of the smoothed point.
00773    // Parameter bezf changes within the interval 0 to 1 in 0.1 steps.
00774 
00775    Int_t i;
00776    Double_t b;
00777    fGbezx = 0;
00778    fGbezy = 0;
00779    for (i=0;i<4;i++) {
00780       b       = BezierBlend(i,bezf);
00781       fGbezx += fBzX[i]*b;
00782       fGbezy += fBzY[i]*b;
00783    }
00784    return;
00785 }
00786 
00787 
00788 //______________________________________________________________________________
00789 void TSpectrum2Painter::Envelope(Int_t x1,Int_t y1,Int_t x2,Int_t y2)
00790 {
00791    // Ensures hidden surface removal.
00792 
00793    Int_t x,y,krok,xold=0,yold=0,prvy,yprv=0;
00794    Double_t fx,fy,fx1,fy1;
00795    if (y1<fBy1) y1 = fBy1;
00796    if (y2<fBy1) y2 = fBy1;
00797    if (x1==x2) {
00798       if ((y1>=fEnvelope[x1]) && (y2>=fEnvelope[x1])) {
00799          if (x1>0) {
00800             if (y1<=fEnvelope[x1-1]||y2<=fEnvelope[x1-1]) {
00801                if (y1>fEnvelope[x1-1]) y1 = fEnvelope[x1-1];
00802                if (y2>fEnvelope[x1-1]) y2 = fEnvelope[x1-1];
00803                fLine = 2;
00804                fXs   = x1;
00805                fYs   = y1;
00806                fXe   = x2;
00807                fYe   = y2;
00808                return;
00809             }
00810          }
00811          if (x1<fBx2) {
00812             if (y1<=fEnvelope[x1+1]||y2<=fEnvelope[x1+1]) {
00813                if (y1>fEnvelope[x1+1]) y1 = fEnvelope[x1+1];
00814                if (y2>fEnvelope[x1+1]) y2 = fEnvelope[x1+1];
00815                fLine = 2;
00816                fXs   = x1;
00817                fYs   = y1;
00818                fXe   = x2;
00819                fYe   = y2;
00820                return;
00821             }
00822          }
00823          fLine=0;
00824          return;
00825       }
00826       if ((y1<fEnvelope[x1]) && (y2<fEnvelope[x1])) {
00827          fLine = 2;
00828          fXs   = x1;
00829          fYs   = y1;
00830          fXe   = x2;
00831          fYe   = y2;
00832          if (y1<y2) fEnvelope[x1] = y1;
00833          else       fEnvelope[x1] = y2;
00834          return;
00835       }
00836       if (y1<y2) {
00837          fLine = 2;
00838          fXs   = x1;
00839          fYs   = y1;
00840          fXe   = x1;
00841          fYe   = fEnvelope[x1];
00842          fEnvelope[x1] = y1;
00843          return;
00844       } else {
00845          fLine = 2;
00846          fXs   = x1;
00847          fYs   = y2;
00848          fXe   = x1;
00849          fYe   = fEnvelope[x1];
00850          fEnvelope[x1] = y2;
00851          return;
00852       }
00853    }
00854    krok  = (x1<x2)? 1:-1;
00855    fLine = 0;
00856    prvy  = 0;
00857    x     = x1;
00858    y     = y1;
00859 l1:
00860    if (y<=fEnvelope[x]) {
00861       xold = x;
00862       yold = y;
00863       if (fLine==0) {
00864          fLine = 1;
00865          if (prvy==1) {
00866             if (yprv<=fEnvelope[x]) fYs = yprv;
00867             else                    fYs = fEnvelope[x];
00868             fXs = x;
00869          } else {
00870             fXs = x;
00871             fYs = y;
00872          }
00873       }
00874       if (x!=x2) fEnvelope[x] = y;
00875    } else {
00876       prvy = 1;
00877       yprv = y;
00878       if (fLine==1) {
00879          fLine = 2;
00880          fXe   = xold;
00881          fYe   = yold;
00882       }
00883    }
00884    if (x1==x2) {
00885       if (y1!=y2) y += (y1<y2)? +1:-1;
00886       if (y!=y2) goto l1;
00887    } else {
00888       x  += krok;
00889       fy1 = y2-y1;
00890       fx1 = x2-x1;
00891       fx  = x-x1;
00892       fy  = fy1*fx/fx1;
00893       y   = (Int_t)(y1+fy);
00894       if (((x<=x2)&&(x1<x2)) || ((x>=x2)&&(x1>x2))) goto l1;
00895    }
00896    return;
00897 }
00898 
00899 
00900 //______________________________________________________________________________
00901 void TSpectrum2Painter::EnvelopeBars(Int_t x1,Int_t y1,Int_t x2,Int_t y2)
00902 {
00903    // Ensures hidden surfuce removal for Bars, BarsX and BarsY
00904    // display modes.
00905 
00906    Int_t x,y,krok,xold=0,yold=0,prvy,xprv,yprv=0;
00907    Double_t fx,fy,fx1,fy1;
00908    if (x1==x2) {
00909       if ((y1>=fEnvelope[x1]) && (y2>=fEnvelope[x1])) {
00910          fLine = 0;
00911          return;
00912       }
00913       if ((y1<fEnvelope[x1]) && (y2<fEnvelope[x1])) {
00914          fLine = 2;
00915          fXs   = x1;
00916          fYs   = y1;
00917          fXe   = x2;
00918          fYe   = y2;
00919          if (y1<y2) fEnvelope[x1] = y1;
00920          else       fEnvelope[x1] = y2;
00921          return;
00922       }
00923       if (y1<y2) {
00924          fLine = 2;
00925          fXs   = x1;
00926          fYs   = y1;
00927          fXe   = x1;
00928          fYe   = fEnvelope[x1];
00929          fEnvelope[x1] = y1;
00930          return;
00931       } else {
00932          fLine = 2;
00933          fXs   = x1;
00934          fYs   = y2;
00935          fXe   = x1;
00936          fYe   = fEnvelope[x1];
00937          fEnvelope[x1] = y2;
00938          return;
00939       }
00940    }
00941    krok  = (x1<x2)? 1:-1;
00942    fLine = 0;
00943    prvy  = 0;
00944    x     = x1;
00945    y     = y1;
00946 l1:
00947    if (y<=fEnvelope[x]) {
00948       xold = x;
00949       yold = y;
00950       if (fLine==0) {
00951          fLine = 1;
00952          if (prvy==1) {
00953             xprv = x;
00954             fXs  = xprv;
00955             fYs  = yprv;
00956          } else {
00957             fXs = x;
00958             fYs = y;
00959          }
00960       }
00961       if (x!=x2) fEnvelope[x] = y;
00962    } else {
00963       prvy = 1;
00964       xprv = x;
00965       yprv = y;
00966       if (fLine==1) {
00967          fLine = 2;
00968          fXe   = xold;
00969          fYe   = yold;
00970       }
00971    }
00972    if (x1==x2) {
00973       if (y1!=y2) y+=(y1<y2)? +1:-1;
00974       if (y!=y2) goto l1;
00975    } else {
00976       x  += krok;
00977       fy1 = y2-y1;
00978       fx1 = x2-x1;
00979       fx  = x-x1;
00980       fy  = fy1*fx/fx1;
00981       y   = (Int_t)(y1+fy);
00982       if (((x<=x2)&&(x1<x2)) || ((x>=x2)&&(x1>x2))) goto l1;
00983    }
00984    return;
00985 }
00986 
00987 
00988 //______________________________________________________________________________
00989 void TSpectrum2Painter::DrawMarker(Int_t x,Int_t y,Int_t w,Int_t h,Int_t type)
00990 {
00991    // Draws channel mark at the screen coordinates x, y. Width of
00992    // the mark is w, height is h and the type of the mark is determined by the
00993    // parameter type.
00994 
00995    TLine *line=new TLine();
00996    TEllipse *ellipse=new TEllipse();
00997    line->SetLineColor(fChanmarkColor);
00998    line->SetLineWidth(1);
00999    line->SetLineStyle(kPenStyleSolid);
01000    ellipse->SetLineColor(fChanmarkColor);
01001    ellipse->SetLineWidth(1);
01002    ellipse->SetLineStyle(kPenStyleSolid);
01003    switch (type) {
01004       case kChannelMarksStyleDot:
01005          ellipse->SetX1(gPad->PixeltoX(x));
01006          ellipse->SetY1(gPad->PixeltoY(y)+1);
01007          ellipse->SetR1(gPad->PixeltoX(w/2));
01008          ellipse->SetR2(gPad->PixeltoY(h/2));
01009          ellipse->SetPhimin(0);
01010          ellipse->SetPhimax(360);
01011          ellipse->SetTheta(0);
01012          ellipse->Paint("");
01013          break;
01014       case kChannelMarksStyleCross:
01015          line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y)+1,
01016                          gPad->PixeltoX(x+w/2),gPad->PixeltoY(y)+1);
01017          line->PaintLine(gPad->PixeltoX(x)    ,gPad->PixeltoY(y-h/2)+1,
01018                          gPad->PixeltoX(x)    ,gPad->PixeltoY(y+h/2+1)+1);
01019          break;
01020       case kChannelMarksStyleStar:
01021          line->PaintLine(gPad->PixeltoX(x-w/2)  ,gPad->PixeltoY(y)+1,
01022                          gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y)+1);
01023          line->PaintLine(gPad->PixeltoX(x)      ,gPad->PixeltoY(y-h/2)+1,
01024                          gPad->PixeltoX(x)      ,gPad->PixeltoY(y+h/2+1)+1);
01025          line->PaintLine(gPad->PixeltoX(x-w/2)  ,gPad->PixeltoY(y-h/2)+1,
01026                          gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y+h/2+1)+1);
01027          line->PaintLine(gPad->PixeltoX(x-w/2)  ,gPad->PixeltoY(y+h/2)+1,
01028                          gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y-h/2-1)+1);
01029          break;
01030       case kChannelMarksStyleRectangle:
01031          line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y-h/2)+1,
01032                          gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1);
01033          line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1,
01034                          gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1);
01035          line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1,
01036                          gPad->PixeltoX(x+w/2),gPad->PixeltoY(y-h/2)+1);
01037          line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y-h/2)+1,
01038                          gPad->PixeltoX(x-w/2),gPad->PixeltoY(y-h/2)+1);
01039          break;
01040       case kChannelMarksStyleX:
01041          line->PaintLine(gPad->PixeltoX(x-w/2)  ,gPad->PixeltoY(y-h/2)+1,
01042                          gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y+h/2+1)+1);
01043          line->PaintLine(gPad->PixeltoX(x-w/2)  ,gPad->PixeltoY(y+h/2)+1,
01044                          gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y-h/2-1)+1);
01045          break;
01046       case kChannelMarksStyleDiamond:
01047          line->PaintLine(gPad->PixeltoX(x)    ,gPad->PixeltoY(y-h/2)+1,
01048                          gPad->PixeltoX(x-w/2),gPad->PixeltoY(y)+1);
01049          line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y)+1,
01050                          gPad->PixeltoX(x)    ,gPad->PixeltoY(y+h/2)+1);
01051          line->PaintLine(gPad->PixeltoX(x)    ,gPad->PixeltoY(y+h/2)+1,
01052                          gPad->PixeltoX(x+w/2),gPad->PixeltoY(y)+1);
01053          line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y)+1,
01054                          gPad->PixeltoX(x)    ,gPad->PixeltoY(y-h/2)+1);
01055          break;
01056       case kChannelMarksStyleTriangle:
01057          line->PaintLine(gPad->PixeltoX(x)    ,gPad->PixeltoY(y-h/2)+1,
01058                          gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1);
01059          line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1,
01060                          gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1);
01061          line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1,
01062                          gPad->PixeltoX(x)    ,gPad->PixeltoY(y-h/2)+1);
01063          break;
01064    }
01065    delete line;
01066    delete ellipse;
01067    return;
01068 }
01069 
01070 
01071 //______________________________________________________________________________
01072 void TSpectrum2Painter::Slice(Double_t xr, Double_t yr, Double_t xs,
01073                               Double_t ys, TLine *line)
01074 {
01075    // Calculates screen coordinates of the line given by two
01076    // nodes for contours display mode. The line is given by two points
01077    // xr, yr, xs, ys. Finally it draws the line.
01078 
01079    Int_t krok,xi,yi,xj,yj,a,b,as,bs,pr,ae,be;
01080    Double_t fx,fy,fx1,fy1;
01081    xi = (Int_t)(fTxx*(xr-fXmin)/fKx+fTxy*(yr-fYmin)/fKy+fVx);
01082    xj = (Int_t)(fTxx*(xs-fXmin)/fKx+fTxy*(ys-fYmin)/fKy+fVx);
01083    yi = (Int_t)(fTyx*(xr-fXmin)/fKx+fTyy*(yr-fYmin)/fKy+fTyz*fZ+fVy);
01084    yj = (Int_t)(fTyx*(xs-fXmin)/fKx+fTyy*(ys-fYmin)/fKy+fTyz*fZ+fVy);
01085    as = xi;
01086    bs = yi;
01087    ae = xj;
01088    be = yj;
01089    a  = xi;
01090    b  = yi;
01091    pr = 0;
01092    krok = (xi<xj)? 1:-1;
01093 l1:
01094    if (b<=fEnvelope[a]) {
01095       fEnvelopeContour[a] = b;
01096       if (pr==0) {
01097          pr = 1;
01098          as = a;
01099          bs = b;
01100       }
01101    } else {
01102       if (pr==1) {
01103          pr = 2;
01104          ae = a;
01105          be = b;
01106       }
01107    }
01108    if (xi==xj) {
01109       if (yi!=yj) b += (yi<yj)? +1:-1;
01110       if (b!=yj)  goto l1;
01111    } else {
01112       a  += krok;
01113       fy1 = yj-yi;
01114       fx1 = xj-xi;
01115       fx  = a-xi;
01116       fy  = fy1*fx/fx1;
01117       b   = (Int_t)(yi+fy);
01118       if (a!=xj) goto l1;
01119    }
01120    if (pr!=0) {
01121       if (pr==1) {
01122          ae = xj;
01123          be = yj;
01124       }
01125       line->PaintLine(gPad->PixeltoX(as),gPad->PixeltoY(bs)+1,
01126                       gPad->PixeltoX(ae),gPad->PixeltoY(be)+1);
01127    }
01128    return;
01129 }
01130 
01131 
01132 //______________________________________________________________________________
01133 void TSpectrum2Painter::CopyEnvelope(Double_t xr, Double_t xs, Double_t yr,
01134                                      Double_t ys)
01135 {
01136    // Copies envelope vector, which ensures hidden surface removal for the
01137    // contours display mode.
01138 
01139    Int_t xi,xj,a;
01140    xi = (Int_t)(fTxx*(xr-fXmin)/fKx+fTxy*(yr-fYmin)/fKy+fVx);
01141    xj = (Int_t)(fTxx*(xs-fXmin)/fKx+fTxy*(ys-fYmin)/fKy+fVx);
01142    if (xi<xj) {
01143       for (a=xi;a<=xj;a++) {
01144          if (fEnvelopeContour[a]<fEnvelope[a])
01145             fEnvelope[a] = fEnvelopeContour[a];
01146          fEnvelopeContour[a] = fBy2;
01147       }
01148    } else if (xj<xi) {
01149       for (a=xj;a<=xi;a++) {
01150          if (fEnvelopeContour[a]<fEnvelope[a])
01151             fEnvelope[a] = fEnvelopeContour[a];
01152          fEnvelopeContour[a] = fBy2;
01153       }
01154    }
01155    return;
01156 }
01157 
01158 
01159 //______________________________________________________________________________
01160 void TSpectrum2Painter::Paint(Option_t * /*option*/)
01161 {
01162    // Paints histogram according to preset parameters.
01163 //Begin_Html <!--
01164 /* -->
01165 <h1>Visualization</h1>
01166 <h2><i>Goal: to present 2-dimensional spectra in suitable visual form</i></h2>
01167 This package has several display mode groups and display modes, which can be
01168 employed for the presentation of 2-dimensional histograms
01169 <h2><i>Display modes groups:</i></h2>
01170 <ul>
01171 <p><li><b>kModeGroupSimple</b>      - it covers simple display modes using one
01172                                       color only
01173 <p><li><b>kModeGroupLight</b>       - in this group the shading is carried out
01174                                       according to the position of the fictive
01175                                       light source
01176 <p><li><b>kModeGroupHeight</b>      - in this group the shading is carried out
01177                                       according to the channel contents
01178 <p><li><b>kModeGroupLightHeight</b> - combination of two previous shading
01179                                       algorithms. One can control the weight
01180                                       between both algorithms.
01181 </ul>
01182 <h2><i>Display modes:</i></h2>
01183 <ul>
01184 <p><li><b>kDisplayModePoints, </b>
01185 <p><li><b>kDisplayModeGrid, </b>
01186 <p><li><b>kDisplayModeContours,</b>
01187 <p><li><b>kDisplayModeBars,</b>
01188 <p><li><b>kDisplayModeLinesX,</b>
01189 <p><li><b>kDisplayModeLinesY,</b>
01190 <p><li><b>kDisplayModeBarsX,</b>
01191 <p><li><b>kDisplayModeBarsY,</b>
01192 <p><li><b>kDisplayModeNeedles,</b>
01193 <p><li><b>kDisplayModeSurface,</b>
01194 <p><li><b>kDisplayModeTriangles.</b>
01195 </ul>
01196 one can combine the above given modes groups and display modes. The meaningful
01197 combinations (denoted by x) are given in the next table.
01198 <p>
01199 <center>
01200 <table border=1 cellspacing=0 cellpadding=0>
01201 <tr><th></th><th>Simple</th><th>Light</th><th>Height</th><th>Light-Height</th>
01202 </tr>
01203 <tr><th>Points   </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
01204 <tr><th>Grid     </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
01205 <tr><th>Contours </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
01206 <tr><th>Bars     </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
01207 <tr><th>LinesX   </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
01208 <tr><th>LinesY   </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
01209 <tr><th>BarsX    </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
01210 <tr><th>BarsY    </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
01211 <tr><th>Needles  </th><th>X</th><th>-</th><th>-</th><th>-</th></tr>
01212 <tr><th>Surface  </th><th>-</th><th>X</th><th>X</th><th>X</th></tr>
01213 <tr><th>Triangles</th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
01214 </table></center>
01215 <h2><i>Function:</i></h2>
01216 <h2>void TSpectrum2Painter::SetDisplayMode (Int_t modeGroup, Int_t displayMode)</h2>
01217 <p>
01218 This function controls the display mode group and display mode of the
01219 histogram drawing. To illustrate the possible effects of the various display
01220 modes we introduce a set of examples. Default values:
01221 <ul>
01222 <p><li> <b>modeGroup = kModeGroupLightHeight </b>
01223 <p><li> <b>displayMode = kDisplayModeSurface </b>
01224 </ul>
01225 <p><center><img src="gif/spectrumpainter001.jpg"></center>
01226 <p>Simple modes group, display mode = points, 256 x 256 channels.
01227 <p><center><img src="gif/spectrumpainter002.jpg"></center>
01228 <p>Simple modes group, display mode = grid, 64 x 64 channels.
01229 <p><center><img src="gif/spectrumpainter003.jpg"></center>
01230 <p>Simple modes group, display mode = contours, 64 x 64 channels.
01231 <p><center><img src="gif/spectrumpainter004.jpg"></center>
01232 <p>Simple modes group, display mode = bars, 64 x 64 channels.
01233 <p><center><img src="gif/spectrumpainter005.jpg"></center>
01234 <p>Simple modes group, display mode = linesX, 64 x 64 channels.
01235 <p><center><img src="gif/spectrumpainter006.jpg"></center>
01236 <p>Simple modes group, display mode = linesY, 64 x 64 channels.
01237 <p><center><img src="gif/spectrumpainter007.jpg"></center>
01238 <p>Simple modes group, display mode = barsX, 64 x 64 channels.
01239 <p><center><img src="gif/spectrumpainter008.jpg"></center>
01240 <p>Simple modes group, display mode = barsY, 64 x 64 channels.
01241 <p><center><img src="gif/spectrumpainter009.jpg"></center>
01242 <p>Simple modes group, display mode = needles, 64 x 64 channels.
01243 <p><center><img src="gif/spectrumpainter010.jpg"></center>
01244 <p>Simple modes group, display mode = triangles, 64 x 64 channels.
01245 <p><center><img src="gif/spectrumpainter011.jpg"></center>
01246 <p>Light modes group, display mode = points, 256 x 256 channels.
01247 <p><center><img src="gif/spectrumpainter012.jpg"></center>
01248 <p>Light modes group, display mode = grid, 256 x 256 channels.
01249 <p><center><img src="gif/spectrumpainter013.jpg"></center>
01250 <p>Light modes group, display mode = surface, 64 x 64 channels.
01251 <p><center><img src="gif/spectrumpainter014.jpg"></center>
01252 <p>Light modes group, display mode = triangles, 64 x 64 channels.
01253 <p><center><img src="gif/spectrumpainter015.jpg"></center>
01254 <p>Height modes group, display mode = points, 256 x 256 channels.
01255 <p><center><img src="gif/spectrumpainter016.jpg"></center>
01256 <p>Height modes group, display mode = grid, 256 x 256 channels.
01257 <p><center><img src="gif/spectrumpainter017.jpg"></center>
01258 <p>Height modes group, display mode = contours, 64 x 64 channels.
01259 <p><center><img src="gif/spectrumpainter018.jpg"></center>
01260 <p>Height modes group, display mode = bars, 64 x 64 channels.
01261 <p><center><img src="gif/spectrumpainter019.jpg"></center>
01262 <p>Height modes group, display mode = surface, 64 x 64 channels.
01263 <p><center><img src="gif/spectrumpainter020.jpg"></center>
01264 <p>Height modes group, display mode = triangles, 64 x 64 channels.
01265 <p><center><img src="gif/spectrumpainter021.jpg"></center>
01266 <p>
01267 Light - height modes group, display mode = surface, 64 x 64 channels. The weight
01268 between both shading algorithms is set to 0.5. One can observe the influence of
01269 both shadings.
01270 <h2><i>Function:</i></h2>
01271 <h2>TSpectrum2Painter::SetPenAttr(Int_t color,Int_t style,Int_t width)</h2>
01272 <p>
01273 Using this function one can change pen color, pen style and pen width.
01274 Possible pen styles are:
01275 <ul>
01276 <p><li><b> kPenStyleSolid,</b>
01277 <p><li><b> kPenStyleDash,</b>
01278 <p><li><b> kPenStyleDot,</b>
01279 <p><li><b> kPenStyleDashDot.</b>
01280 </ul>
01281 <p>Default values:
01282 <ul>
01283 <p><li><b> color = kBlack</b>
01284 <p><li><b> style = kPenStyleSolid</b>
01285 <p><li><b> width = 1</b>
01286 </ul>
01287 <p><center><img src="gif/spectrumpainter022.jpg"></center>
01288 <p>Simple modes group, display mode = linesX, 64 x 64 channels. Pen width = 3.
01289 <h2><i>Function:</i></h2>
01290 <h2>TSpectrum2Painter::SetNodes(Int_t nodesx,Int_t nodesy)</h2>
01291 <p>Sometimes the displayed region is rather large. When displaying all channels
01292 pictures become very dense and complicated. It is very difficult to understand
01293 overall shape of the data. Therefore in the package we have implemented the
01294 possibility to change the density of displayed channels. Only channels
01295 coinciding with given nodes are displayed. In the next figure we introduce the
01296 example of the above presented spectrum with number of nodes set to 64x64.
01297 <p>Default values:
01298 <ul>
01299 <p><li><b> nodesx = Xmax-Xmin+1</b>
01300 <p><li><b> nodesy = Ymax-Ymin+1</b>
01301 </ul>
01302 <p><center><img src="gif/spectrumpainter023.jpg"></center>
01303 <p>Simple modes group, display mode = grid, 256 x 256 channels.
01304 Number of nodes is 64x64.
01305 <h2><i>Function:</i></h2>
01306 <h2>void TSpectrum2Painter::SetAngles (Int_t alpha,Int_t beta, Int_t view)</h2>
01307 <p>One can change the angles of the position of 3-d space and to rotate the
01308 space. Alpha parameter defines the angle between bottom horizontal screen line
01309 and the displayed space on the right side of the picture and beta on the left
01310 side, respectively. One can rotate the 3-d space around vertical axis going
01311 through the center of it employing the view parameter.
01312 Allowed values are 0, 90, 180 and 270 degrees respectively.
01313 <p>Default values:
01314 <ul>
01315 <p><li><b> alpha = 20</b>
01316 <p><li><b> beta = 60</b>
01317 <p><li><b> view = 0</b>
01318 </ul>
01319 <p><center><img src="gif/spectrumpainter024.jpg"></center>
01320 <p>Light modes group, display mode = surface, 256 x 256 channels. Angles are
01321 set as follows: alpha=40, beta=30, view=0.
01322 <p><center><img src="gif/spectrumpainter025.jpg"></center>
01323 <p>Light modes group, display mode = surface, 256 x 256 channels. Angles are
01324 set as follows: alpha=30, beta=30, view=90.
01325 <h2><i>Function:</i></h2>
01326 <h2>TSpectrum2Painter::SetZScale(Int_t scale)</h2>
01327 <p>One can change the scale of z-axis. Possible values are:
01328 <ul>
01329 <p><li><b> kZScaleLinear</b>
01330 <p><li><b> kZScaleLog</b>
01331 <p><li><b> kZScaleSqrt</b>
01332 </ul>
01333 <p>Default value is:
01334 <ul>
01335 <p><li><b> scale = kZScaleLinear</b>
01336 </ul>
01337 <p><center><img src="gif/spectrumpainter026.jpg"></center>
01338 <p>Height modes group, display mode = surface, 64 x 64 channels, log scale.
01339 <h2><i>Function:</i></h2>
01340 <h2>TSpectrum2Painter::SetColorIncrements(Double_t r,Double_t g,Double_t b);</h2>
01341 <p> For sophisticated shading (in <b>kModeGroupLight, kModeGroupHeight</b>
01342 and <b>kModeGroupLightHeight</b> display modes groups) the color palette starts
01343 from the basic pen color (see SetPenAttr function). There is a predefined number
01344 of color levels (256). Color in every level is calculated by adding the
01345 increments of the r, g, b components to the previous level. Using this function
01346 one can change the color increments between two neighboring color levels. The
01347 function does not apply for <b>kModeGroupSimple</b> display modes group.
01348 Default values: <b>r=1, g=1, b=1;</b>
01349 <p><center><img src="gif/spectrumpainter027.jpg"></center>
01350 <p>Light modes group, display mode = surface, 64 x 64 channels, color increments
01351 r=1, g=2, b=3.
01352 <p><center><img src="gif/spectrumpainter028.jpg"></center>
01353 <p>Light modes group, display mode = surface, 64 x 64 channels, color
01354 increments r=4, g=2, b=1.
01355 <h2><i>Function:</i></h2>
01356 <h2>TSpectrum2Painter::SetColorAlgorithm(Int_t colorAlgorithm)</h2>
01357 <p>To define the colors one can employ one of the following color algorithms
01358 (rgb, cmy, cie, yiq, hvs models [1], [2]). When the level of a component
01359 achieves the limit value one can choose either smooth transition (by decreasing
01360 the limit value) or sharp - modulo transition (continuing with 0 value). This
01361 makes possible to realize various visual effects. One can choose from the
01362 following set of the algorithms:
01363 <ul>
01364 <p><li><b> kColorAlgRgbSmooth </b>
01365 <p><li><b> kColorAlgRgbModulo </b>
01366 <p><li><b> kColorAlgCmySmooth </b>
01367 <p><li><b> kColorAlgCmyModulo </b>
01368 <p><li><b> kColorAlgCieSmooth </b>
01369 <p><li><b> kColorAlgCieModulo </b>
01370 <p><li><b> kColorAlgYiqSmooth </b>
01371 <p><li><b> kColorAlgYiqModulo </b>
01372 <p><li><b> kColorAlgHvsSmooth </b>
01373 <p><li><b> kColorAlgHvsModulo </b>
01374 </ul>
01375 <p>The function does not apply for <b>kModeGroupSimple</b> display modes group.
01376 Default value is:
01377 <ul>
01378 <p><li><b> colorAlgorithm = kColorAlgRgbSmooth</b>
01379 </ul>
01380 <p><center><img src="gif/spectrumpainter029.jpg"></center>
01381 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
01382 is cmy smooth.
01383 <p><center><img src="gif/spectrumpainter030.jpg"></center>
01384 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
01385 is hvs smooth.
01386 <p><center><img src="gif/spectrumpainter031.jpg"></center>
01387 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
01388 is yiq smooth.
01389 <p><center><img src="gif/spectrumpainter032.jpg"></center>
01390 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
01391 is rgb modulo.
01392 <p><center><img src="gif/spectrumpainter033.jpg"></center>
01393 <p>Height modes group, display mode = surface, 256 x 256 channels, color
01394 algorithm is rgb modulo, increments r=5, g=5, b=5, angles alpha=0, beta=90,
01395 view=0.
01396 <h2><i>Function:</i></h2>
01397 <h2>TSpectrum2Painter::SetLightPosition(Int_t x, Int_t y, Int_t z)</h2>
01398 <p>In <b>kModeGroupLight</b> and <b>kModeGroupLightHeight</b> display modes
01399 groups the color palette is calculated according to the fictive light source
01400 position in 3-d space. Using this function one can change the position of the
01401 source and thus to achieve various graphical effects. The function does not
01402 apply for <b>kModeGroupSimple</b> and<b> kModeGroupHeight </b>display modes
01403 groups. Default values are: <b>x=1000, y=1000, z=1000.</b>
01404 <p><center><img src="gif/spectrumpainter034.jpg"></center>
01405 <p>Light modes group, display mode = surface, 64 x 64 channels. Position of the
01406 light source was set to x=0, y=1000, z=1000.
01407 <h2><i>Function:</i></h2>
01408 <h2>TSpectrum2Painter::SetShading(Int_t shading,Int_t shadow)</h2>
01409 <p>Surface of the picture is composed of triangles. If desired the edges of the
01410 neighboring triangles can be smoothed (shaded). If desired the display of the
01411 shadow can be painted as well. The function does not apply for
01412 <b>kModeGroupSimple</b> display modes group.
01413 <p>Possible values for shading are:
01414 <ul>
01415 <p><li><b> kNotShaded</b>
01416 <p><li><b> kShaded.</b>
01417 </ul>
01418 <p>Possible values for shadow are:
01419 <ul>
01420 <p><li><b> kShadowsNotPainted</b>
01421 <p><li><b> kShadowsPainted</b>
01422 </ul>
01423 <p>Default values:
01424 <ul>
01425 <p><li><b> shading = kShaded</b>
01426 <p><li><b> shadow = kShadowsNotPainted</b>
01427 </ul>
01428 <p><center><img src="gif/spectrumpainter035.jpg"></center>
01429 <p>Light modes group, display mode = surface, 64 x 64 channels, not shaded.
01430 <p><center><img src="gif/spectrumpainter036.jpg"></center>
01431 <p>Light modes group, display mode = surface, 64 x 64 channels, shaded, with
01432 shadow.
01433 <h2><i>Function:</i></h2>
01434 <h2>TSpectrum2Painter::SetBezier(Int_t bezier)</h2>
01435 <p>For kModeGroupSimple display modes group and for <b>kDisplayModeGrid,
01436 kDisplayModeLinesX</b> >and <b>kDisplayModeLinesY</b> display modes one
01437 can smooth data using Bezier smoothing algorithm. The function does not apply
01438 for other display modes groups and display modes. Possible values are:
01439 <ul>
01440 <p><li><b> kNoBezierInterpol</b>
01441 <p><li><b> kBezierInterpol</b>
01442 </ul>
01443 <p>Default value is:
01444 <ul>
01445 <p><li><b> bezier = kNoBezierInterpol.</b>
01446 </ul>
01447 <p><center><img src="gif/spectrumpainter005.jpg"></center>
01448 <p>Simple modes group, display mode = linesX, 64 x 64 channels with Bezier
01449 smoothing.
01450 <h2><i>Function:</i></h2>
01451 <h2>TSpectrum2Painter::SetContourWidth(Int_t width)</h2>
01452 <p>This function applies only for <b>kDisplayModeContours</b> display mode.
01453 One can change the width between horizontal slices and thus their density.
01454 Default value: <b>width=50.</b>
01455 <p><center><img src="gif/spectrumpainter037.jpg"></center>
01456 <p>Simple modes group, display mode = contours, 64 x 64 channels. Width between
01457 slices was set to 30.
01458 <h2><i>Function:</i></h2>
01459 <h2>TSpectrum2Painter::SetLightHeightWeight(Double_t weight)</h2>
01460 <p>For <b>kModeGroupLightHeight</b> display modes group one can change the
01461 weight between both shading algorithm. The function does not apply for other
01462 display modes groups. Default value is: <b>weight=0.5.</b>
01463 <p><center><img src="gif/spectrumpainter038.jpg"></center>
01464 <p>Light - height modes group, display mode = surface, 64 x 64 channels.
01465 The weight between both shading algorithms is set to 0.7.
01466 <h2><i>Function:</i></h2>
01467 <h2>TSpectrum2Painter::SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style)</h2>
01468 In addition to the surface drawn using any above given algorithm one can display
01469 channel marks. One can control the color as well as the width, height
01470 (in pixels) and the style of the marks. The parameter enable can be set to:
01471 <ul>
01472 <p><li> <b>kChannelMarksNotDrawn</b>
01473 <p><li> <b>kChannelMarksDrawn.</b>
01474 </ul>
01475 The possible styles can be chosen from the set:
01476 <ul>
01477 <p><li><b> kChannelMarksStyleDot</b>
01478 <p><li><b> kChannelMarksStyleCross</b>
01479 <p><li><b> kChannelMarksStyleStar</b>
01480 <p><li><b> kChannelMarksStyleRectangle</b>
01481 <p><li><b> kChannelMarksStyleX</b>
01482 <p><li><b> kChannelMarksStyleDiamond</b>
01483 <p><li><b> kChannelMarksStyleTriangle.</b>
01484 </ul>
01485 <p><center><img src="gif/spectrumpainter039.jpg"></center>
01486 <p><b>Light modes group, display mode = surface, 64 x 64 channels,
01487 with marks (red circles).</b></p>
01488 <h2><i>Function:</i></h2>
01489 <h2>TSpectrum2Painter::SetChanGrid(Int_t enable,Int_t color)</h2>
01490 <p>In addition to the surface drawn using any above given algorithm one can
01491 display grid using the color parameter. The parameter enable can be set to:
01492 <ul>
01493 <p><li><b> kChannelGridNotDrawn</b>
01494 <p><li><b> kChannelGridDrawn.</b>
01495 </ul>
01496 <p><center><img src="gif/spectrumpainter040.jpg"></center>
01497 <p>Height modes group, display mode = surface, 64 x 64 channels, with blue grid.
01498 <p><center><img src="gif/spectrumpainter041.jpg"></center>
01499 <p>Height modes group, display mode = surface, 64 x 64 channels, with marks
01500 (red circles) and blue grid.
01501 <h2><i>References:</i></h2>
01502 <p> [1] Morhá&#269; M., Kliman J., Matoušek V., Turzo I.,
01503 Sophisticated visualization algorithms for analysis of multidimensional
01504 experimental nuclear data, Acta Physica Slovaca 54 (2004) 385.
01505 <p> [2] D. Hearn, M. P. Baker: Computer Graphics, Prentice Hall International,
01506 Inc.  1994.
01507 <h2>Script:</h2>
01508 <pre>
01509 // Example to draw source spectrum (class TSpectrum2Painter).
01510 // To execute this example, do
01511 // root &gt; .x VisA.C
01512 #include &quot;TSpectrum2Painter.h&quot;
01513 
01514 void VisA() {
01515    TFile *f = new TFile(&quot;TSpectrum2.root&quot;);
01516    TH2F *graph=(TH2F*) f-&gt;Get(&quot;graph2;1&quot;);
01517    TCanvas *Graph2 = new TCanvas(&quot;Graph2&quot;,&quot;Illustration of 2D graphics&quot;,10,10,1000,700);
01518    graph-&gt;Draw(&quot;SPEC&quot;);
01519 }
01520 </pre>
01521 <!-- */
01522 // --> End_Html
01523 
01524    Int_t turni,turnj,w1,w2,x,y;
01525    Int_t q1,q2,qv,smer,flag,i,j,x1,y1,x2,y2,x3,y3,x4,y4,uhl,xp1,yp1,xp2,yp2;
01526    Int_t ix5,iy5,x6,y6,x7,y7,y8,x1d,y1d,x2d=0,y2d=0;
01527    Int_t i1=0,i2=0,i3=0,i4=0,j1=0,j2=0,j3=0,j4=0;
01528    Int_t s1=0,s2=0,s3=0,s4=0,t1=0,t2=0,t3=0,t4=0;
01529    Double_t dx1,dx2,dx3,dx4,dy1,dy2,dy3,dy4,z1,z2,z3,z4,zl,zh;
01530    Double_t xa,xb=0,ya,yb=0,x5=0,y5=0;
01531    Double_t da=0,db=0,dc=0,dd=0,xtaz,ytaz,ztaz,v,shad_noise;
01532    Int_t iv=0,ekv,stvor,sx1,sx2,sx3,sx4,sx5,sy1,sy2,sy3,sy4,sy5;
01533    Double_t pom1,pom2,sdx1,sdy1,sdx2=0,sdy2,sdx3,sdy3,sdy4,spriz;
01534    Int_t sr1=0,sr2=0,sr3=0,sr4=0,sr5=0,sr6=0,sr7=0,sr8=0;
01535    Int_t tr1=0,tr2=0,tr3=0,tr4=0,tr5=0,tr6=0,tr7=0,tr8=0;
01536    Int_t il,iv1=0,iv2=0,iv3=0,iv4=0;
01537    Double_t v1=0,v2=0,v3=0,v4=0,dxr1,dxr2,dyr1,dyr2,zr1,zr2,bezf;
01538    Double_t dcount_reg,z1l,z2l,z3l,z4l,sdx2p,sdy2p,dap,dbp,dcp,ddp;
01539    Int_t sx1p,sy1p,sx3p,uip=0;
01540    Double_t bezx1,bezy1,bezx2,bezy2;
01541    Double_t p000x,p000y,p100x,p100y,p010x,p010y,p110x,p110y;
01542    Double_t p001x,p001y,p101x,p101y,p011x,p011y,p111x,p111y;
01543    Int_t ibezx1=0,ibezy1=0,ibezx2,ibezy2;
01544    unsigned ui1,ui2,ui3;
01545    Double_t fi,alfa,beta,x3max,y3max,mul,movx,movy;
01546    Double_t xmin,xmax,ymin,ymax,zmin,zmax,mx,my,mz;
01547    Double_t mxx,mxy,myx,myy,myz,px,py,kx,ky;
01548    Double_t bxl,bxh,byl,byh,xd,yd,a,b,rotx,roty;
01549    TLine  *line = new TLine();
01550    TBox   *box  = new TBox();
01551    TColor *pen_col;
01552    pen_col = (TColor*)(gROOT->GetListOfColors()->At(fPenColor));
01553    ui1 = (Int_t)(256*pen_col->GetRed());
01554    ui2 = (Int_t)(256*pen_col->GetGreen());
01555    ui3 = (Int_t)(256*pen_col->GetBlue());
01556 
01557    if (fBx2>=fMaximumXScreenResolution) {
01558       printf("The canvas size exceed the maximum X screen resolution.\n");
01559       printf("Use the option bf() to increase the buffer size (it should be greater than %d).\n",fBx2);
01560       return;
01561    }
01562 
01563    for (i=fBx1;i<fBx2;i++) {
01564       fEnvelope[i]        = fBy2;
01565       fEnvelopeContour[i] = fBy2;
01566    }
01567 
01568 //   gPad->Range(0, 0, 1 ,1);
01569 
01570    // Set the histogram's parameters.
01571    fBx1      = gPad->XtoPixel(0.1);
01572    fBx2      = gPad->XtoPixel(0.99);
01573    fBy1      = gPad->YtoPixel(0.99);
01574    fBy2      = gPad->YtoPixel(0.05);
01575    fXmin     = fH2->GetXaxis()->GetFirst();
01576    fXmax     = fH2->GetXaxis()->GetLast();
01577    fYmin     = fH2->GetYaxis()->GetFirst();
01578    fYmax     = fH2->GetYaxis()->GetLast();
01579    fZmax     = fH2->GetMaximum();
01580    fZmin     = fH2->GetMinimum();
01581 
01582    // Calculation of display parameters.
01583    xmin  = fXmin;
01584    xmax  = fXmax;
01585    ymin  = fYmin;
01586    ymax  = fYmax;
01587    zmin  = fZmin;
01588    zmax  = fZmax;
01589    xd    = (xmax-xmin)/2;
01590    yd    = (ymax-ymin)/2;
01591    a     = (xmax+xmin)/2;
01592    b     = (ymax+ymin)/2;
01593    fi    = (fViewAngle*3.1415927)/180;
01594    alfa  = (fAlpha*3.1415927)/180;
01595    beta  = (fBeta*3.1415927)/180;
01596    rotx  = (-1)*a*cos(fi)+b*sin(fi)+xd*TMath::Abs(cos(fi))+yd*TMath::Abs(sin(fi));
01597    roty  = (-1)*a*sin(fi)-b*cos(fi)+xd*TMath::Abs(sin(fi))+yd*TMath::Abs(cos(fi));
01598    x3max = (xmax-xmin)*TMath::Abs(cos(fi))+(ymax-ymin)*TMath::Abs(sin(fi));
01599    y3max = (xmax-xmin)*TMath::Abs(sin(fi))+(ymax-ymin)*TMath::Abs(cos(fi));
01600    bxl   = fBx1;
01601    bxh   = fBx2;
01602    byl   = fBy1;
01603    byh   = fBy2;
01604    mx    = (bxh-bxl)/(x3max*(cos(alfa)+cos(beta)));
01605    my    = (bxh-bxl)/(y3max*(cos(alfa)+cos(beta)));
01606    mul   = (byh-byl)/(bxh-bxl);
01607    movx  = bxl+my*cos(alfa)*y3max;
01608    mxx   = mx*cos(beta)*cos(fi)-my*cos(alfa)*sin(fi);
01609    mxy   = (-1)*mx*cos(beta)*sin(fi)-my*cos(alfa)*cos(fi);
01610    myx   = mul*(mx*sin(beta)*cos(fi)+my*sin(alfa)*sin(fi));
01611    myy   = mul*((-1)*mx*sin(beta)*sin(fi)+my*sin(alfa)*cos(fi));
01612    px    = rotx*mx*cos(beta)-roty*my*cos(alfa)+movx;
01613    kx    = (xmax-xmin)/(fNodesx-1);
01614    ky    = (ymax-ymin)/(fNodesy-1);
01615    fKx   = kx;
01616    fKy   = ky;
01617    fMxx  = mxx;
01618    fMxy  = mxy;
01619    fMyx  = myx;
01620    fMyy  = myy;
01621    fTxx  = mxx*kx;
01622    fTxy  = mxy*ky;
01623    fTyx  = myx*kx;
01624    fTyy  = myy*ky;
01625    fVx   = mxx*xmin+mxy*ymin+px;
01626    if (fZscale==kZScaleLinear) {
01627       mz     = (bxh-bxl)*(cos(alfa)+cos(beta)-sin(alfa)-sin(beta));
01628       mz     = mz/((zmax-zmin)*(cos(alfa)+cos(beta)));
01629       movy   = byl+mul*mz*zmax;
01630       myz    = (-1)*mz*mul;
01631       py     = mul*(rotx*mx*sin(beta)+roty*my*sin(alfa))+movy;
01632       fTyz   = myz;
01633       fVy    = myx*xmin+myy*ymin+py;
01634       fNuSli = (zmax-zmin)/(Double_t)fContWidth;
01635    } else if (fZscale==kZScaleLog) {
01636       if (zmin>=1) zmin = log(zmin);
01637       else         zmin = 0;
01638       if (zmax>=1) zmax = log(zmax);
01639       else         zmax = 0;
01640       if ((zmax-zmin)<0.000001) zmax = zmin+0.000001;
01641       mz     = (bxh-bxl)*(cos(alfa)+cos(beta)-sin(alfa)-sin(beta));
01642       mz     = mz/((zmax-zmin)*(cos(alfa)+cos(beta)));
01643       movy   = byl+mul*mz*zmax;
01644       myz    = (-1)*mz*mul;
01645       py     = mul*(rotx*mx*sin(beta)+roty*my*sin(alfa))+movy;
01646       fTyz   = myz;
01647       fVy    = myx*xmin+myy*ymin+py;
01648       fNuSli = (zmax-zmin)/(Double_t)fContWidth;
01649    } else if (fZscale==kZScaleSqrt) {
01650       if (zmin>=1) zmin = sqrt(zmin);
01651       else         zmin = 0;
01652       if (zmax>=1) zmax = sqrt(zmax);
01653       else         zmax = 0;
01654       if ((zmax-zmin)<0.000001) zmax = zmin+0.000001;
01655       mz     = (bxh-bxl)*(cos(alfa)+cos(beta)-sin(alfa)-sin(beta));
01656       mz     = mz/((zmax-zmin)*(cos(alfa)+cos(beta)));
01657       movy   = byl+mul*mz*zmax;
01658       myz    = (-1)*mz*mul;
01659       py     = mul*(rotx*mx*sin(beta)+roty*my*sin(alfa))+movy;
01660       fTyz   = myz;
01661       fVy    = myx*xmin+myy*ymin+py;
01662       fNuSli = (zmax-zmin)/(Double_t)fContWidth;
01663    }
01664 
01665    // End of calculations of display parameters.
01666    dcount_reg=fContWidth;
01667    switch (fZscale) {
01668       case kZScaleLog:
01669          dcount_reg=log(dcount_reg);
01670          break;
01671       case kZScaleSqrt:
01672          dcount_reg=sqrt(dcount_reg);
01673          break;
01674    }
01675    shad_noise  = fZmax;
01676    shad_noise /= 100.;
01677    w1          = fNodesx-1;
01678    w2          = fNodesy-1;
01679 
01680    // Drawing axis in backplanes.
01681    Transform(0,0,-1);
01682    p000x = gPad->PixeltoX(fXt);
01683    p000y = gPad->PixeltoY(fYt)+1;
01684    Transform(w1,0,-1);
01685    p100x = gPad->PixeltoX(fXt);
01686    p100y = gPad->PixeltoY(fYt)+1;
01687    Transform(0,w2,-1);
01688    p010x = gPad->PixeltoX(fXt);
01689    p010y = gPad->PixeltoY(fYt)+1;
01690    Transform(w1,w2,-1);
01691    p110x = gPad->PixeltoX(fXt);
01692    p110y = gPad->PixeltoY(fYt)+1;
01693    fZPresetValue = fZmax;
01694    Transform(0,0,-2);
01695    p001x = gPad->PixeltoX(fXt);
01696    p001y = gPad->PixeltoY(fYt)+1;
01697    Transform(w1,0,-2);
01698    p101x = gPad->PixeltoX(fXt);
01699    p101y = gPad->PixeltoY(fYt)+1;
01700    Transform(0,w2,-2);
01701    p011x = gPad->PixeltoX(fXt);
01702    p011y = gPad->PixeltoY(fYt)+1;
01703    Transform(w1,w2,-2);
01704    p111x = gPad->PixeltoX(fXt);
01705    p111y = gPad->PixeltoY(fYt)+1;
01706    Double_t bmin, bmax, binLow, binHigh, binWidth;
01707    Double_t axisLevel, gridDist, gridY1, gridY2;
01708    Int_t ndivx = 0, ndivy, ndivz, nbins;
01709    TGaxis *axis  = new TGaxis();
01710    TGaxis *xaxis = new TGaxis();
01711    TGaxis *yaxis = new TGaxis();
01712    TGaxis *zaxis = new TGaxis();
01713    line->SetLineStyle(kPenStyleDot);
01714    if (fViewAngle==0) {
01715       axis->PaintAxis(p000x, p000y, p100x, p100y, bmin, bmax, ndivx, "");
01716       axis->PaintAxis(p000x, p000y, p010x, p010y, bmin, bmax, ndivx, "");
01717       if(fAlpha+fBeta<90)
01718          axis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivx, "");
01719       if(fAlpha+fBeta<90)
01720          axis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivx, "");
01721       axis->PaintAxis(p101x, p101y, p001x, p001y, bmin, bmax, ndivx, "");
01722       axis->PaintAxis(p001x, p001y, p011x, p011y, bmin, bmax, ndivx, "");
01723       if (fZscale==kZScaleLinear) {
01724          bmin  = fZmin;
01725          bmax  = fZmax;
01726          ndivz = 10;
01727          THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
01728                                   nbins, binWidth, " ");
01729          for (i = 0; i < nbins + 1; i++) {
01730             axisLevel = binLow+i*binWidth;
01731             gridDist  = (axisLevel-bmin)*(p001y-p000y)/(bmax-bmin);
01732             gridY1    = p000y + gridDist, gridY2 = p100y + gridDist;
01733             line->PaintLine(p000x,gridY1,p100x,gridY2);
01734             gridY2    = p010y + gridDist;
01735             line->PaintLine(p000x,gridY1,p010x,gridY2);
01736          }
01737       }
01738    } else if (fViewAngle==90) {
01739       axis->PaintAxis(p010x, p010y, p000x, p000y, bmin, bmax, ndivx, "");
01740       axis->PaintAxis(p010x, p010y, p110x, p110y, bmin, bmax, ndivx, "");
01741       if(fAlpha+fBeta<90)
01742          axis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivx, "");
01743       if(fAlpha+fBeta<90)
01744          axis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivx, "");
01745       axis->PaintAxis(p001x, p001y, p011x, p011y, bmin, bmax, ndivx, "");
01746       axis->PaintAxis(p011x, p011y, p111x, p111y, bmin, bmax, ndivx, "");
01747       if (fZscale==kZScaleLinear) {
01748          bmin  = fZmin;
01749          bmax  = fZmax;
01750          ndivz = 10;
01751          THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
01752                                   nbins, binWidth, " ");
01753          for (i = 0; i < nbins + 1; i++) {
01754             axisLevel = binLow+i*binWidth;
01755             gridDist  = (axisLevel-bmin)*(p011y-p010y)/(bmax-bmin);
01756             gridY1    = p010y + gridDist, gridY2 = p000y + gridDist;
01757             line->PaintLine(p010x,gridY1,p000x,gridY2);
01758             gridY2    = p110y + gridDist;
01759             line->PaintLine(p010x,gridY1,p110x,gridY2);
01760          }
01761       }
01762    } else if (fViewAngle==180) {
01763       axis->PaintAxis(p110x, p110y, p010x, p010y, bmin, bmax, ndivx, "");
01764       axis->PaintAxis(p110x, p110y, p100x, p100y, bmin, bmax, ndivx, "");
01765       if(fAlpha+fBeta<90)
01766          axis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivx, "");
01767       if(fAlpha+fBeta<90)
01768          axis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivx, "");
01769       axis->PaintAxis(p011x, p011y, p111x, p111y, bmin, bmax, ndivx, "");
01770       axis->PaintAxis(p111x, p111y, p101x, p101y, bmin, bmax, ndivx, "");
01771       if (fZscale==kZScaleLinear) {
01772          bmin  = fZmin;
01773          bmax  = fZmax;
01774          ndivz = 10;
01775          THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
01776                                   nbins, binWidth, " ");
01777          for (i = 0; i < nbins + 1; i++) {
01778             axisLevel = binLow+i*binWidth;
01779             gridDist  = (axisLevel-bmin)*(p111y-p110y)/(bmax-bmin);
01780             gridY1    = p110y + gridDist, gridY2 = p010y + gridDist;
01781             line->PaintLine(p110x,gridY1,p010x,gridY2);
01782             gridY2    = p100y + gridDist;
01783             line->PaintLine(p110x,gridY1,p100x,gridY2);
01784          }
01785       }
01786    } else if (fViewAngle==270) {
01787       axis->PaintAxis(p100x, p100y, p110x, p110y, bmin, bmax, ndivx, "");
01788       axis->PaintAxis(p100x, p100y, p000x, p000y, bmin, bmax, ndivx, "");
01789       if(fAlpha+fBeta<90)
01790          axis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivx, "");
01791       if(fAlpha+fBeta<90)
01792          axis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivx, "");
01793       axis->PaintAxis(p111x, p111y, p101x, p101y, bmin, bmax, ndivx, "");
01794       axis->PaintAxis(p101x, p101y, p001x, p001y, bmin, bmax, ndivx, "");
01795       if (fZscale==kZScaleLinear) {
01796          bmin  = fZmin;
01797          bmax  = fZmax;
01798          ndivz = 10;
01799          THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
01800                                   nbins, binWidth, " ");
01801          for (i = 0; i < nbins + 1; i++) {
01802             axisLevel = binLow+i*binWidth;
01803             gridDist  = (axisLevel-bmin)*(p101y-p100y)/(bmax-bmin);
01804             gridY1    = p100y + gridDist, gridY2 = p110y + gridDist;
01805             line->PaintLine(p100x,gridY1,p110x,gridY2);
01806             gridY2    = p000y + gridDist;
01807             line->PaintLine(p100x,gridY1,p000x,gridY2);
01808          }
01809       }
01810    }
01811 
01812    // End.
01813    line->ResetAttLine("");
01814    line->SetLineColor(fPenColor);
01815    line->SetLineWidth(fPenWidth);
01816    line->SetLineStyle(fPenDash);
01817    turni = 0;
01818    turnj = 0;
01819    Transform(w1,0,0);
01820    x1    = fXt;
01821    Transform(0,0,0);
01822    x2    = fXt;
01823    Transform(0,w2,0);
01824    x3    = fXt;
01825    if (x2>=x1) turnj = 1;
01826    if (x3>=x2) turni = 1;
01827    q1 = 1;
01828    q2 = 0;
01829    qv = 1;
01830    do {
01831       uhl  = 0;
01832       smer = 0;
01833       flag = 0;
01834 l2:
01835       if (turni==1) {
01836          i = q1;
01837       } else {
01838          i = w1-q1;
01839       }
01840       if (turnj==1) {
01841          j = q2;
01842       } else {
01843          j = w2-q2;
01844       }
01845       Transform(i,j,0);
01846       x1 = fXt;
01847       y1 = fYt;
01848       Transform(i,j,-1);
01849       x1d = fXt;
01850       y1d = fYt;
01851       do {
01852          if (flag==0) {
01853             flag = 1;
01854             if (smer==0) q1 -= 1;
01855             else         q2 -= 1;
01856          } else {
01857             flag = 0;
01858             if (smer==0) q2 += 1;
01859             else         q1 += 1;
01860          }
01861          if (turni==1) {
01862             i = q1;
01863          } else {
01864             i = w1-q1;
01865          }
01866          if (turnj==1) {
01867             j = q2;
01868          } else {
01869             j = w2-q2;
01870          }
01871          Transform(i,j,0);
01872          x2 = fXt;
01873          y2 = fYt;
01874          if (flag==1) {
01875             x  = x1;
01876             y  = y1;
01877             x1 = x2;
01878             y1 = y2;
01879             x2 = x;
01880             y2 = y;
01881          }
01882          switch (fDisplayMode) {
01883             case kDisplayModePoints:
01884                if (fModeGroup==kModeGroupSimple) {
01885                   Envelope(x1,y1,x2,y2);
01886                   if (y1<=fEnvelope[x1]) {
01887                      line->PaintLine(gPad->PixeltoX(x1)  ,gPad->PixeltoY(y1)+1,
01888                                      gPad->PixeltoX(x1+1),gPad->PixeltoY(y1)+1);
01889                   }
01890                   if (y2<=fEnvelope[x2]) {
01891                      line->PaintLine(gPad->PixeltoX(x2)  ,gPad->PixeltoY(y2)+1,
01892                                      gPad->PixeltoX(x2+1),gPad->PixeltoY(y2)+1);
01893                   }
01894                } else {
01895                   if ((q1!=q2||smer!=0) && flag==1) {
01896                      s1 = q1+1;
01897                      t1 = q2;
01898                      s2 = q1;
01899                      t2 = q2;
01900                      s3 = q1;
01901                      t3 = q2+1;
01902                      s4 = q1+1;
01903                      t4 = q2+1;
01904                      if (fShading==kShaded) {
01905                         sr1 = s1;
01906                         tr1 = (Int_t)TMath::Max(t1-1,0);
01907                         sr2 = s2;
01908                         tr2 = (Int_t)TMath::Max(t2-1,0);
01909                         sr3 = (Int_t)TMath::Max(s2-1,0);
01910                         tr3 = t2;
01911                         sr4 = (Int_t)TMath::Max(s3-1,0);
01912                         tr4 = t3;
01913                         sr5 = s3;
01914                         tr5 = t3+1;
01915                         sr6 = s4;
01916                         tr6 = t4+1;
01917                         sr7 = s4+1;
01918                         tr7 = t4;
01919                         sr8 = s1+1;
01920                         tr8 = t1;
01921                      }
01922                      if (turni==1) {
01923                         i1 = s1;
01924                         i2 = s2;
01925                         i3 = s3;
01926                         i4 = s4;
01927                      } else {
01928                         i1 = (Int_t)TMath::Max(w1-s1,0);
01929                         i2 = (Int_t)TMath::Max(w1-s2,0);
01930                         i3 = (Int_t)TMath::Max(w1-s3,0);
01931                         i4 = (Int_t)TMath::Max(w1-s4,0);
01932                         if (fShading==kShaded) {
01933                            sr1 = (Int_t)TMath::Max(w1-sr1,0);
01934                            sr2 = (Int_t)TMath::Max(w1-sr2,0);
01935                            sr3 = (Int_t)TMath::Max(w1-sr3,0);
01936                            sr4 = (Int_t)TMath::Max(w1-sr4,0);
01937                            sr5 = (Int_t)TMath::Max(w1-sr5,0);
01938                            sr6 = (Int_t)TMath::Max(w1-sr6,0);
01939                            sr7 = (Int_t)TMath::Max(w1-sr7,0);
01940                            sr8 = (Int_t)TMath::Max(w1-sr8,0);
01941                         }
01942                      }
01943                      if (turnj==1) {
01944                         j1 = t1;
01945                         j2 = t2;
01946                         j3 = t3;
01947                         j4 = t4;
01948                      } else {
01949                         j1 = (Int_t)TMath::Max(w2-t1,0);
01950                         j2 = (Int_t)TMath::Max(w2-t2,0);
01951                         j3 = (Int_t)TMath::Max(w2-t3,0);
01952                         j4 = (Int_t)TMath::Max(w2-t4,0);
01953                         if (fShading==kShaded) {
01954                            tr1 = (Int_t)TMath::Max(w2-tr1,0);
01955                            tr2 = (Int_t)TMath::Max(w2-tr2,0);
01956                            tr3 = (Int_t)TMath::Max(w2-tr3,0);
01957                            tr4 = (Int_t)TMath::Max(w2-tr4,0);
01958                            tr5 = (Int_t)TMath::Max(w2-tr5,0);
01959                            tr6 = (Int_t)TMath::Max(w2-tr6,0);
01960                            tr7 = (Int_t)TMath::Max(w2-tr7,0);
01961                            tr8 = (Int_t)TMath::Max(w2-tr8,0);
01962                         }
01963                      }
01964                      Transform(i1,j1,0);
01965                      x1   = fXt;
01966                      y1   = fYt;
01967                      dx1  = fDxspline;
01968                      dy1  = fDyspline;
01969                      z1   = fZ;
01970                      Transform(i2,j2,0);
01971                      x2   = fXt;
01972                      y2   = fYt;
01973                      dx2  = fDxspline;
01974                      dy2  = fDyspline;
01975                      z2   = fZ;
01976                      Transform(i3,j3,0);
01977                      x3   = fXt;
01978                      y3   = fYt;
01979                      dx3  = fDxspline;
01980                      dy3  = fDyspline;
01981                      z3   = fZ;
01982                      Transform(i4,j4,0);
01983                      x4   = fXt;
01984                      y4   = fYt;
01985                      dx4  = fDxspline;
01986                      dy4  = fDyspline;
01987                      z4   = fZ;
01988                      Envelope(x1,y1,x2,y2);
01989                      Envelope(x2,y2,x3,y3);
01990                      xtaz = (dx1+dx2+dx4)/3;
01991                      ytaz = (dy1+dy2+dy4)/3;
01992                      ztaz = (z1+z2+z4)/3;
01993                      v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
01994                      if (fShading==kShaded) {
01995                         if (fShadow==kShadowsNotPainted) {
01996                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
01997                            else                              Transform(sr1,tr1,0);
01998                            dxr1  = fDxspline;
01999                            dyr1  = fDyspline;
02000                            zr1   = fZ;
02001                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
02002                            else                              Transform(sr8,tr8,0);
02003                            dxr2  = fDxspline;
02004                            dyr2  = fDyspline;
02005                            zr2   = fZ;
02006                            v     = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
02007                            v     = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
02008                            v     = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
02009                            v1    = v/4;
02010                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
02011                            else                              Transform(sr3,tr3,0);
02012                            dxr1  = fDxspline;
02013                            dyr1  = fDyspline;
02014                            zr1   = fZ;
02015                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
02016                            else                              Transform(sr2,tr2,0);
02017                            dxr2  = fDxspline;
02018                            dyr2  = fDyspline;
02019                            zr2   = fZ;
02020                            v     = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
02021                            v     = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
02022                            v     = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
02023                            v     = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
02024                            v2    = v/4;
02025                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
02026                            else                              Transform(sr5,tr5,0);
02027                            dxr1  = fDxspline;
02028                            dyr1  = fDyspline;
02029                            zr1   = fZ;
02030                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
02031                            else                              Transform(sr4,tr4,0);
02032                            dxr2  = fDxspline;
02033                            dyr2  = fDyspline;
02034                            zr2   = fZ;
02035                            v     = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
02036                            v     = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
02037                            v     = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
02038                            v     = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
02039                            v3    = v/4;
02040                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
02041                            else                              Transform(sr7,tr7,0);
02042                            dxr1  = fDxspline;
02043                            dyr1  = fDyspline;
02044                            zr1   = fZ;
02045                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
02046                            else                              Transform(sr6,tr6,0);
02047                            dxr2  = fDxspline;
02048                            dyr2  = fDyspline;
02049                            zr2   = fZ;
02050                            v     = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
02051                            v     = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
02052                            v     = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
02053                            v     = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
02054                            v4    = v/4;
02055                         } else {
02056                            spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
02057                            v     = v+spriz;
02058                            v     = v/2;
02059                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
02060                            else                              Transform(sr1,tr1,0);
02061                            dxr1  = fDxspline;
02062                            dyr1  = fDyspline;
02063                            zr1   = fZ;
02064                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
02065                            else                              Transform(sr8,tr8,0);
02066                            dxr2  = fDxspline;
02067                            dyr2  = fDyspline;
02068                            zr2   = fZ;
02069                            da    = (dxr1+dx2+dx1)/3;
02070                            db    = (dyr1+dy2+dy1)/3;
02071                            dc    = (zr1+z2+z1)/3;
02072                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02073                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
02074                            da    = (dxr1+dxr2+dx1)/3;
02075                            db    = (dyr1+dyr2+dy1)/3;
02076                            dc    = (zr1+zr2+z1)/3;
02077                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02078                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
02079                            da    = (dxr2+dx1+dx4)/3;
02080                            db    = (dyr2+dy1+dy4)/3;
02081                            dc    = (zr2+z1+z4)/3;
02082                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02083                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
02084                            v1    = v/4;
02085                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
02086                            else                              Transform(sr3,tr3,0);
02087                            dxr1  = fDxspline;
02088                            dyr1  = fDyspline;
02089                            zr1   = fZ;
02090                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
02091                            else                              Transform(sr2,tr2,0);
02092                            dxr2  = fDxspline;
02093                            dyr2  = fDyspline;
02094                            zr2   = fZ;
02095                            da    = (dx1+dx2+dx3)/3;
02096                            db    = (dy1+dy2+dy3)/3;
02097                            dc    = (z1+z2+z3)/3;
02098                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02099                            v     = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
02100                            da    = (dx2+dxr1+dx3)/3;
02101                            db    = (dy2+dyr1+dy3)/3;
02102                            dc    = (z2+zr1+z3)/3;
02103                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02104                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
02105                            da    = (dx2+dxr2+dxr1)/3;
02106                            db    = (dy2+dyr2+dyr1)/3;
02107                            dc    = (z2+zr2+zr1)/3;
02108                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02109                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
02110                            da    = (dxr2+dx2+dx1)/3;
02111                            db    = (dyr2+dy2+dy1)/3;
02112                            dc    = (zr2+z2+z1)/3;
02113                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02114                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
02115                            v2    = v/4;
02116                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
02117                            else                              Transform(sr5,tr5,0);
02118                            dxr1  = fDxspline;
02119                            dyr1  = fDyspline;
02120                            zr1   = fZ;
02121                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
02122                            else                              Transform(sr4,tr4,0);
02123                            dxr2  = fDxspline;
02124                            dyr2  = fDyspline;
02125                            zr2   = fZ;
02126                            da    = (dx2+dx3+dx4)/3;
02127                            db    = (dy2+dy3+dy4)/3;
02128                            dc    = (z2+z3+z4)/3;
02129                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02130                            v     = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
02131                            da    = (dx4+dx3+dxr1)/3;
02132                            db    = (dy4+dy3+dyr1)/3;
02133                            dc    = (z4+z3+zr1)/3;
02134                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02135                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
02136                            da    = (dx3+dxr2+dxr1)/3;
02137                            db    = (dy3+dyr2+dyr1)/3;
02138                            dc    = (z3+zr2+zr1)/3;
02139                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02140                            v     = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
02141                            da    = (dx2+dxr2+dx3)/3;
02142                            db    = (dy2+dyr2+dy3)/3;
02143                            dc    = (z2+zr2+z3)/3;
02144                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02145                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
02146                            v3    = v/4;
02147                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
02148                            else                              Transform(sr7,tr7,0);
02149                            dxr1  = fDxspline;
02150                            dyr1  = fDyspline;
02151                            zr1   = fZ;
02152                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
02153                            else                              Transform(sr6,tr6,0);
02154                            dxr2  = fDxspline;
02155                            dyr2  = fDyspline;
02156                            zr2   = fZ;
02157                            da    = (dx1+dx3+dx4)/3;
02158                            db    = (dy1+dy3+dy4)/3;
02159                            dc    = (z1+z3+z4)/3;
02160                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02161                            v     = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
02162                            da    = (dx4+dx3+dxr2)/3;
02163                            db    = (dy4+dy3+dyr2)/3;
02164                            dc    = (z4+z3+zr2)/3;
02165                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02166                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
02167                            da    = (dx4+dxr2+dxr1)/3;
02168                            db    = (dy4+dyr2+dyr1)/3;
02169                            dc    = (z4+zr2+zr1)/3;
02170                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02171                            v     = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
02172                            da    = (dx1+dx4+dxr1)/3;
02173                            db    = (dy1+dy4+dyr1)/3;
02174                            dc    = (z1+z4+zr1)/3;
02175                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02176                            v     = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
02177                            v4    = v/4;
02178                         }
02179                      }
02180                      spriz = 0;
02181                      if (fShadow==kShadowsNotPainted) {
02182                         if (fShading==kNotShaded) {
02183                            v  = v*fLevels+0.5;
02184                            iv = fLevels-(Int_t)v;
02185                         } else {
02186                            v1  = v1*fLevels;
02187                            iv1 = fLevels-(Int_t)v1;
02188                            v2  = v2*fLevels;
02189                            iv2 = fLevels-(Int_t)v2;
02190                            v4 = v4*fLevels;
02191                            iv4 = fLevels-(Int_t)v4;
02192                         }
02193                      } else {
02194                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
02195                         if (fShading==kNotShaded) {
02196                            v  = v*fLevels/2.0;
02197                            iv = fLevels-(Int_t)(v+0.5);
02198                         } else {
02199                            v1  = v1*fLevels;
02200                            iv1 = fLevels-(Int_t)v1;
02201                            v2  = v2*fLevels;
02202                            iv2 = fLevels-(Int_t)v2;
02203                            v4  = v4*fLevels;
02204                            iv4 = fLevels-(Int_t)v4;
02205                         }
02206                      }
02207                      if (fShading==kNotShaded) {
02208                         ColorModel(iv,ui1,ui2,ui3);
02209                         line->SetLineColor(fNewColorIndex);
02210                         if (fEnvelope[x1]>=y1) {
02211                            line->PaintLine(gPad->PixeltoX(x1),gPad->PixeltoY(y1)+1,gPad->PixeltoX(x1+1),gPad->PixeltoY(y1)+1);
02212                            fEnvelope[x1] = y1;
02213                         }
02214                         if (fEnvelope[x2]>=y2) {
02215                            line->PaintLine(gPad->PixeltoX(x2),gPad->PixeltoY(y2)+1,gPad->PixeltoX(x2+1),gPad->PixeltoY(y2)+1);
02216                            fEnvelope[x2] = y2;
02217                         }
02218                         if (fEnvelope[x4]>=y4) {
02219                            line->PaintLine(gPad->PixeltoX(x4),gPad->PixeltoY(y4)+1,gPad->PixeltoX(x4+1),gPad->PixeltoY(y4)+1);
02220                            fEnvelope[x4] = y4;
02221                         }
02222                      } else {
02223                         if (fEnvelope[x1]>=y1) {
02224                            iv = iv1;
02225                            ColorModel(iv,ui1,ui2,ui3);
02226                            line->SetLineColor(fNewColorIndex);
02227                            line->PaintLine(gPad->PixeltoX(x1),gPad->PixeltoY(y1)+1,gPad->PixeltoX(x1+1),gPad->PixeltoY(y1)+1);
02228                            fEnvelope[x1] = y1;
02229                         }
02230                         if (fEnvelope[x2]>=y2) {
02231                            iv = iv2;
02232                            ColorModel(iv,ui1,ui2,ui3);
02233                            line->SetLineColor(fNewColorIndex);
02234                            line->PaintLine(gPad->PixeltoX(x2),gPad->PixeltoY(y2)+1,gPad->PixeltoX(x2+1),gPad->PixeltoY(y2)+1);
02235                            fEnvelope[x2]=y2;
02236                         }
02237                         if (fEnvelope[x4]>=y4) {
02238                            iv = iv4;
02239                            ColorModel(iv,ui1,ui2,ui3);
02240                            line->SetLineColor(fNewColorIndex);
02241                            line->PaintLine(gPad->PixeltoX(x4),gPad->PixeltoY(y4)+1,gPad->PixeltoX(x4+1),gPad->PixeltoY(y4)+1);
02242                            fEnvelope[x4] = y4;
02243                         }
02244                      }
02245                      xtaz = (dx3+dx2+dx4)/3;
02246                      ytaz = (dy3+dy2+dy4)/3;
02247                      ztaz = (z3+z2+z4)/3;
02248                      if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
02249                      spriz = 0;
02250                      if (fShadow==kShadowsNotPainted) {
02251                         if (fShading==kNotShaded) {
02252                            v  = v*fLevels;
02253                            iv = fLevels-(Int_t)v;
02254                         } else {
02255                            v3  = v3*fLevels;
02256                            iv3 = fLevels-(Int_t)v3;
02257                         }
02258                      } else {
02259                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
02260                         if (fShading==kNotShaded) {
02261                            v  = v*fLevels/2;
02262                            iv = fLevels-(Int_t)v;
02263                            iv = (Int_t)(iv-fLevels*spriz/2);
02264                         } else {
02265                            v3  = v3*fLevels;
02266                            iv3 = fLevels-(Int_t)v3;
02267                         }
02268                      }
02269                      if (fShading==kNotShaded) {
02270                         ColorModel(iv,ui1,ui2,ui3);
02271                         line->ResetAttLine("");
02272                         line->SetLineColor(fNewColorIndex);
02273                         if (fEnvelope[x3]>=y3) {
02274                            line->PaintLine(gPad->PixeltoX(x3),gPad->PixeltoY(y3)+1,gPad->PixeltoX(x3+1),gPad->PixeltoY(y3)+1);
02275                            fEnvelope[x3] = y3;
02276                         }
02277                      } else {
02278                         if (fEnvelope[x3]>=y3) {
02279                            iv = iv3;
02280                            ColorModel(iv,ui1,ui2,ui3);
02281                            line->ResetAttLine("");
02282                            line->SetLineColor(fNewColorIndex);
02283                            line->PaintLine(gPad->PixeltoX(x3),gPad->PixeltoY(y3)+1,gPad->PixeltoX(x3+1),gPad->PixeltoY(y3)+1);
02284                            fEnvelope[x3]=y3;
02285                         }
02286                      }
02287                   }
02288                }
02289                break;
02290             case kDisplayModeGrid:
02291                if (fBezier==kNoBezierInterpol) {
02292                   if (fModeGroup==kModeGroupSimple) {
02293                         Envelope(x1,y1,x2,y2);
02294                         if (fLine!=0) {
02295                            if (fLine==1) {
02296                               fXe = x2;
02297                               fYe = y2;
02298                            }
02299                            line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
02300                         }
02301                   } else {
02302                      if ((q1!=q2||smer!=0)&&flag==1) {
02303                         s1 = q1+1;
02304                         t1 = q2;
02305                         s2 = q1;
02306                         t2 = q2;
02307                         s3 = q1;
02308                         t3 = q2+1;
02309                         s4 = q1+1;
02310                         t4 = q2+1;
02311                         if (fShading==kShaded) {
02312                            sr1 = s1;
02313                            tr1 = (Int_t)TMath::Max(t1-1,0);
02314                            sr2 = s2;
02315                            tr2 = (Int_t)TMath::Max(t2-1,0);
02316                            sr3 = (Int_t)TMath::Max(s2-1,0);
02317                            tr3 = t2;
02318                            sr4 = (Int_t)TMath::Max(s3-1,0);
02319                            tr4 = t3;
02320                            sr5 = s3;
02321                            tr5 = t3+1;
02322                            sr6 = s4;
02323                            tr6 = t4+1;
02324                            sr7 = s4+1;
02325                            tr7 = t4;
02326                            sr8 = s1+1;
02327                            tr8 = t1;
02328                         }
02329                         if (turni==1) {
02330                            i1 = s1;
02331                            i2 = s2;
02332                            i3 = s3;
02333                            i4 = s4;
02334                         } else {
02335                            i1 = (Int_t)TMath::Max(w1-s1,0);
02336                            i2 = (Int_t)TMath::Max(w1-s2,0);
02337                            i3 = (Int_t)TMath::Max(w1-s3,0);
02338                            i4 = (Int_t)TMath::Max(w1-s4,0);
02339                            if (fShading==kShaded) {
02340                               sr1 = (Int_t)TMath::Max(w1-sr1,0);
02341                               sr2 = (Int_t)TMath::Max(w1-sr2,0);
02342                               sr3 = (Int_t)TMath::Max(w1-sr3,0);
02343                               sr4 = (Int_t)TMath::Max(w1-sr4,0);
02344                               sr5 = (Int_t)TMath::Max(w1-sr5,0);
02345                               sr6 = (Int_t)TMath::Max(w1-sr6,0);
02346                               sr7 = (Int_t)TMath::Max(w1-sr7,0);
02347                               sr8 = (Int_t)TMath::Max(w1-sr8,0);
02348                            }
02349                         }
02350                         if (turnj==1) {
02351                            j1 = t1;
02352                            j2 = t2;
02353                            j3 = t3;
02354                            j4 = t4;
02355                         } else {
02356                            j1 = (Int_t)TMath::Max(w2-t1,0);
02357                            j2 = (Int_t)TMath::Max(w2-t2,0);
02358                            j3 = (Int_t)TMath::Max(w2-t3,0);
02359                            j4 = (Int_t)TMath::Max(w2-t4,0);
02360                            if (fShading==kShaded) {
02361                               tr1 = (Int_t)TMath::Max(w2-tr1,0);
02362                               tr2 = (Int_t)TMath::Max(w2-tr2,0);
02363                               tr3 = (Int_t)TMath::Max(w2-tr3,0);
02364                               tr4 = (Int_t)TMath::Max(w2-tr4,0);
02365                               tr5 = (Int_t)TMath::Max(w2-tr5,0);
02366                               tr6 = (Int_t)TMath::Max(w2-tr6,0);
02367                               tr7 = (Int_t)TMath::Max(w2-tr7,0);
02368                               tr8 = (Int_t)TMath::Max(w2-tr8,0);
02369                            }
02370                         }
02371                         Transform(i1,j1,0);
02372                         x1  = fXt;
02373                         y1  = fYt;
02374                         dx1 = fDxspline;
02375                         dy1 = fDyspline;
02376                         z1  = fZ;
02377                         Transform(i2,j2,0);
02378                         x2  = fXt;
02379                         y2  = fYt;
02380                         dx2 = fDxspline;
02381                         dy2 = fDyspline;
02382                         z2  = fZ;
02383                         Transform(i3,j3,0);
02384                         x3  = fXt;
02385                         y3  = fYt;
02386                         dx3 = fDxspline;
02387                         dy3 = fDyspline;
02388                         z3  = fZ;
02389                         Transform(i4,j4,0);
02390                         x4  = fXt;
02391                         y4  = fYt;
02392                         dx4 = fDxspline;
02393                         dy4 = fDyspline;
02394                         z4  = fZ;
02395                         Envelope(x1,y1,x2,y2);
02396                         Envelope(x2,y2,x3,y3);
02397                         xtaz = (dx1+dx2+dx4)/3;
02398                         ytaz = (dy1+dy2+dy4)/3;
02399                         ztaz = (z1+z2+z4)/3;
02400                         v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
02401                         if (fShading==kShaded) {
02402                            if (fShadow==kShadowsNotPainted) {
02403                               if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
02404                               else                              Transform(sr1,tr1,0);
02405                               dxr1  = fDxspline;
02406                               dyr1  = fDyspline;
02407                               zr1   = fZ;
02408                               if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
02409                               else                              Transform(sr8,tr8,0);
02410                               dxr2  = fDxspline;
02411                               dyr2  = fDyspline;
02412                               zr2   = fZ;
02413                               v     = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
02414                               v     = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
02415                               v     = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
02416                               v1    = v/4;
02417                               if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
02418                               else                              Transform(sr3,tr3,0);
02419                               dxr1  = fDxspline;
02420                               dyr1  = fDyspline;
02421                               zr1   = fZ;
02422                               if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
02423                               else                              Transform(sr2,tr2,0);
02424                               dxr2  = fDxspline;
02425                               dyr2  = fDyspline;
02426                               zr2   = fZ;
02427                               v     = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
02428                               v     = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
02429                               v     = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
02430                               v     = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
02431                               v2    = v/4;
02432                               if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
02433                               else                              Transform(sr5,tr5,0);
02434                               dxr1  = fDxspline;
02435                               dyr1  = fDyspline;
02436                               zr1   = fZ;
02437                               if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
02438                               else                              Transform(sr4,tr4,0);
02439                               dxr2  = fDxspline;
02440                               dyr2  = fDyspline;
02441                               zr2   = fZ;
02442                               v     = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
02443                               v     = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
02444                               v     = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
02445                               v     = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
02446                               v3    = v/4;
02447                               if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
02448                               else                              Transform(sr7,tr7,0);
02449                               dxr1  = fDxspline;
02450                               dyr1  = fDyspline;
02451                               zr1   = fZ;
02452                               if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
02453                               else                              Transform(sr6,tr6,0);
02454                               dxr2  = fDxspline;
02455                               dyr2  = fDyspline;
02456                               zr2   = fZ;
02457                               v     = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
02458                               v     = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
02459                               v     = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
02460                               v     = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
02461                               v4    = v/4;
02462                            } else {
02463                               spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
02464                               v     = v+spriz;
02465                               v     = v/2;
02466                               if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
02467                               else                              Transform(sr1,tr1,0);
02468                               dxr1  = fDxspline;
02469                               dyr1  = fDyspline;
02470                               zr1   = fZ;
02471                               if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
02472                               else                              Transform(sr8,tr8,0);
02473                               dxr2  = fDxspline;
02474                               dyr2  = fDyspline;
02475                               zr2   = fZ;
02476                               da    = (dxr1+dx2+dx1)/3;
02477                               db    = (dyr1+dy2+dy1)/3;
02478                               dc    = (zr1+z2+z1)/3;
02479                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02480                               v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
02481                               da    = (dxr1+dxr2+dx1)/3;
02482                               db    = (dyr1+dyr2+dy1)/3;
02483                               dc    = (zr1+zr2+z1)/3;
02484                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02485                               v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
02486                               da    = (dxr2+dx1+dx4)/3;
02487                               db    = (dyr2+dy1+dy4)/3;
02488                               dc    = (zr2+z1+z4)/3;
02489                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02490                               v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
02491                               v1    = v/4;
02492                               if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
02493                               else                              Transform(sr3,tr3,0);
02494                               dxr1  = fDxspline;
02495                               dyr1  = fDyspline;
02496                               zr1   = fZ;
02497                               if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
02498                               else                              Transform(sr2,tr2,0);
02499                               dxr2  = fDxspline;
02500                               dyr2  = fDyspline;
02501                               zr2   = fZ;
02502                               da    = (dx1+dx2+dx3)/3;
02503                               db    = (dy1+dy2+dy3)/3;
02504                               dc    = (z1+z2+z3)/3;
02505                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02506                               v     = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
02507                               da    = (dx2+dxr1+dx3)/3;
02508                               db    = (dy2+dyr1+dy3)/3;
02509                               dc    = (z2+zr1+z3)/3;
02510                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02511                               v     = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
02512                               da    = (dx2+dxr2+dxr1)/3;
02513                               db    = (dy2+dyr2+dyr1)/3;
02514                               dc    = (z2+zr2+zr1)/3;
02515                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02516                               v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
02517                               da    = (dxr2+dx2+dx1)/3;
02518                               db    = (dyr2+dy2+dy1)/3;
02519                               dc    = (zr2+z2+z1)/3;
02520                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02521                               v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
02522                               v2    = v/4;
02523                               if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
02524                               else                              Transform(sr5,tr5,0);
02525                               dxr1  = fDxspline;
02526                               dyr1  = fDyspline;
02527                               zr1   = fZ;
02528                               if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
02529                               else                              Transform(sr4,tr4,0);
02530                               dxr2  = fDxspline;
02531                               dyr2  = fDyspline;
02532                               zr2   = fZ;
02533                               da    = (dx2+dx3+dx4)/3;
02534                               db    = (dy2+dy3+dy4)/3;
02535                               dc    = (z2+z3+z4)/3;
02536                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02537                               v     = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
02538                               da    = (dx4+dx3+dxr1)/3;
02539                               db    = (dy4+dy3+dyr1)/3;
02540                               dc    = (z4+z3+zr1)/3;
02541                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02542                               v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
02543                               da    = (dx3+dxr2+dxr1)/3;
02544                               db    = (dy3+dyr2+dyr1)/3;
02545                               dc    = (z3+zr2+zr1)/3;
02546                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02547                               v     = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
02548                               da    = (dx2+dxr2+dx3)/3;
02549                               db    = (dy2+dyr2+dy3)/3;
02550                               dc    = (z2+zr2+z3)/3;
02551                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02552                               v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
02553                               v3    = v/4;
02554                               if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
02555                               else                              Transform(sr7,tr7,0);
02556                               dxr1  = fDxspline;
02557                               dyr1  = fDyspline;
02558                               zr1   = fZ;
02559                               if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
02560                               else                              Transform(sr6,tr6,0);
02561                               dxr2  = fDxspline;
02562                               dyr2  = fDyspline;
02563                               zr2   = fZ;
02564                               da    = (dx1+dx3+dx4)/3;
02565                               db    = (dy1+dy3+dy4)/3;
02566                               dc    = (z1+z3+z4)/3;
02567                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02568                               v     = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
02569                               da    = (dx4+dx3+dxr2)/3;
02570                               db    = (dy4+dy3+dyr2)/3;
02571                               dc    = (z4+z3+zr2)/3;
02572                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02573                               v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
02574                               da    = (dx4+dxr2+dxr1)/3;
02575                               db    = (dy4+dyr2+dyr1)/3;
02576                               dc    = (z4+zr2+zr1)/3;
02577                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02578                               v     = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
02579                               da    = (dx1+dx4+dxr1)/3;
02580                               db    = (dy1+dy4+dyr1)/3;
02581                               dc    = (z1+z4+zr1)/3;
02582                               spriz = ShadowColorCalculation(da,db,dc,shad_noise);
02583                               v     = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
02584                               v4    = v/4;
02585                            }
02586                         }
02587                         spriz = 0;
02588                         if (fShadow==kShadowsNotPainted) {
02589                            if (fShading==kNotShaded) {
02590                               v  = v*fLevels+0.5;
02591                               iv = fLevels-(Int_t)v;
02592                            } else {
02593                               v1  = v1*fLevels;
02594                               iv1 = fLevels-(Int_t)v1;
02595                               v2  = v2*fLevels;
02596                               iv2 = fLevels-(Int_t)v2;
02597                               v4  = v4*fLevels;
02598                               iv4 = fLevels-(Int_t)v4;
02599                            }
02600                         } else {
02601                            spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
02602                            if (fShading==kNotShaded) {
02603                               v  = v*fLevels/2.0;
02604                               iv = fLevels-(Int_t)(v+0.5);
02605                            } else {
02606                               v1  = v1*fLevels;
02607                               iv1 = fLevels-(Int_t)v1;
02608                               v2  = v2*fLevels;
02609                               iv2 = fLevels-(Int_t)v2;
02610                               v4  = v4*fLevels;
02611                               iv4 = fLevels-(Int_t)v4;
02612                            }
02613                         }
02614                         if (fShading==kNotShaded) {
02615                            ColorModel(iv,ui1,ui2,ui3);
02616                            line->SetLineColor(fNewColorIndex);
02617                         } else {
02618                            dx1 = x1;
02619                            dy1 = y1;
02620                            dx2 = x2;
02621                            dy2 = y2;
02622                            dx3 = x4;
02623                            dy3 = y4;
02624                            z1  = iv1;
02625                            z2  = iv2;
02626                            z3  = iv4;
02627                            da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
02628                            db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
02629                            dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
02630                            dd  = -da*dx1-db*dy1-dc*z1;
02631                         }
02632                         sx1 = x1;
02633                         sy1 = y1;
02634                         sx2 = x2;
02635                         sy2 = y2;
02636                         if (sx2<sx1) {
02637                            sx4 = sx1;
02638                            sy4 = sy1;
02639                            sx1 = sx2;
02640                            sy1 = sy2;
02641                            sx2 = sx4;
02642                            sy2 = sy4;
02643                         }
02644                         sdx1 = 0;
02645                         pom1 = sy2-sy1;
02646                         pom2 = sx2-sx1;
02647                         if (pom2!=0) sdx1 = pom1/pom2;
02648                         pom1 = sy1;
02649                         pom2 = sx1;
02650                         sdy1 = pom1-sdx1*pom2;
02651                         for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
02652                            pom1 = sx4;
02653                            sdy4 = sdx1*pom1+sdy1;
02654                            sy4  = (Int_t)(sdy4);
02655                            if (sy4<=fEnvelope[sx4]) {
02656                               fEnvelope[sx4] = sy4;
02657                               if (fShading==kNotShaded) {
02658                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02659                               } else {
02660                                  dx1 = sx4;
02661                                  dy1 = sy4;
02662                                  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
02663                                  else       v = (iv1+iv2+iv4)/3;
02664                                  iv = (Int_t)v;
02665                                  ColorModel(iv,ui1,ui2,ui3);
02666                                  line->SetLineColor(fNewColorIndex);
02667                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02668                               }
02669                               sy5 = sy4;
02670                            } else {
02671                               sy4 = fEnvelope[sx4];
02672                               if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
02673                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02674                               } else if (sy5<=fEnvelope[sx5]) {
02675                                  dx1 = sx4;
02676                                  dy1 = sy4;
02677                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
02678                               else       v = (iv1+iv2+iv4)/3;
02679                               iv = (Int_t)v;
02680                               ColorModel(iv,ui1,ui2,ui3);
02681                               line->SetLineColor(fNewColorIndex);
02682                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02683                               }
02684                               sy5 = fEnvelope[sx4];
02685                            }
02686                            sx5 = sx4;
02687                         }
02688                         sx1 = x1;
02689                         sy1 = y1;
02690                         sx3 = x4;
02691                         sy3 = y4;
02692                         if (sx3<sx1) {
02693                            sx4 = sx1;
02694                            sy4 = sy1;
02695                            sx1 = sx3;
02696                            sy1 = sy3;
02697                            sx3 = sx4;
02698                            sy3 = sy4;
02699                         }
02700                         pom1  = sy3-sy1;
02701                         pom2  = sx3-sx1;
02702                         if (pom2!=0) sdx2 = pom1/pom2;
02703                         pom1  = sy1;
02704                         pom2  = sx1;
02705                         sdy2  = pom1-sdx2*pom2;
02706                         sx1p  = sx1;
02707                         sy1p  = sy1;
02708                         sx3p  = sx3;
02709                         sdx2p = sdx2;
02710                         sdy2p = sdy2;
02711                         dap   = da;
02712                         dbp   = db;
02713                         dcp   = dc;
02714                         ddp   = dd;
02715                         uip   = fNewColorIndex;
02716                         xtaz  = (dx3+dx2+dx4)/3;
02717                         ytaz  = (dy3+dy2+dy4)/3;
02718                         ztaz  = (z3+z2+z4)/3;
02719                         if (fShading==kNotShaded) v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
02720                         spriz = 0;
02721                         if (fShadow==kShadowsNotPainted) {
02722                            if (fShading==kNotShaded) {
02723                               v  = v*fLevels;
02724                               iv = fLevels-(Int_t)v;
02725                            } else {
02726                               v3  = v3*fLevels;
02727                               iv3 = fLevels-(Int_t)v3;
02728                            }
02729                         } else {
02730                            spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
02731                            if (fShading==kNotShaded) {
02732                               v  = v*fLevels/2;
02733                               iv = fLevels-(Int_t)v;
02734                               iv = (Int_t)(iv-fLevels*spriz/2);
02735                            } else {
02736                               v3  = v3*fLevels;
02737                               iv3 = fLevels-(Int_t)v3;
02738                            }
02739                         }
02740                         if (fShading==kNotShaded) {
02741                            ColorModel(iv,ui1,ui2,ui3);
02742                            line->SetLineColor(fNewColorIndex);
02743                         } else {
02744                            dx1 = x2;
02745                            dy1 = y2;
02746                            dx2 = x3;
02747                            dy2 = y3;
02748                            dx3 = x4;
02749                            dy3 = y4;
02750                            z1  = iv2;
02751                            z2  = iv3;
02752                            z3  = iv4;
02753                            da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
02754                            db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
02755                            dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
02756                            dd  = -da*dx1-db*dy1-dc*z1;
02757                         }
02758                         sx1 = x2;
02759                         sy1 = y2;
02760                         sx2 = x3;
02761                         sy2 = y3;
02762                         if (sx2<sx1) {
02763                            sx4 = sx1;
02764                            sy4 = sy1;
02765                            sx1 = sx2;
02766                            sy1 = sy2;
02767                            sx2 = sx4;
02768                            sy2 = sy4;
02769                         }
02770                         pom1 = sy2-sy1;
02771                         pom2 = sx2-sx1;
02772                         sdx1 = 0;
02773                         if (pom2!=0) sdx1 = pom1/pom2;
02774                         pom1 = sy1;
02775                         pom2 = sx1;
02776                         sdy1 = pom1-sdx1*pom2;
02777                         for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
02778                            pom1 = sx4;
02779                            sdy4 = sdx1*pom1+sdy1;
02780                            sy4  = (Int_t)sdy4;
02781                            if (sy4<=fEnvelope[sx4]) {
02782                               fEnvelope[sx4] = sy4;
02783                               if (fShading==kNotShaded) {
02784                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02785                               } else {
02786                                  dx1 = sx4;
02787                                  dy1 = sy4;
02788                                  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
02789                                  else       v = (iv1+iv2+iv4)/3;
02790                                  iv = (Int_t)v;
02791                                  ColorModel(iv,ui1,ui2,ui3);
02792                                  line->SetLineColor(fNewColorIndex);
02793                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02794                               }
02795                               sy5 = sy4;
02796                            } else {
02797                               sy4 = fEnvelope[sx4];
02798                               if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
02799                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02800                               } else if (sy5<=fEnvelope[sx5]) {
02801                                  dx1 = sx4;
02802                                  dy1 = sy4;
02803                                  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
02804                                  else       v = (iv1+iv2+iv4)/3;
02805                                  iv = (Int_t)v;
02806                                  ColorModel(iv,ui1,ui2,ui3);
02807                                  line->SetLineColor(fNewColorIndex);
02808                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02809                               }
02810                               sy5 = fEnvelope[sx4];
02811                            }
02812                            sx5 = sx4;
02813                         }
02814                         for (sx4=sx1p,sx5=sx1p,sy5=sy1p;sx4<=sx3p;sx4++) {
02815                            pom1 = sx4;
02816                            sdy4 = sdx2p*pom1+sdy2p;
02817                            sy4  = (Int_t)sdy4;
02818                            if (sy4<=fEnvelope[sx4]) {
02819                               fEnvelope[sx4]=sy4;
02820                               if (fShading==kNotShaded) {
02821                                  line->SetLineColor(uip);
02822                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02823                               } else {
02824                                  dx1 = sx4;
02825                                  dy1 = sy4;
02826                                  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
02827                                  else        v = (iv1+iv2+iv4)/3;
02828                                  iv = (Int_t)v;
02829                                  ColorModel(iv,ui1,ui2,ui3);
02830                                  line->SetLineColor(fNewColorIndex);
02831                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02832                               }
02833                               sy5 = sy4;
02834                            } else {
02835                               sy4 = fEnvelope[sx4];
02836                               if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
02837                                  line->SetLineColor(uip);
02838                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02839                               } else if (sy5<=fEnvelope[sx5]) {
02840                                  dx1 = sx4;
02841                                  dy1 = sy4;
02842                                  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
02843                                  else        v = (iv1+iv2+iv4)/3;
02844                                  iv = (Int_t)v;
02845                                  ColorModel(iv,ui1,ui2,ui3);
02846                                  line->SetLineColor(fNewColorIndex);
02847                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02848                               }
02849                               sy5 = fEnvelope[sx4];
02850                            }
02851                            sx5 = sx4;
02852                         }
02853                         sx2 = x3;
02854                         sy2 = y3;
02855                         sx3 = x4;
02856                         sy3 = y4;
02857                         if (sx3<sx2) {
02858                            sx4 = sx2;
02859                            sy4 = sy2;
02860                            sx2 = sx3;
02861                            sy2 = sy3;
02862                            sx3 = sx4;
02863                            sy3 = sy4;
02864                         }
02865                         sdx2 = 0;
02866                         pom1 = sy3-sy2;
02867                         pom2 = sx3-sx2;
02868                         if (pom2!=0) sdx2 = pom1/pom2;
02869                         pom1 = sy2;
02870                         pom2 = sx2;
02871                         sdy2 = pom1-sdx2*pom2;
02872                         for (sx4=sx2,sx5=sx2,sy5=sy2;sx4<=sx3;sx4++) {
02873                            pom1 = sx4;
02874                            sdy4 = sdx2*pom1+sdy2;
02875                            sy4  = (Int_t)sdy4;
02876                            if (sy4<=fEnvelope[sx4]) {
02877                               fEnvelope[sx4] = sy4;
02878                               if (fShading==kNotShaded) {
02879                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02880                               } else {
02881                                  dx1 = sx4;
02882                                  dy1 = sy4;
02883                                  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
02884                                  else       v =(iv1+iv2+iv4)/3;
02885                                  iv = (Int_t)v;
02886                                  ColorModel(iv,ui1,ui2,ui3);
02887                                  line->SetLineColor(fNewColorIndex);
02888                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02889                               }
02890                               sy5 = sy4;
02891                            } else {
02892                               sy4 = fEnvelope[sx4];
02893                               if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
02894                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02895                               } else if (sy5<=fEnvelope[sx5]) {
02896                                  dx1 = sx4;
02897                                  dy1 = sy4;
02898                                  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
02899                                  else       v =(iv1+iv2+iv4)/3;
02900                                  iv = (Int_t)v;
02901                                  ColorModel(iv,ui1,ui2,ui3);
02902                                  line->SetLineColor(fNewColorIndex);
02903                                  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
02904                               }
02905                               sy5 = fEnvelope[sx4];
02906                            }
02907                            sx5 = sx4;
02908                         }
02909                      }
02910                   }
02911                } else {
02912                   if (((flag==0)&&(smer==0))||((flag!=0)&&(smer!=0))) {
02913                      s1 = q1;
02914                      t1 = (Int_t)TMath::Max(q2-1,0);
02915                      s2 = q1;
02916                      t2 = (Int_t)TMath::Min(q2+2,w2);
02917                   } else if (((flag!=0)&&(smer==0))||((flag==0)&&(smer!=0))) {
02918                      s1 = (Int_t)TMath::Max(q1-1,0);
02919                      t1 = q2;
02920                      s2 = (Int_t)TMath::Min(q1+2,w1);
02921                      t2 = q2;
02922                   }
02923                   if (turni==1) {
02924                      i1 = s1;
02925                      i2 = s2;
02926                   } else {
02927                      i1 = w1-s1;
02928                      i2 = w1-s2;
02929                   }
02930                   if (turnj==1) {
02931                      j1 = t1;
02932                      j2 = t2;
02933                   } else {
02934                      j1 = w2-t1;
02935                      j2 = w2-t2;
02936                   }
02937                   Transform(i1,j1,0);
02938                   x3 = fXt;
02939                   y3 = fYt;
02940                   Transform(i2,j2,0);
02941                   x4    = fXt;
02942                   y4    = fYt;
02943                   bezx1 = x1+(x2-x1)/3;
02944                   bezx2 = x1+2*(x2-x1)/3;
02945                   bezy1 = y1+(y2-y3)/6;
02946                   bezy2 = y2-(y4-y1)/6;
02947                   if (x1<=x2) {
02948                      if (bezx1<=x1) {
02949                         bezx1 = x1;
02950                         bezy1 = y1;
02951                      }
02952                      if (bezx1>=x2) {
02953                         bezx1 = x2;
02954                         bezy1 = y2;
02955                      }
02956                      if (bezx2<=x1) {
02957                         bezx2 = x1;
02958                         bezy2 = y1;
02959                      }
02960                      if (bezx2>=x2) {
02961                         bezx2 = x2;
02962                         bezy2 = y2;
02963                      }
02964                      fBzX[0] = x1;
02965                      fBzY[0] = y1;
02966                      fBzX[1] = (Int_t)bezx1;
02967                      fBzY[1] = (Int_t)bezy1;
02968                      fBzX[2] = (Int_t)bezx2;
02969                      fBzY[2] = (Int_t)bezy2;
02970                      fBzX[3] = x2;
02971                      fBzY[3] = y2;
02972                      for (bezf=0;bezf<1.01;bezf+=0.1) {
02973                         BezierSmoothing(bezf);
02974                         if (bezf==0) {
02975                            ibezx1 = (Int_t)(fGbezx+0.5);
02976                            ibezy1 = (Int_t)(fGbezy+0.5);
02977                         } else {
02978                            ibezx2 = ibezx1;
02979                            ibezy2 = ibezy1;
02980                            ibezx1 = (Int_t)(fGbezx+0.5);
02981                            ibezy1 = (Int_t)(fGbezy+0.5);
02982                            Envelope(ibezx2,ibezy2,ibezx1,ibezy1);
02983                            if (fLine!=0) {
02984                               if (fLine==1) {
02985                                  fXe = ibezx1;
02986                                  fYe = ibezy1;
02987                               }
02988                               line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
02989                            }
02990                         }
02991                      }
02992                   } else if (x1>x2) {
02993                      if (bezx1>=x1) {
02994                         bezx1 = x1;
02995                         bezy1 = y1;
02996                      }
02997                      if (bezx1<=x2) {
02998                         bezx1 = x2;
02999                         bezy1 = y2;
03000                      }
03001                      if (bezx2>=x1) {
03002                         bezx2 = x1;
03003                         bezy2 = y1;
03004                      }
03005                      if (bezx2<=x2) {
03006                         bezx2 = x2;
03007                         bezy2 = y2;
03008                      }
03009                      fBzX[0] = x1;
03010                      fBzY[0] = y1;
03011                      fBzX[1] = (Int_t)bezx1;
03012                      fBzY[1] = (Int_t)bezy1;
03013                      fBzX[2] = (Int_t)bezx2;
03014                      fBzY[2] = (Int_t)bezy2;
03015                      fBzX[3] = x2;
03016                      fBzY[3] = y2;
03017                      for (bezf=0;bezf<1.01;bezf+=0.1) {
03018                         BezierSmoothing(bezf);
03019                         if (bezf==0) {
03020                            ibezx1 = (Int_t)(fGbezx+0.5);
03021                            ibezy1 = (Int_t)(fGbezy+0.5);
03022                         } else {
03023                            ibezx2 = ibezx1;
03024                            ibezy2 = ibezy1;
03025                            ibezx1 = (Int_t)(fGbezx+0.5);
03026                            ibezy1 = (Int_t)(fGbezy+0.5);
03027                            Envelope(ibezx1,ibezy1,ibezx2,ibezy2);
03028                            if (fLine!=0) {
03029                               if (fLine==1) {
03030                                  fXe = ibezx2;
03031                                  fYe = ibezy2;
03032                               }
03033                               line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03034                            }
03035                         }
03036                      }
03037                   }
03038                }
03039                break;
03040             case kDisplayModeContours:
03041                if ((q1!=q2||smer!=0)&&flag==1) {
03042                   s1 = q1+1;
03043                   t1 = q2;
03044                   s2 = q1;
03045                   t2 = q2;
03046                   s3 = q1;
03047                   t3 = q2+1;
03048                   s4 = q1+1;
03049                   t4 = q2+1;
03050                   if (turni==1) {
03051                      i1 = (Int_t)TMath::Min(w1,s1);
03052                      i2 = (Int_t)TMath::Min(w1,s2);
03053                      i3 = (Int_t)TMath::Min(w1,s3);
03054                      i4 = (Int_t)TMath::Min(w1,s4);
03055                   } else {
03056                      i1 = (Int_t)TMath::Max(w1-s1,0);
03057                      i2 = (Int_t)TMath::Max(w1-s2,0);
03058                      i3 = (Int_t)TMath::Max(w1-s3,0);
03059                      i4 = (Int_t)TMath::Max(w1-s4,0);
03060                   }
03061                   if (turnj==1) {
03062                      j1 = (Int_t)TMath::Min(w2,t1);
03063                      j2 = (Int_t)TMath::Min(w2,t2);
03064                      j3 = (Int_t)TMath::Min(w2,t3);
03065                      j4 = (Int_t)TMath::Min(w2,t4);
03066                   } else {
03067                      j1 = (Int_t)TMath::Max(w2-t1,0);
03068                      j2 = (Int_t)TMath::Max(w2-t2,0);
03069                      j3 = (Int_t)TMath::Max(w2-t3,0);
03070                      j4 = (Int_t)TMath::Max(w2-t4,0);
03071                   }
03072                   Transform(i1,j1,0);
03073                   dx1 = fDxspline;
03074                   dy1 = fDyspline;
03075                   z1  = fZ;
03076                   z1l = fZeq;
03077                   Transform(i2,j2,0);
03078                   dx2 = fDxspline;
03079                   dy2 = fDyspline;
03080                   z2  = fZ;
03081                   z2l = fZeq;
03082                   Transform(i3,j3,0);
03083                   dx3 = fDxspline;
03084                   dy3 = fDyspline;
03085                   z3  = fZ;
03086                   z3l = fZeq;
03087                   Transform(i4,j4,0);
03088                   dx4 = fDxspline;
03089                   dy4 = fDyspline;
03090                   z4  = fZ;
03091                   z4l = fZeq;
03092                   zh  = (Double_t)TMath::Max(z1,z2);
03093                   zh  = (Double_t)TMath::Max(zh,z3);
03094                   zh  = (Double_t)TMath::Max(zh,z4);
03095                   zl  = (Double_t)TMath::Min(z1l,z2l);
03096                   zl  = (Double_t)TMath::Min(zl,z3l);
03097                   zl  = (Double_t)TMath::Min(zl,z4l);
03098                   i1 = (Int_t)(zl/dcount_reg+1);
03099                   if (z1!=z2||z2!=z3||z3!=z4) {
03100                      do {
03101                         fZ = i1*dcount_reg;
03102                         switch (fZscale) {
03103                            case kZScaleLog:
03104                               if (fZ>=1.0) fZ = log(fZ);
03105                               else         fZ = 0;
03106                               break;
03107                            case kZScaleSqrt:
03108                               if (fZ>0) fZ = sqrt(fZ);
03109                               else      fZ = 0;
03110                               break;
03111                         }
03112                         if (fModeGroup!=kModeGroupSimple) {
03113                            v  = ColorCalculation(dx1,dy1,fZ,dx2,dy2,fZ,dx4,dy4,fZ);
03114                            v  = v*fLevels+0.5;
03115                            iv = fLevels-(Int_t)v;
03116                            ColorModel(iv,ui1,ui2,ui3);
03117                            line->SetLineColor(fNewColorIndex);
03118                         }
03119                         if (fZ>zh) goto eqend;
03120                         i1   += 1;
03121                         ekv   = 0;
03122                         stvor = 0;
03123                         if ((z2<=fZ&&fZ<z1)||(z2<fZ&&fZ<=z1)) {
03124                            xb = (fZ-z2)*(dx1-dx2)/(z1-z2)+dx2;
03125                            goto ekvi1;
03126                         }
03127                         if ((z1<=fZ&&fZ<z2)||(z1<fZ&&fZ<=z2)) {
03128                            xb = (fZ-z1)*(dx2-dx1)/(z2-z1)+dx1;
03129                            goto ekvi1;
03130                         }
03131                         if (z2==fZ&&fZ==z1) {
03132                            xb     = dx2;
03133 ekvi1:
03134                            yb     = dy2;
03135                            ekv    = 1;
03136                            x5     = xb;
03137                            y5     = yb;
03138                            stvor += 1;
03139                         }
03140                         if ((z1<=fZ&&fZ<z4)||(z1<fZ&&fZ<=z4)) {
03141                            ya = (fZ-z1)*(dy4-dy1)/(z4-z1)+dy1;
03142                            goto ekvi2;
03143                         }
03144                         if ((z4<=fZ&&fZ<z1)||(z4<fZ&&fZ<=z1)) {
03145                            ya = (fZ-z4)*(dy1-dy4)/(z1-z4)+dy4;
03146                            goto ekvi2;
03147                         }
03148                         if (z4==fZ&&fZ==z1) {
03149                            ya = dy1;
03150 ekvi2:
03151                            xa = dx1;
03152                            if (ekv==1) {
03153                               Slice(xa,ya,xb,yb,line);
03154                               stvor += 1;
03155                            }
03156                            xb  = xa;
03157                            yb  = ya;
03158                            ekv = 1;
03159                         }
03160                         if ((z3<=fZ&&fZ<z4)||(z3<fZ&&fZ<=z4)) {
03161                            xa = (fZ-z3)*(dx4-dx3)/(z4-z3)+dx3;
03162                            goto ekvi3;
03163                         }
03164                         if ((z4<=fZ&&fZ<z3)||(z4<fZ&&fZ<=z3)) {
03165                            xa = (fZ-z4)*(dx3-dx4)/(z3-z4)+dx4;
03166                            goto ekvi3;
03167                         }
03168                         if (z4==fZ&&fZ==z3) {
03169                            xa = dx4;
03170 ekvi3:
03171                            ya = dy4;
03172                            if (ekv==1) {
03173                               Slice(xa,ya,xb,yb,line);
03174                               stvor += 1;
03175                            }
03176                            xb  = xa;
03177                            yb  = ya;
03178                            ekv = 1;
03179                         }
03180                         if ((z2<=fZ&&fZ<z3)||(z2<fZ&&fZ<=z3)) {
03181                            ya = (fZ-z2)*(dy3-dy2)/(z3-z2)+dy2;
03182                            goto ekvi4;
03183                         }
03184                         if ((z3<=fZ&&fZ<z2)||(z3<fZ&&fZ<=z2)) {
03185                            ya = (fZ-z3)*(dy2-dy3)/(z2-z3)+dy3;
03186                            goto ekvi4;
03187                         }
03188                         if (z3==fZ&&fZ==z2) {
03189                            ya = dy3;
03190 ekvi4:
03191                            xa = dx3;
03192                            if (ekv==1) {
03193                               Slice(xa,ya,xb,yb,line);
03194                               stvor += 1;
03195                            }
03196                            if (stvor==4) Slice(xa,ya,x5,y5,line);
03197                         }
03198                      } while (fZ<=zh);
03199 eqend:
03200                      CopyEnvelope(dx1,dx3,dy1,dy3);
03201                   }
03202                }
03203                break;
03204             case kDisplayModeBars:
03205             case kDisplayModeBarsX:
03206             case kDisplayModeBarsY:
03207                if ((q1!=q2||smer!=0)&&flag==1) {
03208                   s1 = q1+1;
03209                   t1 = q2;
03210                   s2 = q1;
03211                   t2 = q2;
03212                   s3 = q1;
03213                   t3 = q2+1;
03214                   s4 = q1+1;
03215                   t4 = q2+1;
03216                }
03217                if (turni==1) {
03218                   if (fDisplayMode==kDisplayModeBarsX) {
03219                      if (s1<=w1&&s2<=w1&&s3<=w1&&s4<=w1) {
03220                         i1 = s1;
03221                         i2 = s2;
03222                         i3 = s3;
03223                         i4 = s4;
03224                      }
03225                   } else {
03226                      i1 = (Int_t)TMath::Min(w1,s1);
03227                      i2 = (Int_t)TMath::Min(w1,s2);
03228                      i3 = (Int_t)TMath::Min(w1,s3);
03229                      i4 = (Int_t)TMath::Min(w1,s4);
03230                   }
03231                } else {
03232                   if (fDisplayMode==kDisplayModeBarsX) {
03233                      if (s1<=w1&&s2<=w1&&s3<=w1&&s4<=w1) {
03234                         i1 = w1-s1;
03235                         i2 = w1-s2;
03236                         i3 = w1-s3;
03237                         i4 = w1-s4;
03238                      }
03239                   } else {
03240                      i1 = (Int_t)TMath::Max(w1-s1,0);
03241                      i2 = (Int_t)TMath::Max(w1-s2,0);
03242                      i3 = (Int_t)TMath::Max(w1-s3,0);
03243                      i4 = (Int_t)TMath::Max(w1-s4,0);
03244                   }
03245                }
03246                if (turnj==1) {
03247                   if (fDisplayMode==kDisplayModeBarsY) {
03248                      if (t1<=w2&&t2<=w2&&t3<=w2&&t4<=w2) {
03249                         j1 = t1;
03250                         j2 = t2;
03251                         j3 = t3;
03252                         j4 = t4;
03253                      }
03254                   } else {
03255                      j1 = (Int_t)TMath::Min(w2,t1);
03256                      j2 = (Int_t)TMath::Min(w2,t2);
03257                      j3 = (Int_t)TMath::Min(w2,t3);
03258                      j4 = (Int_t)TMath::Min(w2,t4);
03259                   }
03260                } else {
03261                   if (fDisplayMode==kDisplayModeBarsY) {
03262                      if (t1<=w2&&t2<=w2&&t3<=w2&&t4<=w2) {
03263                         j1 = w2-t1;
03264                         j2 = w2-t2;
03265                         j3 = w2-t3;
03266                         j4 = w2-t4;
03267                      }
03268                   } else {
03269                      j1 = (Int_t)TMath::Max(w2-t1,0);
03270                      j2 = (Int_t)TMath::Max(w2-t2,0);
03271                      j3 = (Int_t)TMath::Max(w2-t3,0);
03272                      j4 = (Int_t)TMath::Max(w2-t4,0);
03273                   }
03274                }
03275                Transform(i1,j1,0);
03276                x1  = fXt;
03277                dx1 = fDxspline;
03278                dy1 = fDyspline;
03279                z1  = fZ;
03280                Transform(i2,j2,0);
03281                x2  = fXt;
03282                dx2 = fDxspline;
03283                dy2 = fDyspline;
03284                z2  = fZ;
03285                Transform(i3,j3,0);
03286                x3  = fXt;
03287                dx3 = fDxspline;
03288                dy3 = fDyspline;
03289                z3  = fZ;
03290                Transform(i4,j4,0);
03291                x4  = fXt;
03292                y4  = fYt;
03293                dx4 = fDxspline;
03294                dy4 = fDyspline;
03295                z4  = fZ;
03296                Transform(i1,j1,-1);
03297                ix5 = fXt;
03298                iy5 = fYt;
03299                Transform(i2,j2,-1);
03300                x6  = fXt;
03301                y6  = fYt;
03302                Transform(i3,j3,-1);
03303                x7  = fXt;
03304                y7  = fYt;
03305                Transform(i4,j4,-1);
03306                y8  = fYt;
03307                y1  = iy5+(y4-y8);
03308                y2  = y6+(y4-y8);
03309                y3  = y7+(y4-y8);
03310                if ((fDisplayMode==kDisplayModeBars)&&(q1!=q2||smer!=0)&&(flag==1)) {
03311                   EnvelopeBars(ix5,iy5,x6,y6);
03312                   if (fLine!=0) {
03313                      if (fLine==1) {
03314                         fXe = x6;
03315                         fYe = y6;
03316                      }
03317                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03318                   }
03319                   EnvelopeBars(x6,y6,x7,y7);
03320                   if (fLine!=0) {
03321                      if (fLine==1) {
03322                         fXe = x7;
03323                         fYe = y7;
03324                      }
03325                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03326                   }
03327                   EnvelopeBars(ix5,iy5,x1,y1);
03328                   if (fLine!=0) {
03329                      if (fLine==1) {
03330                         fXe = x1;
03331                         fYe = y1;
03332                      }
03333                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03334                   }
03335                   EnvelopeBars(x6,y6,x2,y2);
03336                   if (fLine!=0) {
03337                      if (fLine==1) {
03338                         fXe = x2;
03339                         fYe = y2;
03340                      }
03341                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03342                   }
03343                   EnvelopeBars(x7,y7,x3,y3);
03344                   if (fLine!=0) {
03345                      if (fLine==1) {
03346                         fXe = x3;
03347                         fYe = y3;
03348                      }
03349                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03350                   }
03351                   if (fModeGroup!=kModeGroupSimple) {
03352                      v   = ColorCalculation(dx1,dy1,z4,dx2,dy2,z4,dx4,dy4,z4);
03353                      v   = v*fLevels+0.5;
03354                      iv  = fLevels-(Int_t)v;
03355                      uip = fNewColorIndex;
03356                      ColorModel(iv,ui1,ui2,ui3);
03357                      line->SetLineColor(fNewColorIndex);
03358                      sx1 = x1;
03359                      sy1 = y1;
03360                      sx2 = x2;
03361                      sy2 = y2;
03362                      sx3 = x4;
03363                      sy3 = y4;
03364                      if (sx2<sx1) {
03365                         sx4 = sx1;
03366                         sy4 = sy1;
03367                         sx1 = sx2;
03368                         sy1 = sy2;
03369                         sx2 = sx4;
03370                         sy2 = sy4;
03371                      }
03372                      if (sx3<sx1) {
03373                         sx4 = sx1;
03374                         sy4 = sy1;
03375                         sx1 = sx3;
03376                         sy1 = sy3;
03377                         sx3 = sx4;
03378                         sy3 = sy4;
03379                      }
03380                      if (sy2<sy3) {
03381                         sx4 = sx2;
03382                         sy4 = sy2;
03383                         sx2 = sx3;
03384                         sy2 = sy3;
03385                         sx3 = sx4;
03386                         sy3 = sy4;
03387                      }
03388                      sdx1 = 0;
03389                      sdx2 = 0;
03390                      sdx3 = 0;
03391                      pom1 = sy2-sy1;
03392                      pom2 = sx2-sx1;
03393                      if (pom2!=0) sdx1 = pom1/pom2;
03394                      pom1 = sy1;
03395                      pom2 = sx1;
03396                      sdy1 = pom1-sdx1*pom2;
03397                      pom1 = sy3-sy1;
03398                      pom2 = sx3-sx1;
03399                      if (pom2!=0) sdx2 = pom1/pom2;
03400                      pom1 = sy1;
03401                      pom2 = sx1;
03402                      sdy2 = pom1-sdx2*pom2;
03403                      pom1 = sy3-sy2;
03404                      pom2 = sx3-sx2;
03405                      if (pom2!=0) sdx3 = pom1/pom2;
03406                      pom1 = sy2;
03407                      pom2 = sx2;
03408                      sdy3 = pom1-sdx3*pom2;
03409                      if (sx2<sx3) {
03410                         if (sx1!=sx2) {
03411                            for (sx4=sx1;sx4<=sx2;sx4++) {
03412                               pom1 = sx4;
03413                               sdy4 = sdx1*pom1+sdy1;
03414                               sy4  = (Int_t)sdy4;
03415                               if (sx3!=sx1) {
03416                                  sdy4 = sdx2*pom1+sdy2;
03417                                  sy5  = (Int_t)sdy4;
03418                                  y5   = fEnvelope[sx4];
03419                                  if (sy4<sy5) {
03420                                     pom1 = sy4;
03421                                     sy4 = sy5;
03422                                     sy5 = (Int_t)pom1;
03423                                  }
03424                                  if ((sy4<=y5)||(sy5<y5)) {
03425                                     sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
03426                                     sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
03427                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03428                                  }
03429                               }
03430                            }
03431                         }
03432                         if (sx2!=sx3) {
03433                            for (sx4=sx2;sx4<=sx3;sx4++) {
03434                               pom1 = sx4;
03435                               sdy4 = sdx3*pom1+sdy3;
03436                               sy4  = (Int_t)sdy4;
03437                               if (sx3!=sx1) {
03438                                  sdy4 = sdx2*pom1+sdy2;
03439                                  sy5  = (Int_t)sdy4;
03440                                  y5   = fEnvelope[sx4];
03441                                  if (sy4<sy5) {
03442                                     pom1 = sy4;
03443                                     sy4  = sy5;
03444                                     sy5  = (Int_t)pom1;
03445                                  }
03446                                  if ((sy4<=y5)||(sy5<y5)) {
03447                                     sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
03448                                     sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
03449                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03450                                  }
03451                               }
03452                            }
03453                         }
03454                      } else {
03455                         if (sx3!=sx1) {
03456                            for (sx4=sx1;sx4<=sx3;sx4++) {
03457                               pom1 = sx4;
03458                               sdy4 = sdx2*pom1+sdy2;
03459                               sy4  = (Int_t)sdy4;
03460                               if (sx2!=sx1) {
03461                                  sdy4 = sdx1*pom1+sdy1;
03462                                  sy5  = (Int_t)sdy4;
03463                                  y5   = fEnvelope[sx4];
03464                                  if (sy4<sy5) {
03465                                     pom1 = sy4;
03466                                     sy4  = sy5;
03467                                     sy5  = (Int_t)pom1;
03468                                  }
03469                                  if ((sy4<=y5)||(sy5<y5)) {
03470                                     sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
03471                                     sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
03472                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03473                                  }
03474                               }
03475                            }
03476                         }
03477                         if (sx2!=sx3) {
03478                            for (sx4=sx3;sx4<=sx2;sx4++) {
03479                               pom1 = sx4;
03480                               sdy4 = sdx3*pom1+sdy3;
03481                               sy4  = (Int_t)sdy4;
03482                               if (sx2!=sx1) {
03483                                  sdy4 = sdx1*pom1+sdy1;
03484                                  sy5  = (Int_t)sdy4;
03485                                  y5   = fEnvelope[sx4];
03486                                  if (sy4<sy5) {
03487                                     pom1 = sy4;
03488                                     sy4  = sy5;
03489                                     sy5  = (Int_t)pom1;
03490                                  }
03491                                  if ((sy4<=y5)||(sy5<y5)) {
03492                                     sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
03493                                     sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
03494                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03495                                  }
03496                               }
03497                            }
03498                         }
03499                      }
03500                      sx1 = x2;
03501                      sy1 = y2;
03502                      sx2 = x3;
03503                      sy2 = y3;
03504                      sx3 = x4;
03505                      sy3 = y4;
03506                      if (sx2<sx1) {
03507                         sx4 = sx1;
03508                         sy4 = sy1;
03509                         sx1 = sx2;
03510                         sy1 = sy2;
03511                         sx2 = sx4;
03512                         sy2 = sy4;
03513                      }
03514                      if (sx3<sx1) {
03515                         sx4 = sx1;
03516                         sy4 = sy1;
03517                         sx1 = sx3;
03518                         sy1 = sy3;
03519                         sx3 = sx4;
03520                         sy3 = sy4;
03521                      }
03522                      if (sy2<sy3) {
03523                         sx4 = sx2;
03524                         sy4 = sy2;
03525                         sx2 = sx3;
03526                         sy2 = sy3;
03527                         sx3 = sx4;
03528                         sy3 = sy4;
03529                      }
03530                      sdx1 = 0;
03531                      sdx2 = 0;
03532                      sdx3 = 0;
03533                      pom1 = sy2-sy1;
03534                      pom2 = sx2-sx1;
03535                      if (pom2!=0) sdx1 = pom1/pom2;
03536                      pom1 = sy1;
03537                      pom2 = sx1;
03538                      sdy1 = pom1-sdx1*pom2;
03539                      pom1 = sy3-sy1;
03540                      pom2 = sx3-sx1;
03541                      if (pom2!=0) sdx2 = pom1/pom2;
03542                      pom1 = sy1;
03543                      pom2 = sx1;
03544                      sdy2 = pom1-sdx2*pom2;
03545                      pom1 = sy3-sy2;
03546                      pom2 = sx3-sx2;
03547                      if (pom2!=0) sdx3 = pom1/pom2;
03548                      pom1 = sy2;
03549                      pom2 = sx2;
03550                      sdy3 = pom1-sdx3*pom2;
03551                      if (sx2<sx3) {
03552                         if (sx1!=sx2) {
03553                            for (sx4=sx1;sx4<=sx2;sx4++) {
03554                               pom1 = sx4;
03555                               sdy4 = sdx1*pom1+sdy1;
03556                               sy4  = (Int_t)sdy4;
03557                               if (sx3!=sx1) {
03558                                  sdy4 = sdx2*pom1+sdy2;
03559                                  sy5  = (Int_t)sdy4;
03560                                  y5   = fEnvelope[sx4];
03561                                  if (sy4<sy5) {
03562                                     pom1 = sy4;
03563                                     sy4  = sy5;
03564                                     sy5  = (Int_t)pom1;
03565                                  }
03566                                  if ((sy4<=y5)||(sy5<y5)) {
03567                                     sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
03568                                     sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
03569                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03570                                  }
03571                               }
03572                            }
03573                         }
03574                         if (sx2!=sx3) {
03575                            for (sx4=sx2;sx4<=sx3;sx4++) {
03576                               pom1 = sx4;
03577                               sdy4 = sdx3*pom1+sdy3;
03578                               sy4  = (Int_t)sdy4;
03579                               if (sx3!=sx1) {
03580                                  sdy4 = sdx2*pom1+sdy2;
03581                                  sy5  = (Int_t)sdy4;
03582                                  y5   = fEnvelope[sx4];
03583                                  if (sy4<sy5) {
03584                                     pom1 = sy4;
03585                                     sy4  = sy5;
03586                                     sy5  = (Int_t)pom1;
03587                                  }
03588                                  if ((sy4<=y5)||(sy5<y5)) {
03589                                     sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
03590                                     sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
03591                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03592                                  }
03593                               }
03594                            }
03595                         }
03596                      } else {
03597                         if (sx3!=sx1) {
03598                            for (sx4=sx1;sx4<=sx3;sx4++) {
03599                               pom1 = sx4;
03600                               sdy4 = sdx2*pom1+sdy2;
03601                               sy4  = (Int_t)sdy4;
03602                               if (sx2!=sx1) {
03603                                  sdy4 = sdx1*pom1+sdy1;
03604                                  sy5  = (Int_t)sdy4;
03605                                  y5 = fEnvelope[sx4];
03606                                  if (sy4<sy5) {
03607                                     pom1 = sy4;
03608                                     sy4  = sy5;
03609                                     sy5  = (Int_t)pom1;
03610                                  }
03611                                  if ((sy4<=y5)||(sy5<y5)) {
03612                                     sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
03613                                     sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
03614                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03615                                  }
03616                               }
03617                            }
03618                         }
03619                         if (sx2!=sx3) {
03620                            for (sx4=sx3;sx4<=sx2;sx4++) {
03621                               pom1 = sx4;
03622                               sdy4 = sdx3*pom1+sdy3;
03623                               sy4  = (Int_t)sdy4;
03624                               if (sx2!=sx1) {
03625                                  sdy4 = sdx1*pom1+sdy1;
03626                                  sy5  = (Int_t)sdy4;
03627                                  y5   = fEnvelope[sx4];
03628                                  if (sy4<sy5) {
03629                                     pom1 = sy4;
03630                                     sy4  = sy5;
03631                                     sy5  = (Int_t)pom1;
03632                                  }
03633                                  if ((sy4<=y5)||(sy5<y5)) {
03634                                     sy4  = (Int_t)TMath::Min(sy4,(Int_t)y5);
03635                                     sy5  = (Int_t)TMath::Min(sy5,(Int_t)y5);
03636                                     line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
03637                                  }
03638                               }
03639                            }
03640                         }
03641                      }
03642                      line->SetLineColor(uip);
03643                   }
03644                   EnvelopeBars(x1,y1,x2,y2);
03645                   if (fLine!=0) {
03646                      if (fLine==1) {
03647                         fXe = x2;
03648                         fYe = y2;
03649                      }
03650                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03651                   }
03652                   EnvelopeBars(x2,y2,x3,y3);
03653                   if (fLine!=0) {
03654                      if (fLine==1) {
03655                         fXe = x3;
03656                         fYe = y3;
03657                      }
03658                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03659                   }
03660                   EnvelopeBars(x1,y1,x4,y4);
03661                   if (fLine!=0) {
03662                      if (fLine==1) {
03663                         fXe = x4;
03664                         fYe = y4;
03665                      }
03666                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03667                   }
03668                   EnvelopeBars(x4,y4,x3,y3);
03669                   if (fLine!=0) {
03670                      if (fLine==1) {
03671                         fXe = x3;
03672                         fYe = y3;
03673                      }
03674                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03675                   }
03676                } else if ((fDisplayMode==kDisplayModeBarsY)&&(((flag!=0)&&(smer==0))||((flag==0)&&(smer!=0)))) {
03677                   EnvelopeBars(ix5,iy5,x6,y6);
03678                   if (fLine!=0) {
03679                      if (fLine==1) {
03680                         fXe = x6;
03681                         fYe = y6;
03682                      }
03683                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03684                   }
03685                   EnvelopeBars(x1,y1,ix5,iy5);
03686                   if (fLine!=0) {
03687                      if (fLine==1) {
03688                         fXe = ix5;
03689                         fYe = iy5;
03690                      }
03691                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03692                   }
03693                   EnvelopeBars(x2,y2,x6,y6);
03694                   if (fLine!=0) {
03695                      if (fLine==1) {
03696                         fXe = x6;
03697                         fYe = y6;
03698                      }
03699                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03700                   }
03701                   if (fModeGroup!=kModeGroupSimple) {
03702                      v   = ColorCalculation(dx1,dy1,z4,dx2,dy2,z4,dx4,dy4,z4);
03703                      v   = v*fLevels+0.5;
03704                      iv  = fLevels-(Int_t)v;
03705                      uip = fNewColorIndex;
03706                      ColorModel(iv,ui1,ui2,ui3);
03707                      line->SetLineColor(fNewColorIndex);
03708                   }
03709                   EnvelopeBars(x1,y1,x2,y2);
03710                   if (fLine!=0) {
03711                      if (fLine==1) {
03712                         fXe = x2;
03713                         fYe = y2;
03714                      }
03715                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03716                   }
03717                   if (fModeGroup!=kModeGroupSimple) {
03718                      line->SetLineColor(uip);
03719                   }
03720                } else if ((fDisplayMode==kDisplayModeBarsX)&&(((flag==0)&&(smer==0))||((flag!=0)&&(smer!=0)))) {
03721                   EnvelopeBars(x7,y7,x6,y6);
03722                   if (fLine!=0) {
03723                      if (fLine==1) {
03724                         fXe = x6;
03725                         fYe = y6;
03726                      }
03727                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03728                   }
03729                   EnvelopeBars(x2,y2,x6,y6);
03730                   if (fLine!=0) {
03731                      if (fLine==1) {
03732                         fXe = x6;
03733                         fYe = y6;
03734                      }
03735                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03736                   }
03737                   EnvelopeBars(x3,y3,x7,y7);
03738                   if (fLine!=0) {
03739                      if (fLine==1) {
03740                         fXe = x7;
03741                         fYe = y7;
03742                      }
03743                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03744                   }
03745                   if (fModeGroup!=kModeGroupSimple) {
03746                      v   = ColorCalculation(dx1,dy1,z4,dx2,dy2,z4,dx4,dy4,z4);
03747                      v   = v*fLevels+0.5;
03748                      iv  = fLevels-(Int_t)v;
03749                      uip = fNewColorIndex;
03750                      ColorModel(iv,ui1,ui2,ui3);
03751                      line->SetLineColor(fNewColorIndex);
03752                   }
03753                   EnvelopeBars(x3,y3,x2,y2);
03754                   if (fLine!=0) {
03755                      if (fLine==1) {
03756                         fXe = x2;
03757                         fYe = y2;
03758                      }
03759                      line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03760                   }
03761                   if (fModeGroup!=kModeGroupSimple) {
03762                      line->SetLineColor(uip);
03763                   }
03764                }
03765                break;
03766             case kDisplayModeLinesX:
03767                if (fModeGroup==kModeGroupSimple) {
03768                   if (((flag==0)&&(smer==0))||((flag!=0)&&(smer!=0))) {
03769                      if (fBezier==kNoBezierInterpol) {
03770                         Envelope(x1,y1,x2,y2);
03771                         if (fLine!=0) {
03772                            if (fLine==1) {
03773                               fXe = x2;
03774                               fYe = y2;
03775                            }
03776                            line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03777                         }
03778                      } else {
03779                         s1 = q1;
03780                         t1 = (Int_t)TMath::Max(q2-1,0);
03781                         s2 = q1;
03782                         t2 = (Int_t)TMath::Min(q2+2,w2);
03783                         if (turni==1) {
03784                            i1 = s1;
03785                            i2 = s2;
03786                         } else {
03787                            i1 = (Int_t)TMath::Max(w1-s1,0);
03788                            i2 = (Int_t)TMath::Max(w1-s2,0);
03789                         }
03790                         if (turnj==1) {
03791                            j1 = t1;
03792                            j2 = t2;
03793                         } else {
03794                            j1 = (Int_t)TMath::Max(w2-t1,0);
03795                            j2 = (Int_t)TMath::Max(w2-t2,0);
03796                         }
03797                         Transform(i1,j1,0);
03798                         x3 = fXt;
03799                         y3 = fYt;
03800                         Transform(i2,j2,0);
03801                         x4    = fXt;
03802                         y4    = fYt;
03803                         bezx1 = x1+(x2-x1)/3;
03804                         bezx2 = x1+2*(x2-x1)/3;
03805                         bezy1 = y1+(y2-y3)/6;
03806                         bezy2 = y2-(y4-y1)/6;
03807                         if (x1<=x2) {
03808                            if (bezx1<=x1) {
03809                               bezx1 = x1;
03810                               bezy1 = y1;
03811                            }
03812                            if (bezx1>=x2) {
03813                               bezx1 = x2;
03814                               bezy1 = y2;
03815                            }
03816                            if (bezx2<=x1) {
03817                               bezx2 = x1;
03818                               bezy2 = y1;
03819                            }
03820                            if (bezx2>=x2) {
03821                               bezx2 = x2;
03822                               bezy2 = y2;
03823                            }
03824                            fBzX[0] = x1;
03825                            fBzY[0] = y1;
03826                            fBzX[1] = (Int_t)bezx1;
03827                            fBzY[1] = (Int_t)bezy1;
03828                            fBzX[2] = (Int_t)bezx2;
03829                            fBzY[2] = (Int_t)bezy2;
03830                            fBzX[3] = x2;
03831                            fBzY[3] = y2;
03832                            for (bezf=0;bezf<1.01;bezf+=0.1) {
03833                               BezierSmoothing(bezf);
03834                               if (bezf==0) {
03835                                  ibezx1 = (Int_t)(fGbezx+0.5);
03836                                  ibezy1 = (Int_t)(fGbezy+0.5);
03837                               } else {
03838                                  ibezx2 = ibezx1;
03839                                  ibezy2 = ibezy1;
03840                                  ibezx1 = (Int_t)(fGbezx+0.5);
03841                                  ibezy1 = (Int_t)(fGbezy+0.5);
03842                                  Envelope(ibezx2,ibezy2,ibezx1,ibezy1);
03843                                  if (fLine!=0) {
03844                                     if (fLine==1) {
03845                                        fXe = ibezx1;
03846                                        fYe = ibezy1;
03847                                     }
03848                                     line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03849                                  }
03850                               }
03851                            }
03852                         } else if (x1>x2) {
03853                            if (bezx1>=x1) {
03854                               bezx1 = x1;
03855                               bezy1 = y1;
03856                            }
03857                            if (bezx1<=x2) {
03858                               bezx1 = x2;
03859                               bezy1 = y2;
03860                            }
03861                            if (bezx2>=x1) {
03862                               bezx2 = x1;
03863                               bezy2 = y1;
03864                            }
03865                            if (bezx2<=x2) {
03866                               bezx2 = x2;
03867                               bezy2 = y2;
03868                            }
03869                            fBzX[0] = x1;
03870                            fBzY[0] = y1;
03871                            fBzX[1] = (Int_t)bezx1;
03872                            fBzY[1] = (Int_t)bezy1;
03873                            fBzX[2] = (Int_t)bezx2;
03874                            fBzY[2] = (Int_t)bezy2;
03875                            fBzX[3] = x2;
03876                            fBzY[3] = y2;
03877                            for (bezf=0;bezf<1.01;bezf+=0.1) {
03878                               BezierSmoothing(bezf);
03879                               if (bezf==0) {
03880                                  ibezx1 = (Int_t)(fGbezx+0.5);
03881                                  ibezy1 = (Int_t)(fGbezy+0.5);
03882                               } else {
03883                                  ibezx2 = ibezx1;
03884                                  ibezy2 = ibezy1;
03885                                  ibezx1 = (Int_t)(fGbezx+0.5);
03886                                  ibezy1 = (Int_t)(fGbezy+0.5);
03887                                  Envelope(ibezx1,ibezy1,ibezx2,ibezy2);
03888                                  if (fLine!=0) {
03889                                     if (fLine==1) {
03890                                        fXe = ibezx2;
03891                                        fYe = ibezy2;
03892                                     }
03893                                     line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
03894                                  }
03895                               }
03896                            }
03897                         }
03898                      }
03899                   }
03900                } else {
03901                   if ((q1!=q2||smer!=0)&&flag==1) {
03902                      s1 = q1+1;
03903                      t1 = q2;
03904                      s2 = q1;
03905                      t2 = q2;
03906                      s3 = q1;
03907                      t3 = q2+1;
03908                      s4 = q1+1;
03909                      t4 = q2+1;
03910                      if (fShading==kShaded) {
03911                         sr1 = s1;
03912                         tr1 = (Int_t)TMath::Max(t1-1,0);
03913                         sr2 = s2;
03914                         tr2 = (Int_t)TMath::Max(t2-1,0);
03915                         sr3 = (Int_t)TMath::Max(s2-1,0);
03916                         tr3 = t2;
03917                         sr4 = (Int_t)TMath::Max(s3-1,0);
03918                         tr4 = t3;
03919                         sr5 = s3;
03920                         tr5 = t3+1;
03921                         sr6 = s4;
03922                         tr6 = t4+1;
03923                         sr7 = s4+1;
03924                         tr7 = t4;
03925                         sr8 = s1+1;
03926                         tr8 = t1;
03927                      }
03928                      if (turni==1) {
03929                         i1 = s1;
03930                         i2 = s2;
03931                         i3 = s3;
03932                         i4 = s4;
03933                      } else {
03934                         i1 = (Int_t)TMath::Max(w1-s1,0);
03935                         i2 = (Int_t)TMath::Max(w1-s2,0);
03936                         i3 = (Int_t)TMath::Max(w1-s3,0);
03937                         i4 = (Int_t)TMath::Max(w1-s4,0);
03938                         if (fShading==kShaded) {
03939                            sr1 = (Int_t)TMath::Max(w1-sr1,0);
03940                            sr2 = (Int_t)TMath::Max(w1-sr2,0);
03941                            sr3 = (Int_t)TMath::Max(w1-sr3,0);
03942                            sr4 = (Int_t)TMath::Max(w1-sr4,0);
03943                            sr5 = (Int_t)TMath::Max(w1-sr5,0);
03944                            sr6 = (Int_t)TMath::Max(w1-sr6,0);
03945                            sr7 = (Int_t)TMath::Max(w1-sr7,0);
03946                            sr8 = (Int_t)TMath::Max(w1-sr8,0);
03947                         }
03948                      }
03949                      if (turnj==1) {
03950                         j1 = t1;
03951                         j2 = t2;
03952                         j3 = t3;
03953                         j4 = t4;
03954                      } else {
03955                         j1 = (Int_t)TMath::Max(w2-t1,0);
03956                         j2 = (Int_t)TMath::Max(w2-t2,0);
03957                         j3 = (Int_t)TMath::Max(w2-t3,0);
03958                         j4 = (Int_t)TMath::Max(w2-t4,0);
03959                         if (fShading==kShaded) {
03960                            tr1 = (Int_t)TMath::Max(w2-tr1,0);
03961                            tr2 = (Int_t)TMath::Max(w2-tr2,0);
03962                            tr3 = (Int_t)TMath::Max(w2-tr3,0);
03963                            tr4 = (Int_t)TMath::Max(w2-tr4,0);
03964                            tr5 = (Int_t)TMath::Max(w2-tr5,0);
03965                            tr6 = (Int_t)TMath::Max(w2-tr6,0);
03966                            tr7 = (Int_t)TMath::Max(w2-tr7,0);
03967                            tr8 = (Int_t)TMath::Max(w2-tr8,0);
03968                         }
03969                      }
03970                      Transform(i1,j1,0);
03971                      x1  = fXt;
03972                      y1  = fYt;
03973                      dx1 = fDxspline;
03974                      dy1 = fDyspline;
03975                      z1  = fZ;
03976                      Transform(i2,j2,0);
03977                      x2  = fXt;
03978                      y2  = fYt;
03979                      dx2 = fDxspline;
03980                      dy2 = fDyspline;
03981                      z2  = fZ;
03982                      Transform(i3,j3,0);
03983                      x3  = fXt;
03984                      y3  = fYt;
03985                      dx3 = fDxspline;
03986                      dy3 = fDyspline;
03987                      z3  = fZ;
03988                      Transform(i4,j4,0);
03989                      x4  = fXt;
03990                      y4  = fYt;
03991                      dx4 = fDxspline;
03992                      dy4 = fDyspline;
03993                      z4  = fZ;
03994                      Envelope(x1,y1,x2,y2);
03995                      Envelope(x2,y2,x3,y3);
03996                      xtaz = (dx1+dx2+dx4)/3;
03997                      ytaz = (dy1+dy2+dy4)/3;
03998                      ztaz = (z1+z2+z4)/3;
03999                      v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
04000                      if (fShading==kShaded) {
04001                         if (fShadow==kShadowsNotPainted) {
04002                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
04003                            else                              Transform(sr1,tr1,0);
04004                            dxr1 = fDxspline;
04005                            dyr1 = fDyspline;
04006                            zr1  = fZ;
04007                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
04008                            else                              Transform(sr8,tr8,0);
04009                            dxr2 = fDxspline;
04010                            dyr2 = fDyspline;
04011                            zr2  = fZ;
04012                            v    = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
04013                            v    = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
04014                            v    = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
04015                            v1   = v/4;
04016                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
04017                            else                              Transform(sr3,tr3,0);
04018                            dxr1 = fDxspline;
04019                            dyr1 = fDyspline;
04020                            zr1  = fZ;
04021                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
04022                            else                              Transform(sr2,tr2,0);
04023                            dxr2 = fDxspline;
04024                            dyr2 = fDyspline;
04025                            zr2  = fZ;
04026                            v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
04027                            v    = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
04028                            v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
04029                            v    = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
04030                            v2   = v/4;
04031                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
04032                            else                              Transform(sr5,tr5,0);
04033                            dxr1 = fDxspline;
04034                            dyr1 = fDyspline;
04035                            zr1  = fZ;
04036                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
04037                            else                              Transform(sr4,tr4,0);
04038                            dxr2 = fDxspline;
04039                            dyr2 = fDyspline;
04040                            zr2  = fZ;
04041                            v    = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
04042                            v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
04043                            v    = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
04044                            v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
04045                            v3   = v/4;
04046                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
04047                            else                              Transform(sr7,tr7,0);
04048                            dxr1 = fDxspline;
04049                            dyr1 = fDyspline;
04050                            zr1  = fZ;
04051                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
04052                            else                              Transform(sr6,tr6,0);
04053                            dxr2 = fDxspline;
04054                            dyr2 = fDyspline;
04055                            zr2  = fZ;
04056                            v    = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
04057                            v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
04058                            v    = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
04059                            v    = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
04060                            v4   = v/4;
04061                         } else {
04062                            spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
04063                            v     = v+spriz;
04064                            v     = v/2;
04065                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
04066                            else                              Transform(sr1,tr1,0);
04067                            dxr1  = fDxspline;
04068                            dyr1  = fDyspline;
04069                            zr1   = fZ;
04070                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
04071                            else                              Transform(sr8,tr8,0);
04072                            dxr2  = fDxspline;
04073                            dyr2  = fDyspline;
04074                            zr2   = fZ;
04075                            da    = (dxr1+dx2+dx1)/3;
04076                            db    = (dyr1+dy2+dy1)/3;
04077                            dc    = (zr1+z2+z1)/3;
04078                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04079                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
04080                            da    = (dxr1+dxr2+dx1)/3;
04081                            db    = (dyr1+dyr2+dy1)/3;
04082                            dc    = (zr1+zr2+z1)/3;
04083                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04084                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
04085                            da    = (dxr2+dx1+dx4)/3;
04086                            db    = (dyr2+dy1+dy4)/3;
04087                            dc    = (zr2+z1+z4)/3;
04088                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04089                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
04090                            v1    = v/4;
04091                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
04092                            else                              Transform(sr3,tr3,0);
04093                            dxr1  = fDxspline;
04094                            dyr1  = fDyspline;
04095                            zr1   = fZ;
04096                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
04097                            else                              Transform(sr2,tr2,0);
04098                            dxr2  = fDxspline;
04099                            dyr2  = fDyspline;
04100                            zr2   = fZ;
04101                            da    = (dx1+dx2+dx3)/3;
04102                            db    = (dy1+dy2+dy3)/3;
04103                            dc    = (z1+z2+z3)/3;
04104                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04105                            v     = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
04106                            da    = (dx2+dxr1+dx3)/3;
04107                            db    = (dy2+dyr1+dy3)/3;
04108                            dc    = (z2+zr1+z3)/3;
04109                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04110                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
04111                            da    = (dx2+dxr2+dxr1)/3;
04112                            db    = (dy2+dyr2+dyr1)/3;
04113                            dc    = (z2+zr2+zr1)/3;
04114                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04115                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
04116                            da    = (dxr2+dx2+dx1)/3;
04117                            db    = (dyr2+dy2+dy1)/3;
04118                            dc    = (zr2+z2+z1)/3;
04119                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04120                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
04121                            v2    = v/4;
04122                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
04123                            else                              Transform(sr5,tr5,0);
04124                            dxr1  = fDxspline;
04125                            dyr1  = fDyspline;
04126                            zr1   = fZ;
04127                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
04128                            else                              Transform(sr4,tr4,0);
04129                            dxr2  = fDxspline;
04130                            dyr2  = fDyspline;
04131                            zr2   = fZ;
04132                            da    = (dx2+dx3+dx4)/3;
04133                            db    = (dy2+dy3+dy4)/3;
04134                            dc    = (z2+z3+z4)/3;
04135                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04136                            v     = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
04137                            da    = (dx4+dx3+dxr1)/3;
04138                            db    = (dy4+dy3+dyr1)/3;
04139                            dc    = (z4+z3+zr1)/3;
04140                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04141                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
04142                            da    = (dx3+dxr2+dxr1)/3;
04143                            db    = (dy3+dyr2+dyr1)/3;
04144                            dc    = (z3+zr2+zr1)/3;
04145                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04146                            v     = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
04147                            da    = (dx2+dxr2+dx3)/3;
04148                            db    = (dy2+dyr2+dy3)/3;
04149                            dc    = (z2+zr2+z3)/3;
04150                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04151                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
04152                            v3    = v/4;
04153                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
04154                            else                              Transform(sr7,tr7,0);
04155                            dxr1  = fDxspline;
04156                            dyr1  = fDyspline;
04157                            zr1   = fZ;
04158                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
04159                            else                              Transform(sr6,tr6,0);
04160                            dxr2  = fDxspline;
04161                            dyr2  = fDyspline;
04162                            zr2   = fZ;
04163                            da    = (dx1+dx3+dx4)/3;
04164                            db    = (dy1+dy3+dy4)/3;
04165                            dc    = (z1+z3+z4)/3;
04166                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04167                            v     = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
04168                            da    = (dx4+dx3+dxr2)/3;
04169                            db    = (dy4+dy3+dyr2)/3;
04170                            dc    = (z4+z3+zr2)/3;
04171                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04172                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
04173                            da    = (dx4+dxr2+dxr1)/3;
04174                            db    = (dy4+dyr2+dyr1)/3;
04175                            dc    = (z4+zr2+zr1)/3;
04176                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04177                            v     = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
04178                            da    = (dx1+dx4+dxr1)/3;
04179                            db    = (dy1+dy4+dyr1)/3;
04180                            dc    = (z1+z4+zr1)/3;
04181                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04182                            v     = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
04183                            v4    = v/4;
04184                         }
04185                      }
04186                      spriz = 0;
04187                      if (fShadow==kShadowsNotPainted) {
04188                         if (fShading==kNotShaded) {
04189                            v  = v*fLevels+0.5;
04190                            iv = fLevels-(Int_t)v;
04191                         } else {
04192                            v1  = v1*fLevels;
04193                            iv1 = fLevels-(Int_t)v1;
04194                            v2  = v2*fLevels;
04195                            iv2 = fLevels-(Int_t)v2;
04196                            v4  = v4*fLevels;
04197                            iv4 = fLevels-(Int_t)v4;
04198                         }
04199                      } else {
04200                      spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
04201                         if (fShading==kNotShaded) {
04202                            v  = v*fLevels/2.0;
04203                            iv = fLevels-(Int_t)(v+0.5);
04204                         } else {
04205                            v1  = v1*fLevels;
04206                            iv1 = fLevels-(Int_t)v1;
04207                            v2  = v2*fLevels;
04208                            iv2 = fLevels-(Int_t)v2;
04209                            v4  = v4*fLevels;
04210                            iv4 = fLevels-(Int_t)v4;
04211                         }
04212                      }
04213                      if (fShading==kNotShaded) {
04214                         ColorModel(iv,ui1,ui2,ui3);
04215                         line->SetLineColor(fNewColorIndex);
04216                      } else {
04217                         dx1 = x1;
04218                         dy1 = y1;
04219                         dx2 = x2;
04220                         dy2 = y2;
04221                         dx3 = x4;
04222                         dy3 = y4;
04223                         z1  = iv1;
04224                         z2  = iv2;
04225                         z3  = iv4;
04226                         da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
04227                         db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
04228                         dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
04229                         dd  = -da*dx1-db*dy1-dc*z1;
04230                      }
04231                      sx1 = x1;
04232                      sy1 = y1;
04233                      sx3 = x4;
04234                      sy3 = y4;
04235                      if (sx3<sx1) {
04236                         sx4 = sx1;
04237                         sy4 = sy1;
04238                         sx1 = sx3;
04239                         sy1 = sy3;
04240                         sx3 = sx4;
04241                         sy3 = sy4;
04242                      }
04243                      pom1 = sy3-sy1;
04244                      pom2 = sx3-sx1;
04245                      if (pom2!=0) sdx2 = pom1/pom2;
04246                      pom1  = sy1;
04247                      pom2  = sx1;
04248                      sdy2  = pom1-sdx2*pom2;
04249                      sx1p  = sx1;
04250                      sy1p  = sy1;
04251                      sx3p  = sx3;
04252                      sdx2p = sdx2;
04253                      sdy2p = sdy2;
04254                      dap   = da;
04255                      dbp   = db;
04256                      dcp   = dc;
04257                      ddp   = dd;
04258                      uip   = fNewColorIndex;
04259                      xtaz  = (dx3+dx2+dx4)/3;
04260                      ytaz  = (dy3+dy2+dy4)/3;
04261                      ztaz  = (z3+z2+z4)/3;
04262                      if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
04263                      spriz = 0;
04264                      if (fShadow==kShadowsNotPainted) {
04265                         if (fShading==kNotShaded) {
04266                            v  = v*fLevels;
04267                            iv = fLevels-(Int_t)v;
04268                         } else {
04269                            v3  = v3*fLevels;
04270                            iv3 = fLevels-(Int_t)v3;
04271                         }
04272                      } else {
04273                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
04274                         if (fShading==kNotShaded) {
04275                            v  = v*fLevels/2;
04276                            iv = fLevels-(Int_t)v;
04277                            iv = (Int_t)(iv-fLevels*spriz/2);
04278                         } else {
04279                            v3  = v3*fLevels;
04280                            iv3 = fLevels-(Int_t)v3;
04281                         }
04282                      }
04283                      if (fShading==kNotShaded) {
04284                         ColorModel(iv,ui1,ui2,ui3);
04285                         line->SetLineColor(fNewColorIndex);
04286                      } else {
04287                         dx1 = x2;
04288                         dy1 = y2;
04289                         dx2 = x3;
04290                         dy2 = y3;
04291                         dx3 = x4;
04292                         dy3 = y4;
04293                         z1  = iv2;
04294                         z2  = iv3;
04295                         z3  = iv4;
04296                         da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
04297                         db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
04298                         dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
04299                         dd  = -da*dx1-db*dy1-dc*z1;
04300                      }
04301                      sx1 = x2;
04302                      sy1 = y2;
04303                      sx2 = x3;
04304                      sy2 = y3;
04305                      if (sx2<sx1) {
04306                         sx4 = sx1;
04307                         sy4 = sy1;
04308                         sx1 = sx2;
04309                         sy1 = sy2;
04310                         sx2 = sx4;
04311                         sy2 = sy4;
04312                      }
04313                      pom1 = sy2-sy1;
04314                      pom2 = sx2-sx1;
04315                      sdx1 = 0;
04316                      if (pom2!=0) sdx1 = pom1/pom2;
04317                      pom1 = sy1;
04318                      pom2 = sx1;
04319                      sdy1 = pom1-sdx1*pom2;
04320                      for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
04321                         pom1 = sx4;
04322                         sdy4 = sdx1*pom1+sdy1;
04323                         sy4  = (Int_t)sdy4;
04324                         if (sy4<=fEnvelope[sx4]) {
04325                            fEnvelope[sx4] = sy4;
04326                            if (fShading==kNotShaded) {
04327                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04328                            } else {
04329                               dx1 = sx4;
04330                               dy1 = sy4;
04331                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
04332                               else       v =(iv1+iv2+iv4)/3;
04333                               iv = (Int_t)v;
04334                               ColorModel(iv,ui1,ui2,ui3);
04335                               line->SetLineColor(fNewColorIndex);
04336                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04337                            }
04338                            sy5 = sy4;
04339                         } else {
04340                            sy4 = fEnvelope[sx4];
04341                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
04342                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04343                            } else if (sy5<=fEnvelope[sx5]) {
04344                               dx1 = sx4;
04345                               dy1 = sy4;
04346                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
04347                               else       v =(iv1+iv2+iv4)/3;
04348                               iv = (Int_t)v;
04349                               ColorModel(iv,ui1,ui2,ui3);
04350                               line->SetLineColor(fNewColorIndex);
04351                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04352                            }
04353                            sy5 = fEnvelope[sx4];
04354                         }
04355                         sx5 = sx4;
04356                      }
04357                      for (sx4=sx1p,sx5=sx1p,sy5=sy1p;sx4<=sx3p;sx4++) {
04358                         pom1 = sx4;
04359                         sdy4 = sdx2p*pom1+sdy2p;
04360                         sy4  = (Int_t)sdy4;
04361                         if (sy4<=fEnvelope[sx4]) {
04362                            fEnvelope[sx4]=sy4;
04363                            if (fShading==kNotShaded) {
04364                               line->SetLineColor(uip);
04365                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04366                            } else {
04367                               dx1 = sx4;
04368                               dy1 = sy4;
04369                               if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
04370                               else        v = (iv1+iv2+iv4)/3;
04371                               iv = (Int_t)v;
04372                               ColorModel(iv,ui1,ui2,ui3);
04373                               line->SetLineColor(fNewColorIndex);
04374                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04375                            }
04376                            sy5 = sy4;
04377                         } else {
04378                            sy4 = fEnvelope[sx4];
04379                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
04380                               line->SetLineColor(uip);
04381                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04382                            } else if (sy5<=fEnvelope[sx5]) {
04383                               dx1 = sx4;
04384                               dy1 = sy4;
04385                               if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
04386                               else        v = (iv1+iv2+iv4)/3;
04387                               iv = (Int_t)v;
04388                               ColorModel(iv,ui1,ui2,ui3);
04389                               line->SetLineColor(fNewColorIndex);
04390                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04391                            }
04392                            sy5 = fEnvelope[sx4];
04393                         }
04394                         sx5 = sx4;
04395                      }
04396                   }
04397                }
04398                break;
04399             case kDisplayModeLinesY:
04400                if (fModeGroup==kModeGroupSimple) {
04401                   if (((flag!=0)&&(smer==0))||((flag==0)&&(smer!=0))) {
04402                      if (fBezier==kNoBezierInterpol) {
04403                         Envelope(x1,y1,x2,y2);
04404                         if (fLine!=0) {
04405                            if (fLine==1) {
04406                               fXe = x2;
04407                               fYe = y2;
04408                            }
04409                            line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
04410                         }
04411                      } else {
04412                         s1 = (Int_t)TMath::Max(q1-1,0);
04413                         t1 = q2;
04414                         s2 = (Int_t)TMath::Min(q1+2,w1);
04415                         t2 = q2;
04416                         if (turni==1) {
04417                            i1 = s1;
04418                            i2 = s2;
04419                         } else {
04420                            i1 = w1-s1;
04421                            i2 = w1-s2;
04422                         }
04423                         if (turnj==1) {
04424                            j1 = t1;
04425                            j2 = t2;
04426                         } else {
04427                            j1 = w2-t1;
04428                            j2 = w2-t2;
04429                         }
04430                         Transform(i1,j1,0);
04431                         x3 = fXt;
04432                         y3 = fYt;
04433                         Transform(i2,j2,0);
04434                         x4 = fXt;
04435                         y4 = fYt;
04436                         bezx1 = x1+(x2-x1)/3;
04437                         bezx2 = x1+2*(x2-x1)/3;
04438                         bezy1 = y1+(y2-y3)/6;
04439                         bezy2 = y2-(y4-y1)/6;
04440                         if (x1<=x2) {
04441                            if (bezx1<=x1) {
04442                               bezx1 = x1;
04443                               bezy1 = y1;
04444                            }
04445                            if (bezx1>=x2) {
04446                               bezx1 = x2;
04447                               bezy1 = y2;
04448                            }
04449                            if (bezx2<=x1) {
04450                               bezx2 = x1;
04451                               bezy2 = y1;
04452                            }
04453                            if (bezx2>=x2) {
04454                               bezx2 = x2;
04455                               bezy2 = y2;
04456                            }
04457                            fBzX[0] = x1;
04458                            fBzY[0] = y1;
04459                            fBzX[1] = (Int_t)bezx1;
04460                            fBzY[1] = (Int_t)bezy1;
04461                            fBzX[2] = (Int_t)bezx2;
04462                            fBzY[2] = (Int_t)bezy2;
04463                            fBzX[3] = x2;
04464                            fBzY[3] = y2;
04465                            for (bezf=0;bezf<1.01;bezf+=0.1) {
04466                            BezierSmoothing(bezf);
04467                               if (bezf==0) {
04468                                  ibezx1 = (Int_t)(fGbezx+0.5);
04469                                  ibezy1 = (Int_t)(fGbezy+0.5);
04470                               } else {
04471                                  ibezx2 = ibezx1;
04472                                  ibezy2 = ibezy1;
04473                                  ibezx1 = (Int_t)(fGbezx+0.5);
04474                                  ibezy1 = (Int_t)(fGbezy+0.5);
04475                                  Envelope(ibezx2,ibezy2,ibezx1,ibezy1);
04476                                  if (fLine!=0) {
04477                                     if (fLine==1) {
04478                                        fXe = ibezx1;
04479                                        fYe = ibezy1;
04480                                     }
04481                                     line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
04482                                  }
04483                               }
04484                            }
04485                         } else if (x1>x2) {
04486                            if (bezx1>=x1) {
04487                               bezx1 = x1;
04488                               bezy1 = y1;
04489                            }
04490                            if (bezx1<=x2) {
04491                               bezx1 = x2;
04492                               bezy1 = y2;
04493                            }
04494                            if (bezx2>=x1) {
04495                               bezx2 = x1;
04496                               bezy2 = y1;
04497                            }
04498                            if (bezx2<=x2) {
04499                               bezx2 = x2;
04500                               bezy2 = y2;
04501                            }
04502                            fBzX[0] = x1;
04503                            fBzY[0] = y1;
04504                            fBzX[1] = (Int_t)bezx1;
04505                            fBzY[1] = (Int_t)bezy1;
04506                            fBzX[2] = (Int_t)bezx2;
04507                            fBzY[2] = (Int_t)bezy2;
04508                            fBzX[3] = x2;
04509                            fBzY[3] = y2;
04510                            for (bezf=0;bezf<1.01;bezf+=0.1) {
04511                               BezierSmoothing(bezf);
04512                               if (bezf==0) {
04513                                  ibezx1 = (Int_t)(fGbezx+0.5);
04514                                  ibezy1 = (Int_t)(fGbezy+0.5);
04515                               } else {
04516                               ibezx2 = ibezx1;
04517                               ibezy2 = ibezy1;
04518                               ibezx1 = (Int_t)(fGbezx+0.5);
04519                               ibezy1 = (Int_t)(fGbezy+0.5);
04520                               Envelope(ibezx1,ibezy1,ibezx2,ibezy2);
04521                               if (fLine!=0) {
04522                                  if (fLine==1) {
04523                                     fXe = ibezx2;
04524                                     fYe = ibezy2;
04525                                  }
04526                                  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
04527                                  }
04528                               }
04529                            }
04530                         }
04531                      }
04532                   }
04533                } else {
04534                   if ((q1!=q2||smer!=0)&&flag==1) {
04535                      s1 = q1+1;
04536                      t1 = q2;
04537                      s2 = q1;
04538                      t2 = q2;
04539                      s3 = q1;
04540                      t3 = q2+1;
04541                      s4 = q1+1;
04542                      t4 = q2+1;
04543                      if (fShading==kShaded) {
04544                         sr1 = s1;
04545                         tr1 = (Int_t)TMath::Max(t1-1,0);
04546                         sr2 = s2;
04547                         tr2 = (Int_t)TMath::Max(t2-1,0);
04548                         sr3 = (Int_t)TMath::Max(s2-1,0);
04549                         tr3 = t2;
04550                         sr4 = (Int_t)TMath::Max(s3-1,0);
04551                         tr4 = t3;
04552                         sr5 = s3;
04553                         tr5 = t3+1;
04554                         sr6 = s4;
04555                         tr6 = t4+1;
04556                         sr7 = s4+1;
04557                         tr7 = t4;
04558                         sr8 = s1+1;
04559                         tr8 = t1;
04560                      }
04561                         if (turni==1) {
04562                         i1 = s1;
04563                         i2 = s2;
04564                         i3 = s3;
04565                         i4 = s4;
04566                      } else {
04567                         i1 = (Int_t)TMath::Max(w1-s1,0);
04568                         i2 = (Int_t)TMath::Max(w1-s2,0);
04569                         i3 = (Int_t)TMath::Max(w1-s3,0);
04570                         i4 = (Int_t)TMath::Max(w1-s4,0);
04571                         if (fShading==kShaded) {
04572                            sr1 = (Int_t)TMath::Max(w1-sr1,0);
04573                            sr2 = (Int_t)TMath::Max(w1-sr2,0);
04574                            sr3 = (Int_t)TMath::Max(w1-sr3,0);
04575                            sr4 = (Int_t)TMath::Max(w1-sr4,0);
04576                            sr5 = (Int_t)TMath::Max(w1-sr5,0);
04577                            sr6 = (Int_t)TMath::Max(w1-sr6,0);
04578                            sr7 = (Int_t)TMath::Max(w1-sr7,0);
04579                            sr8 = (Int_t)TMath::Max(w1-sr8,0);
04580                         }
04581                      }
04582                      if (turnj==1) {
04583                         j1 = t1;
04584                         j2 = t2;
04585                         j3 = t3;
04586                         j4 = t4;
04587                      } else {
04588                         j1 = (Int_t)TMath::Max(w2-t1,0);
04589                         j2 = (Int_t)TMath::Max(w2-t2,0);
04590                         j3 = (Int_t)TMath::Max(w2-t3,0);
04591                         j4 = (Int_t)TMath::Max(w2-t4,0);
04592                         if (fShading==kShaded) {
04593                            tr1 = (Int_t)TMath::Max(w2-tr1,0);
04594                            tr2 = (Int_t)TMath::Max(w2-tr2,0);
04595                            tr3 = (Int_t)TMath::Max(w2-tr3,0);
04596                            tr4 = (Int_t)TMath::Max(w2-tr4,0);
04597                            tr5 = (Int_t)TMath::Max(w2-tr5,0);
04598                            tr6 = (Int_t)TMath::Max(w2-tr6,0);
04599                            tr7 = (Int_t)TMath::Max(w2-tr7,0);
04600                            tr8 = (Int_t)TMath::Max(w2-tr8,0);
04601                         }
04602                      }
04603                      Transform(i1,j1,0);
04604                      x1  = fXt;
04605                      y1  = fYt;
04606                      dx1 = fDxspline;
04607                      dy1 = fDyspline;
04608                      z1  = fZ;
04609                      Transform(i2,j2,0);
04610                      x2  = fXt;
04611                      y2  = fYt;
04612                      dx2 = fDxspline;
04613                      dy2 = fDyspline;
04614                      z2  = fZ;
04615                      Transform(i3,j3,0);
04616                      x3  = fXt;
04617                      y3  = fYt;
04618                      dx3 = fDxspline;
04619                      dy3 = fDyspline;
04620                      z3  = fZ;
04621                      Transform(i4,j4,0);
04622                      x4  = fXt;
04623                      y4  = fYt;
04624                      dx4 = fDxspline;
04625                      dy4 = fDyspline;
04626                      z4  = fZ;
04627                      Envelope(x1,y1,x2,y2);
04628                      Envelope(x2,y2,x3,y3);
04629                      xtaz = (dx1+dx2+dx4)/3;
04630                      ytaz = (dy1+dy2+dy4)/3;
04631                      ztaz = (z1+z2+z4)/3;
04632                      v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
04633                      if (fShading==kShaded) {
04634                         if (fShadow==kShadowsNotPainted) {
04635                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
04636                            else                              Transform(sr1,tr1,0);
04637                            dxr1 = fDxspline;
04638                            dyr1 = fDyspline;
04639                            zr1  = fZ;
04640                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
04641                            else                              Transform(sr8,tr8,0);
04642                            dxr2 = fDxspline;
04643                            dyr2 = fDyspline;
04644                            zr2  = fZ;
04645                            v    = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
04646                            v    = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
04647                            v    = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
04648                            v1   = v/4;
04649                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
04650                            else                              Transform(sr3,tr3,0);
04651                            dxr1 = fDxspline;
04652                            dyr1 = fDyspline;
04653                            zr1  = fZ;
04654                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
04655                            else                              Transform(sr2,tr2,0);
04656                            dxr2 = fDxspline;
04657                            dyr2 = fDyspline;
04658                            zr2  = fZ;
04659                            v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
04660                            v    = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
04661                            v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
04662                            v    = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
04663                            v2   = v/4;
04664                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
04665                            else                              Transform(sr5,tr5,0);
04666                            dxr1 = fDxspline;
04667                            dyr1 = fDyspline;
04668                            zr1  = fZ;
04669                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
04670                            else                              Transform(sr4,tr4,0);
04671                            dxr2 = fDxspline;
04672                            dyr2 = fDyspline;
04673                            zr2  = fZ;
04674                            v    = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
04675                            v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
04676                            v    = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
04677                            v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
04678                            v3   = v/4;
04679                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
04680                            else                              Transform(sr7,tr7,0);
04681                            dxr1 = fDxspline;
04682                            dyr1 = fDyspline;
04683                            zr1  = fZ;
04684                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
04685                            else                              Transform(sr6,tr6,0);
04686                            dxr2 = fDxspline;
04687                            dyr2 = fDyspline;
04688                            zr2  = fZ;
04689                            v    = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
04690                            v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
04691                            v    = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
04692                            v    = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
04693                            v4   = v/4;
04694                         } else {
04695                            spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
04696                            v     = v+spriz;
04697                            v     = v/2;
04698                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
04699                            else                              Transform(sr1,tr1,0);
04700                            dxr1 = fDxspline;
04701                            dyr1 = fDyspline;
04702                            zr1  = fZ;
04703                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
04704                            else                              Transform(sr8,tr8,0);
04705                            dxr2  = fDxspline;
04706                            dyr2  = fDyspline;
04707                            zr2   = fZ;
04708                            da    = (dxr1+dx2+dx1)/3;
04709                            db    = (dyr1+dy2+dy1)/3;
04710                            dc    = (zr1+z2+z1)/3;
04711                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04712                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
04713                            da    = (dxr1+dxr2+dx1)/3;
04714                            db    = (dyr1+dyr2+dy1)/3;
04715                            dc    = (zr1+zr2+z1)/3;
04716                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04717                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
04718                            da    = (dxr2+dx1+dx4)/3;
04719                            db    = (dyr2+dy1+dy4)/3;
04720                            dc    = (zr2+z1+z4)/3;
04721                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04722                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
04723                            v1    = v/4;
04724                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
04725                            else                              Transform(sr3,tr3,0);
04726                            dxr1  = fDxspline;
04727                            dyr1  = fDyspline;
04728                            zr1   = fZ;
04729                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
04730                            else                              Transform(sr2,tr2,0);
04731                            dxr2  = fDxspline;
04732                            dyr2  = fDyspline;
04733                            zr2   = fZ;
04734                            da    = (dx1+dx2+dx3)/3;
04735                            db    = (dy1+dy2+dy3)/3;
04736                            dc    = (z1+z2+z3)/3;
04737                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04738                            v     = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
04739                            da    = (dx2+dxr1+dx3)/3;
04740                            db    = (dy2+dyr1+dy3)/3;
04741                            dc    = (z2+zr1+z3)/3;
04742                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04743                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
04744                            da    = (dx2+dxr2+dxr1)/3;
04745                            db    = (dy2+dyr2+dyr1)/3;
04746                            dc    = (z2+zr2+zr1)/3;
04747                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04748                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
04749                            da    = (dxr2+dx2+dx1)/3;
04750                            db    = (dyr2+dy2+dy1)/3;
04751                            dc    = (zr2+z2+z1)/3;
04752                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04753                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
04754                            v2    = v/4;
04755                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
04756                            else                              Transform(sr5,tr5,0);
04757                            dxr1  = fDxspline;
04758                            dyr1  = fDyspline;
04759                            zr1   = fZ;
04760                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
04761                            else                              Transform(sr4,tr4,0);
04762                            dxr2  = fDxspline;
04763                            dyr2  = fDyspline;
04764                            zr2   = fZ;
04765                            da    = (dx2+dx3+dx4)/3;
04766                            db    = (dy2+dy3+dy4)/3;
04767                            dc    = (z2+z3+z4)/3;
04768                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04769                            v     = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
04770                            da    = (dx4+dx3+dxr1)/3;
04771                            db    = (dy4+dy3+dyr1)/3;
04772                            dc    = (z4+z3+zr1)/3;
04773                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04774                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
04775                            da    = (dx3+dxr2+dxr1)/3;
04776                            db    = (dy3+dyr2+dyr1)/3;
04777                            dc    = (z3+zr2+zr1)/3;
04778                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04779                            v     = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
04780                            da    = (dx2+dxr2+dx3)/3;
04781                            db    = (dy2+dyr2+dy3)/3;
04782                            dc    = (z2+zr2+z3)/3;
04783                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04784                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
04785                            v3    = v/4;
04786                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
04787                            else                              Transform(sr7,tr7,0);
04788                            dxr1  = fDxspline;
04789                            dyr1  = fDyspline;
04790                            zr1   = fZ;
04791                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
04792                            else                              Transform(sr6,tr6,0);
04793                            dxr2  = fDxspline;
04794                            dyr2  = fDyspline;
04795                            zr2   = fZ;
04796                            da    = (dx1+dx3+dx4)/3;
04797                            db    = (dy1+dy3+dy4)/3;
04798                            dc    = (z1+z3+z4)/3;
04799                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04800                            v     = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
04801                            da    = (dx4+dx3+dxr2)/3;
04802                            db    = (dy4+dy3+dyr2)/3;
04803                            dc    = (z4+z3+zr2)/3;
04804                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04805                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
04806                            da    = (dx4+dxr2+dxr1)/3;
04807                            db    = (dy4+dyr2+dyr1)/3;
04808                            dc    = (z4+zr2+zr1)/3;
04809                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04810                            v     = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
04811                            da    = (dx1+dx4+dxr1)/3;
04812                            db    = (dy1+dy4+dyr1)/3;
04813                            dc    = (z1+z4+zr1)/3;
04814                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
04815                            v     = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
04816                            v4    = v/4;
04817                         }
04818                      }
04819                      spriz = 0;
04820                      if (fShadow==kShadowsNotPainted) {
04821                         if (fShading==kNotShaded) {
04822                            v  = v*fLevels+0.5;
04823                            iv = fLevels-(Int_t)v;
04824                         } else {
04825                            v1  = v1*fLevels;
04826                            iv1 = fLevels-(Int_t)v1;
04827                            v2  = v2*fLevels;
04828                            iv2 = fLevels-(Int_t)v2;
04829                            v4  = v4*fLevels;
04830                            iv4 = fLevels-(Int_t)v4;
04831                         }
04832                      } else {
04833                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
04834                         if (fShading==kNotShaded) {
04835                            v  = v*fLevels/2.0;
04836                            iv = fLevels-(Int_t)(v+0.5);
04837                         } else {
04838                            v1  = v1*fLevels;
04839                            iv1 = fLevels-(Int_t)v1;
04840                            v2  = v2*fLevels;
04841                            iv2 = fLevels-(Int_t)v2;
04842                            v4  = v4*fLevels;
04843                            iv4 = fLevels-(Int_t)v4;
04844                         }
04845                      }
04846                      if (fShading==kNotShaded) {
04847                         ColorModel(iv,ui1,ui2,ui3);
04848                         line->SetLineColor(fNewColorIndex);
04849                      } else {
04850                         dx1 = x1;
04851                         dy1 = y1;
04852                         dx2 = x2;
04853                         dy2 = y2;
04854                         dx3 = x4;
04855                         dy3 = y4;
04856                         z1  = iv1;
04857                         z2  = iv2;
04858                         z3  = iv4;
04859                         da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
04860                         db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
04861                         dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
04862                         dd  = -da*dx1-db*dy1-dc*z1;
04863                      }
04864                      sx1 = x1;
04865                      sy1 = y1;
04866                      sx2 = x2;
04867                      sy2 = y2;
04868                      if (sx2<sx1) {
04869                         sx4 = sx1;
04870                         sy4 = sy1;
04871                         sx1 = sx2;
04872                         sy1 = sy2;
04873                         sx2 = sx4;
04874                         sy2 = sy4;
04875                      }
04876                      sdx1 = 0;
04877                      pom1 = sy2-sy1;
04878                      pom2 = sx2-sx1;
04879                      if (pom2!=0) sdx1 = pom1/pom2;
04880                      pom1 = sy1;
04881                      pom2 = sx1;
04882                      sdy1 = pom1-sdx1*pom2;
04883                      for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
04884                         pom1 = sx4;
04885                         sdy4 = sdx1*pom1+sdy1;
04886                         sy4  = (Int_t)sdy4;
04887                         if (sy4<=fEnvelope[sx4]) {
04888                            fEnvelope[sx4] = sy4;
04889                            if (fShading==kNotShaded) {
04890                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04891                            } else {
04892                               dx1 = sx4;
04893                               dy1 = sy4;
04894                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
04895                               else       v =(iv1+iv2+iv4)/3;
04896                               iv = (Int_t)v;
04897                               ColorModel(iv,ui1,ui2,ui3);
04898                               line->SetLineColor(fNewColorIndex);
04899                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04900                            }
04901                            sy5 = sy4;
04902                         } else {
04903                            sy4 = fEnvelope[sx4];
04904                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
04905                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04906                            } else if (sy5<=fEnvelope[sx5]) {
04907                               dx1 = sx4;
04908                               dy1 = sy4;
04909                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
04910                               else       v =(iv1+iv2+iv4)/3;
04911                               iv = (Int_t)v;
04912                               ColorModel(iv,ui1,ui2,ui3);
04913                               line->SetLineColor(fNewColorIndex);
04914                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04915                            }
04916                            sy5 = fEnvelope[sx4];
04917                         }
04918                         sx5 = sx4;
04919                      }
04920                      xtaz = (dx3+dx2+dx4)/3;
04921                      ytaz = (dy3+dy2+dy4)/3;
04922                      ztaz = (z3+z2+z4)/3;
04923                      if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
04924                      spriz = 0;
04925                      if (fShadow==kShadowsNotPainted) {
04926                         if (fShading==kNotShaded) {
04927                            v  = v*fLevels;
04928                            iv = fLevels-(Int_t)v;
04929                         } else {
04930                            v3  = v3*fLevels;
04931                            iv3 = fLevels-(Int_t)v3;
04932                         }
04933                      } else {
04934                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
04935                         if (fShading==kNotShaded) {
04936                            v  = v*fLevels/2;
04937                            iv = fLevels-(Int_t)v;
04938                            iv = (Int_t)(iv-fLevels*spriz/2);
04939                         } else {
04940                            v3  = v3*fLevels;
04941                            iv3 = fLevels-(Int_t)v3;
04942                         }
04943                      }
04944                      if (fShading==kNotShaded) {
04945                         ColorModel(iv,ui1,ui2,ui3);
04946                         line->SetLineColor(fNewColorIndex);
04947                      } else {
04948                         dx1 = x2;
04949                         dy1 = y2;
04950                         dx2 = x3;
04951                         dy2 = y3;
04952                         dx3 = x4;
04953                         dy3 = y4;
04954                         z1  = iv2;
04955                         z2  = iv3;
04956                         z3  = iv4;
04957                         da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
04958                         db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
04959                         dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
04960                         dd  = -da*dx1-db*dy1-dc*z1;
04961                      }
04962                      sx2 = x3;
04963                      sy2 = y3;
04964                      sx3 = x4;
04965                      sy3 = y4;
04966                      if (sx3<sx2) {
04967                         sx4 = sx2;
04968                         sy4 = sy2;
04969                         sx2 = sx3;
04970                         sy2 = sy3;
04971                         sx3 = sx4;
04972                         sy3 = sy4;
04973                      }
04974                      sdx2 = 0;
04975                      pom1 = sy3-sy2;
04976                      pom2 = sx3-sx2;
04977                      if (pom2!=0) sdx2 = pom1/pom2;
04978                      pom1 = sy2;
04979                      pom2 = sx2;
04980                      sdy2 = pom1-sdx2*pom2;
04981                      for (sx4=sx2,sx5=sx2,sy5=sy2;sx4<=sx3;sx4++) {
04982                         pom1 = sx4;
04983                         sdy4 = sdx2*pom1+sdy2;
04984                         sy4  = (Int_t)sdy4;
04985                         if (sy4<=fEnvelope[sx4]) {
04986                            fEnvelope[sx4] = sy4;
04987                            if (fShading==kNotShaded) {
04988                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04989                            } else {
04990                               dx1 = sx4;
04991                               dy1 = sy4;
04992                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
04993                               else       v =(iv1+iv2+iv4)/3;
04994                               iv = (Int_t)v;
04995                               ColorModel(iv,ui1,ui2,ui3);
04996                               line->SetLineColor(fNewColorIndex);
04997                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
04998                            }
04999                            sy5 = sy4;
05000                         } else {
05001                            sy4 = fEnvelope[sx4];
05002                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
05003                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
05004                            } else if (sy5<=fEnvelope[sx5]) {
05005                               dx1 = sx4;
05006                               dy1 = sy4;
05007                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05008                               else       v =(iv1+iv2+iv4)/3;
05009                               iv = (Int_t)v;
05010                               ColorModel(iv,ui1,ui2,ui3);
05011                               line->SetLineColor(fNewColorIndex);
05012                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
05013                            }
05014                            sy5 = fEnvelope[sx4];
05015                         }
05016                         sx5 = sx4;
05017                      }
05018                   }
05019                }
05020                break;
05021             case kDisplayModeNeedles:
05022                Transform(i,j,-1);
05023                x2d = fXt;
05024                y2d = fYt;
05025                if (flag==1) {
05026                   x   = x1d;
05027                   y   = y1d;
05028                   x1d = x2d;
05029                   y1d = y2d;
05030                   x2d = x;
05031                   y2d = y;
05032                }
05033                line->PaintLine(gPad->PixeltoX(x1),gPad->PixeltoY(y1)+1,gPad->PixeltoX(x1d),gPad->PixeltoY(y1d)+1);
05034                line->PaintLine(gPad->PixeltoX(x2),gPad->PixeltoY(y2)+1,gPad->PixeltoX(x2d),gPad->PixeltoY(y2d)+1);
05035                break;
05036             case kDisplayModeSurface:
05037                box->SetFillStyle(1001);
05038                if ((q1!=q2||smer!=0)&&flag==1) {
05039                   s1 = q1+1;
05040                   t1 = q2;
05041                   s2 = q1;
05042                   t2 = q2;
05043                   s3 = q1;
05044                   t3 = q2+1;
05045                   s4 = q1+1;
05046                   t4 = q2+1;
05047                   if (fShading==kShaded) {
05048                      sr1 = s1;
05049                      tr1 = (Int_t)TMath::Max(t1-1,0);
05050                      sr2 = s2;
05051                      tr2 = (Int_t)TMath::Max(t2-1,0);
05052                      sr3 = (Int_t)TMath::Max(s2-1,0);
05053                      tr3 = t2;
05054                      sr4 = (Int_t)TMath::Max(s3-1,0);
05055                      tr4 = t3;
05056                      sr5 = s3;
05057                      tr5 = t3+1;
05058                      sr6 = s4;
05059                      tr6 = t4+1;
05060                      sr7 = s4+1;
05061                      tr7 = t4;
05062                      sr8 = s1+1;
05063                      tr8 = t1;
05064                   }
05065                   if (turni==1) {
05066                      i1 = s1;
05067                      i2 = s2;
05068                      i3 = s3;
05069                      i4 = s4;
05070                   } else {
05071                      i1 = (Int_t)TMath::Max(w1-s1,0);
05072                      i2 = (Int_t)TMath::Max(w1-s2,0);
05073                      i3 = (Int_t)TMath::Max(w1-s3,0);
05074                      i4 = (Int_t)TMath::Max(w1-s4,0);
05075                      if (fShading==kShaded) {
05076                      sr1 = (Int_t)TMath::Max(w1-sr1,0);
05077                      sr2 = (Int_t)TMath::Max(w1-sr2,0);
05078                      sr3 = (Int_t)TMath::Max(w1-sr3,0);
05079                      sr4 = (Int_t)TMath::Max(w1-sr4,0);
05080                      sr5 = (Int_t)TMath::Max(w1-sr5,0);
05081                      sr6 = (Int_t)TMath::Max(w1-sr6,0);
05082                      sr7 = (Int_t)TMath::Max(w1-sr7,0);
05083                      sr8 = (Int_t)TMath::Max(w1-sr8,0);
05084                      }
05085                   }
05086                   if (turnj==1) {
05087                      j1 = t1;
05088                      j2 = t2;
05089                      j3 = t3;
05090                      j4 = t4;
05091                   } else {
05092                      j1 = (Int_t)TMath::Max(w2-t1,0);
05093                      j2 = (Int_t)TMath::Max(w2-t2,0);
05094                      j3 = (Int_t)TMath::Max(w2-t3,0);
05095                      j4 = (Int_t)TMath::Max(w2-t4,0);
05096                      if (fShading==kShaded) {
05097                         tr1 = (Int_t)TMath::Max(w2-tr1,0);
05098                         tr2 = (Int_t)TMath::Max(w2-tr2,0);
05099                         tr3 = (Int_t)TMath::Max(w2-tr3,0);
05100                         tr4 = (Int_t)TMath::Max(w2-tr4,0);
05101                         tr5 = (Int_t)TMath::Max(w2-tr5,0);
05102                         tr6 = (Int_t)TMath::Max(w2-tr6,0);
05103                         tr7 = (Int_t)TMath::Max(w2-tr7,0);
05104                         tr8 = (Int_t)TMath::Max(w2-tr8,0);
05105                      }
05106                   }
05107                   Transform(i1,j1,0);
05108                   x1  = fXt;
05109                   y1  = fYt;
05110                   dx1 = fDxspline;
05111                   dy1 = fDyspline;
05112                   z1  = fZ;
05113                   Transform(i2,j2,0);
05114                   x2  = fXt;
05115                   y2  = fYt;
05116                   dx2 = fDxspline;
05117                   dy2 = fDyspline;
05118                   z2  = fZ;
05119                   Transform(i3,j3,0);
05120                   x3  = fXt;
05121                   y3  = fYt;
05122                   dx3 = fDxspline;
05123                   dy3 = fDyspline;
05124                   z3  = fZ;
05125                   Transform(i4,j4,0);
05126                   x4  = fXt;
05127                   y4  = fYt;
05128                   dx4 = fDxspline;
05129                   dy4 = fDyspline;
05130                   z4  = fZ;
05131                   Envelope(x1,y1,x2,y2);
05132                   Envelope(x2,y2,x3,y3);
05133                   xtaz = (dx1+dx2+dx4)/3;
05134                   ytaz = (dy1+dy2+dy4)/3;
05135                   ztaz = (z1+z2+z4)/3;
05136                   v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
05137                   if (fShading==kShaded) {
05138                      if (fShadow==kShadowsNotPainted) {
05139                         if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
05140                         else                              Transform(sr1,tr1,0);
05141                         dxr1 = fDxspline;
05142                         dyr1 = fDyspline;
05143                         zr1  = fZ;
05144                         if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
05145                         else                              Transform(sr8,tr8,0);
05146                         dxr2 = fDxspline;
05147                         dyr2 = fDyspline;
05148                         zr2  = fZ;
05149                         v    = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
05150                         v    = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
05151                         v    = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
05152                         v1   = v/4;
05153                         if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
05154                         else                              Transform(sr3,tr3,0);
05155                         dxr1 = fDxspline;
05156                         dyr1 = fDyspline;
05157                         zr1  = fZ;
05158                         if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
05159                         else                              Transform(sr2,tr2,0);
05160                         dxr2 = fDxspline;
05161                         dyr2 = fDyspline;
05162                         zr2  = fZ;
05163                         v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
05164                         v    = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
05165                         v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
05166                         v    = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
05167                         v2   = v/4;
05168                         if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
05169                         else                              Transform(sr5,tr5,0);
05170                         dxr1 = fDxspline;
05171                         dyr1 = fDyspline;
05172                         zr1  = fZ;
05173                         if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
05174                         else                              Transform(sr4,tr4,0);
05175                         dxr2 = fDxspline;
05176                         dyr2 = fDyspline;
05177                         zr2  = fZ;
05178                         v    = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
05179                         v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
05180                         v    = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
05181                         v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
05182                         v3   = v/4;
05183                         if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
05184                         else                              Transform(sr7,tr7,0);
05185                         dxr1 = fDxspline;
05186                         dyr1 = fDyspline;
05187                         zr1  = fZ;
05188                         if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
05189                         else                              Transform(sr6,tr6,0);
05190                         dxr2 = fDxspline;
05191                         dyr2 = fDyspline;
05192                         zr2  = fZ;
05193                         v    = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
05194                         v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
05195                         v    = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
05196                         v    = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
05197                         v4   = v/4;
05198                      } else {
05199                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
05200                         v     = v+spriz;
05201                         v     = v/2;
05202                         if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
05203                         else                              Transform(sr1,tr1,0);
05204                         dxr1 = fDxspline;
05205                         dyr1 = fDyspline;
05206                         zr1  = fZ;
05207                         if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
05208                         else                              Transform(sr8,tr8,0);
05209                         dxr2  = fDxspline;
05210                         dyr2  = fDyspline;
05211                         zr2   = fZ;
05212                         da    = (dxr1+dx2+dx1)/3;
05213                         db    = (dyr1+dy2+dy1)/3;
05214                         dc    = (zr1+z2+z1)/3;
05215                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05216                         v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
05217                         da    = (dxr1+dxr2+dx1)/3;
05218                         db    = (dyr1+dyr2+dy1)/3;
05219                         dc    = (zr1+zr2+z1)/3;
05220                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05221                         v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
05222                         da    = (dxr2+dx1+dx4)/3;
05223                         db    = (dyr2+dy1+dy4)/3;
05224                         dc    = (zr2+z1+z4)/3;
05225                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05226                         v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
05227                         v1    = v/4;
05228                         if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
05229                         else                              Transform(sr3,tr3,0);
05230                         dxr1  = fDxspline;
05231                         dyr1  = fDyspline;
05232                         zr1   = fZ;
05233                         if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
05234                         else                              Transform(sr2,tr2,0);
05235                         dxr2  = fDxspline;
05236                         dyr2  = fDyspline;
05237                         zr2   = fZ;
05238                         da    = (dx1+dx2+dx3)/3;
05239                         db    = (dy1+dy2+dy3)/3;
05240                         dc    = (z1+z2+z3)/3;
05241                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05242                         v     = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
05243                         da    = (dx2+dxr1+dx3)/3;
05244                         db    = (dy2+dyr1+dy3)/3;
05245                         dc    = (z2+zr1+z3)/3;
05246                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05247                         v     = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
05248                         da    = (dx2+dxr2+dxr1)/3;
05249                         db    = (dy2+dyr2+dyr1)/3;
05250                         dc    = (z2+zr2+zr1)/3;
05251                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05252                         v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
05253                         da    = (dxr2+dx2+dx1)/3;
05254                         db    = (dyr2+dy2+dy1)/3;
05255                         dc    = (zr2+z2+z1)/3;
05256                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05257                         v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
05258                         v2    = v/4;
05259                         if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
05260                         else                              Transform(sr5,tr5,0);
05261                         dxr1  = fDxspline;
05262                         dyr1  = fDyspline;
05263                         zr1   = fZ;
05264                         if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
05265                         else                              Transform(sr4,tr4,0);
05266                         dxr2  = fDxspline;
05267                         dyr2  = fDyspline;
05268                         zr2   = fZ;
05269                         da    = (dx2+dx3+dx4)/3;
05270                         db    = (dy2+dy3+dy4)/3;
05271                         dc    = (z2+z3+z4)/3;
05272                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05273                         v     = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
05274                         da    = (dx4+dx3+dxr1)/3;
05275                         db    = (dy4+dy3+dyr1)/3;
05276                         dc    = (z4+z3+zr1)/3;
05277                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05278                         v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
05279                         da    = (dx3+dxr2+dxr1)/3;
05280                         db    = (dy3+dyr2+dyr1)/3;
05281                         dc    = (z3+zr2+zr1)/3;
05282                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05283                         v     = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
05284                         da    = (dx2+dxr2+dx3)/3;
05285                         db    = (dy2+dyr2+dy3)/3;
05286                         dc    = (z2+zr2+z3)/3;
05287                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05288                         v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
05289                         v3    = v/4;
05290                         if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
05291                         else                              Transform(sr7,tr7,0);
05292                         dxr1  = fDxspline;
05293                         dyr1  = fDyspline;
05294                         zr1   = fZ;
05295                         if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
05296                         else                              Transform(sr6,tr6,0);
05297                         dxr2  = fDxspline;
05298                         dyr2  = fDyspline;
05299                         zr2   = fZ;
05300                         da    = (dx1+dx3+dx4)/3;
05301                         db    = (dy1+dy3+dy4)/3;
05302                         dc    = (z1+z3+z4)/3;
05303                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05304                         v     = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
05305                         da    = (dx4+dx3+dxr2)/3;
05306                         db    = (dy4+dy3+dyr2)/3;
05307                         dc    = (z4+z3+zr2)/3;
05308                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05309                         v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
05310                         da    = (dx4+dxr2+dxr1)/3;
05311                         db    = (dy4+dyr2+dyr1)/3;
05312                         dc    = (z4+zr2+zr1)/3;
05313                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05314                         v     = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
05315                         da    = (dx1+dx4+dxr1)/3;
05316                         db    = (dy1+dy4+dyr1)/3;
05317                         dc    = (z1+z4+zr1)/3;
05318                         spriz = ShadowColorCalculation(da,db,dc,shad_noise);
05319                         v     = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
05320                         v4    = v/4;
05321                      }
05322                   }
05323                   spriz = 0;
05324                   if (fShadow==kShadowsNotPainted) {
05325                      if (fShading==kNotShaded) {
05326                         v  = v*fLevels+0.5;
05327                         iv = fLevels-(Int_t)v;
05328                      } else {
05329                         v1  = v1*fLevels+0.5;
05330                         iv1 = fLevels-(Int_t)v1;
05331                         v2  = v2*fLevels+0.5;
05332                         iv2 = fLevels-(Int_t)v2;
05333                         v4  = v4*fLevels+0.5;
05334                         iv4 = fLevels-(Int_t)v4;
05335                      }
05336                   } else {
05337                      spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
05338                      if (fShading==kNotShaded) {
05339                         v  = v*fLevels/2.0;
05340                         iv = fLevels-(Int_t)(v+0.5);
05341                      } else {
05342                         v1  = v1*fLevels;
05343                         iv1 = fLevels-(Int_t)v1;
05344                         v2  = v2*fLevels;
05345                         iv2 = fLevels-(Int_t)v2;
05346                         v4  = v4*fLevels;
05347                         iv4 = fLevels-(Int_t)v4;
05348                      }
05349                   }
05350                   if (fShading==kNotShaded) {
05351                      ColorModel(iv,ui1,ui2,ui3);
05352                      box->SetFillColor(fNewColorIndex);
05353                   } else {
05354                      dx1 = x1;
05355                      dy1 = y1;
05356                      dx2 = x2;
05357                      dy2 = y2;
05358                      dx3 = x4;
05359                      dy3 = y4;
05360                      z1  = iv1;
05361                      z2  = iv2;
05362                      z3  = iv4;
05363                      da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
05364                      db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
05365                      dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
05366                      dd  = -da*dx1-db*dy1-dc*z1;
05367                   }
05368                   sx1 = x1;
05369                   sy1 = y1;
05370                   sx2 = x2;
05371                   sy2 = y2;
05372                   sx3 = x4;
05373                   sy3 = y4;
05374                   if (sx2<sx1) {
05375                      sx4 = sx1;
05376                      sy4 = sy1;
05377                      sx1 = sx2;
05378                      sy1 = sy2;
05379                      sx2 = sx4;
05380                      sy2 = sy4;
05381                   }
05382                   if (sx3<sx1) {
05383                      sx4 = sx1;
05384                      sy4 = sy1;
05385                      sx1 = sx3;
05386                      sy1 = sy3;
05387                      sx3 = sx4;
05388                      sy3 = sy4;
05389                   }
05390                   if (sy2<sy3) {
05391                      sx4 = sx2;
05392                      sy4 = sy2;
05393                      sx2 = sx3;
05394                      sy2 = sy3;
05395                      sx3 = sx4;
05396                      sy3 = sy4;
05397                   }
05398                   sdx1 = 0;
05399                   sdx2 = 0;
05400                   sdx3 = 0;
05401                   pom1 = sy2-sy1;
05402                   pom2 = sx2-sx1;
05403                   if (pom2!=0) sdx1 = pom1/pom2;
05404                   pom1 = sy1;
05405                   pom2 = sx1;
05406                   sdy1 = pom1-sdx1*pom2;
05407                   pom1 = sy3-sy1;
05408                   pom2 = sx3-sx1;
05409                   if (pom2!=0) sdx2 = pom1/pom2;
05410                   pom1 = sy1;
05411                   pom2 = sx1;
05412                   sdy2 = pom1-sdx2*pom2;
05413                   pom1 = sy3-sy2;
05414                   pom2 = sx3-sx2;
05415                   if (pom2!=0) sdx3 = pom1/pom2;
05416                   pom1 = sy2;
05417                   pom2 = sx2;
05418                   sdy3 = pom1-sdx3*pom2;
05419                   if (sx2<sx3) {
05420                      if (sx1!=sx2) {
05421                         for (sx4=sx1;sx4<=sx2;sx4++) {
05422                            pom1 = sx4;
05423                            sdy4 = sdx1*pom1+sdy1;
05424                            sy4  = (Int_t)sdy4;
05425                            if (sx3!=sx1) {
05426                               sdy4 = sdx2*pom1+sdy2;
05427                               sy5  = (Int_t)sdy4;
05428                               y5 = fEnvelope[sx4];
05429                               if (sy4<sy5) {
05430                                  pom1 = sy4;
05431                                  sy4  = sy5;
05432                                  sy5  = (Int_t)pom1;
05433                               }
05434                               if ((sy4<=y5)||(sy5<y5)) {
05435                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05436                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05437                                  if (fShading==kNotShaded) {
05438                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05439                                  } else {
05440                                     for (il=sy5;il<=sy4+1;il++) {
05441                                        dx1 = sx4;
05442                                        if(il<=sy4) dy1 = il;
05443                                        else dy1 = sy4;
05444                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05445                                        else       v =(iv1+iv2+iv4)/3;
05446                                        iv = (Int_t)v;
05447                                        ColorModel(iv,ui1,ui2,ui3);
05448                                        box->SetFillColor(fNewColorIndex);
05449                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05450                                     }
05451                                  }
05452                               }
05453                            }
05454                         }
05455                      }
05456                      if (sx2!=sx3) {
05457                         for (sx4=sx2;sx4<=sx3;sx4++) {
05458                            pom1 = sx4;
05459                            sdy4 = sdx3*pom1+sdy3;
05460                            sy4  = (Int_t)sdy4;
05461                            if (sx3!=sx1) {
05462                               sdy4 = sdx2*pom1+sdy2;
05463                               sy5  = (Int_t)sdy4;
05464                               y5  = fEnvelope[sx4];
05465                               if (sy4<sy5) {
05466                                  pom1 = sy4;
05467                                  sy4  = sy5;
05468                                  sy5  = (Int_t)pom1;
05469                               }
05470                               if ((sy4<=y5)||(sy5<y5)) {
05471                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05472                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05473                                  if (fShading==kNotShaded) {
05474                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05475                                  } else {
05476                                     for (il=sy5;il<=sy4+1;il++) {
05477                                        dx1 = sx4;
05478                                        if(il<=sy4) dy1 = il;
05479                                        else dy1 = sy4;
05480                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05481                                        else       v =(iv1+iv2+iv4)/3;
05482                                        iv = (Int_t)v;
05483                                        ColorModel(iv,ui1,ui2,ui3);
05484                                        box->SetFillColor(fNewColorIndex);
05485                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05486                                     }
05487                                  }
05488                               }
05489                            }
05490                         }
05491                      }
05492                   } else {
05493                      if (sx3!=sx1) {
05494                         for (sx4=sx1;sx4<=sx3;sx4++) {
05495                            pom1 = sx4;
05496                            sdy4 = sdx2*pom1+sdy2;
05497                            sy4  = (Int_t)sdy4;
05498                            if (sx2!=sx1) {
05499                               sdy4 = sdx1*pom1+sdy1;
05500                               sy5  = (Int_t)sdy4;
05501                               y5   = fEnvelope[sx4];
05502                               if (sy4<sy5) {
05503                                  pom1 = sy4;
05504                                  sy4  = sy5;
05505                                  sy5  = (Int_t)pom1;
05506                               }
05507                               if ((sy4<=y5)||(sy5<y5)) {
05508                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05509                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05510                                  if (fShading==kNotShaded) {
05511                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05512                                  } else {
05513                                     for (il=sy5;il<=sy4+1;il++) {
05514                                        dx1 = sx4;
05515                                        if(il<=sy4) dy1 = il;
05516                                        else dy1 = sy4;
05517                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05518                                        else       v =(iv1+iv2+iv4)/3;
05519                                        iv = (Int_t)v;
05520                                        ColorModel(iv,ui1,ui2,ui3);
05521                                        box->SetFillColor(fNewColorIndex);
05522                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05523                                     }
05524                                  }
05525                               }
05526                            }
05527                         }
05528                      }
05529                      if (sx2!=sx3) {
05530                         for (sx4=sx3;sx4<=sx2;sx4++) {
05531                            pom1 = sx4;
05532                            sdy4 = sdx3*pom1+sdy3;
05533                            sy4  = (Int_t)sdy4;
05534                            if (sx2!=sx1) {
05535                               sdy4 = sdx1*pom1+sdy1;
05536                               sy5  = (Int_t)sdy4;
05537                               y5 = fEnvelope[sx4];
05538                               if (sy4<sy5) {
05539                                  pom1 = sy4;
05540                                  sy4  = sy5;
05541                                  sy5  = (Int_t)pom1;
05542                               }
05543                               if ((sy4<=y5)||(sy5<y5)) {
05544                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05545                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05546                                  if (fShading==kNotShaded) {
05547                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05548                                  } else {
05549                                     for (il=sy5;il<=sy4+1;il++) {
05550                                        dx1 = sx4;
05551                                        if(il<=sy4) dy1 = il;
05552                                        else dy1 = sy4;
05553                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05554                                        else       v =(iv1+iv2+iv4)/3;
05555                                        iv = (Int_t)v;
05556                                        ColorModel(iv,ui1,ui2,ui3);
05557                                        box->SetFillColor(fNewColorIndex);
05558                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05559                                     }
05560                                  }
05561                               }
05562                            }
05563                         }
05564                      }
05565                   }
05566                   xtaz = (dx3+dx2+dx4)/3;
05567                   ytaz = (dy3+dy2+dy4)/3;
05568                   ztaz = (z3+z2+z4)/3;
05569                   if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
05570                   spriz = 0;
05571                   if (fShadow==kShadowsNotPainted) {
05572                      if (fShading==kNotShaded) {
05573                         v  = v*fLevels;
05574                         iv = fLevels-(Int_t)v;
05575                      } else {
05576                         v3  = v3*fLevels;
05577                         iv3 = fLevels-(Int_t)v3;
05578                      }
05579                   } else {
05580                      spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
05581                      if (fShading==kNotShaded) {
05582                         v  = v*fLevels/2;
05583                         iv = fLevels-(Int_t)v;
05584                         iv = (Int_t)(iv-fLevels*spriz/2);
05585                      } else {
05586                         v3  = v3*fLevels;
05587                         iv3 = fLevels-(Int_t)v3;
05588                      }
05589                   }
05590                   if (fShading==kNotShaded) {
05591                      ColorModel(iv,ui1,ui2,ui3);
05592                      box->SetFillColor(fNewColorIndex);
05593                   } else {
05594                      dx1 = x2;
05595                      dy1 = y2;
05596                      dx2 = x3;
05597                      dy2 = y3;
05598                      dx3 = x4;
05599                      dy3 = y4;
05600                      z1  = iv2;
05601                      z2  = iv3;
05602                      z3  = iv4;
05603                      da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
05604                      db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
05605                      dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
05606                      dd  = -da*dx1-db*dy1-dc*z1;
05607                   }
05608                   sx1 = x2;
05609                   sy1 = y2;
05610                   sx2 = x3;
05611                   sy2 = y3;
05612                   sx3 = x4;
05613                   sy3 = y4;
05614                   if (sx2<sx1) {
05615                      sx4 = sx1;
05616                      sy4 = sy1;
05617                      sx1 = sx2;
05618                      sy1 = sy2;
05619                      sx2 = sx4;
05620                      sy2 = sy4;
05621                   }
05622                   if (sx3<sx1) {
05623                      sx4 = sx1;
05624                      sy4 = sy1;
05625                      sx1 = sx3;
05626                      sy1 = sy3;
05627                      sx3 = sx4;
05628                      sy3 = sy4;
05629                   }
05630                   if (sy2<sy3) {
05631                      sx4 = sx2;
05632                      sy4 = sy2;
05633                      sx2 = sx3;
05634                      sy2 = sy3;
05635                      sx3 = sx4;
05636                      sy3 = sy4;
05637                   }
05638                   pom1 = sy2-sy1;
05639                   pom2 = sx2-sx1;
05640                   sdx1 = 0;
05641                   sdx2 = 0;
05642                   sdx3 = 0;
05643                   if (pom2!=0) sdx1 = pom1/pom2;
05644                   pom1 = sy1;
05645                   pom2 = sx1;
05646                   sdy1 = pom1-sdx1*pom2;
05647                   pom1 = sy3-sy1;
05648                   pom2 = sx3-sx1;
05649                   if (pom2!=0) sdx2 = pom1/pom2;
05650                   pom1 = sy1;
05651                   pom2 = sx1;
05652                   sdy2 = pom1-sdx2*pom2;
05653                   pom1 = sy3-sy2;
05654                   pom2 = sx3-sx2;
05655                   if (pom2!=0) sdx3 = pom1/pom2;
05656                   pom1 = sy2;
05657                   pom2 = sx2;
05658                   sdy3 = pom1-sdx3*pom2;
05659                   if (sx2<sx3) {
05660                      if (sx1!=sx2) {
05661                         for (sx4=sx1;sx4<=sx2;sx4++) {
05662                            pom1 = sx4;
05663                            sdy4 = sdx1*pom1+sdy1;
05664                            sy4  = (Int_t)sdy4;
05665                            if (sx3!=sx1) {
05666                               sdy4 = sdx2*pom1+sdy2;
05667                               sy5  = (Int_t)sdy4;
05668                               y5 = fEnvelope[sx4];
05669                               if (sy4<sy5) {
05670                                  pom1 = sy4;
05671                                  sy4  = sy5;
05672                                  sy5  = (Int_t)pom1;
05673                               }
05674                               if ((sy4<=y5)||(sy5<y5)) {
05675                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05676                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05677                                  if (fShading==kNotShaded) {
05678                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05679                                  } else {
05680                                     for (il=sy5;il<=sy4+1;il++) {
05681                                        dx1 = sx4;
05682                                        if(il<=sy4) dy1 = il;
05683                                        else dy1 = sy4;
05684                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05685                                        else       v =(iv2+iv3+iv4)/3;
05686                                        iv = (Int_t)v;
05687                                        ColorModel(iv,ui1,ui2,ui3);
05688                                        box->SetFillColor(fNewColorIndex);
05689                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05690                                     }
05691                                  }
05692                               }
05693                            }
05694                         }
05695                      }
05696                      if (sx2!=sx3) {
05697                         for (sx4=sx2;sx4<=sx3;sx4++) {
05698                            pom1 = sx4;
05699                            sdy4 = sdx3*pom1+sdy3;
05700                            sy4  = (Int_t)sdy4;
05701                            if (sx3!=sx1) {
05702                               sdy4 = sdx2*pom1+sdy2;
05703                               sy5  = (Int_t)sdy4;
05704                               y5 = fEnvelope[sx4];
05705                               if (sy4<sy5) {
05706                                  pom1 = sy4;
05707                                  sy4  = sy5;
05708                                  sy5  = (Int_t)pom1;
05709                               }
05710                               if ((sy4<=y5)||(sy5<y5)) {
05711                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05712                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05713                                  if (fShading==kNotShaded) {
05714                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05715                                  } else {
05716                                     for (il=sy5;il<=sy4+1;il++) {
05717                                        dx1 = sx4;
05718                                        if(il<=sy4) dy1 = il;
05719                                        else dy1 = sy4;
05720                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05721                                        else       v =(iv2+iv3+iv4)/3;
05722                                        iv = (Int_t)v;
05723                                        ColorModel(iv,ui1,ui2,ui3);
05724                                        box->SetFillColor(fNewColorIndex);
05725                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05726                                     }
05727                                  }
05728                               }
05729                            }
05730                         }
05731                      }
05732                   } else {
05733                      if (sx3!=sx1) {
05734                         for (sx4=sx1;sx4<=sx3;sx4++) {
05735                            pom1 = sx4;
05736                            sdy4 = sdx2*pom1+sdy2;
05737                            sy4  = (Int_t)sdy4;
05738                            if (sx2!=sx1) {
05739                               sdy4 = sdx1*pom1+sdy1;
05740                               sy5  = (Int_t)sdy4;
05741                               y5   = fEnvelope[sx4];
05742                               if (sy4<sy5) {
05743                                  pom1 = sy4;
05744                                  sy4  = sy5;
05745                                  sy5  = (Int_t)pom1;
05746                               }
05747                               if ((sy4<=y5)||(sy5<y5)) {
05748                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05749                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05750                                  if (fShading==kNotShaded) {
05751                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05752                                  } else {
05753                                     for (il=sy5;il<=sy4+1;il++) {
05754                                        dx1 = sx4;
05755                                        if(il<=sy4) dy1 = il;
05756                                        else dy1 = sy4;
05757                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05758                                        else       v =(iv2+iv3+iv4)/3;
05759                                        iv = (Int_t)v;
05760                                        ColorModel(iv,ui1,ui2,ui3);
05761                                        box->SetFillColor(fNewColorIndex);
05762                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05763                                     }
05764                                  }
05765                               }
05766                            }
05767                         }
05768                      }
05769                      if (sx2!=sx3) {
05770                         for (sx4=sx3;sx4<=sx2;sx4++) {
05771                            pom1 = sx4;
05772                            sdy4 = sdx3*pom1+sdy3;
05773                            sy4  = (Int_t)sdy4;
05774                            if (sx2!=sx1) {
05775                               sdy4 = sdx1*pom1+sdy1;
05776                               sy5  = (Int_t)sdy4;
05777                               y5 = fEnvelope[sx4];
05778                               if (sy4<sy5) {
05779                                  pom1 = sy4;
05780                                  sy4  = sy5;
05781                                  sy5  = (Int_t)pom1;
05782                               }
05783                               if ((sy4<=y5)||(sy5<y5)) {
05784                                  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
05785                                  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
05786                                  if (fShading==kNotShaded) {
05787                                     box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
05788                                  } else {
05789                                     for (il=sy5;il<=sy4+1;il++) {
05790                                        dx1 = sx4;
05791                                        if(il<=sy4) dy1 = il;
05792                                        else dy1 = sy4;
05793                                        if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
05794                                        else       v =(iv2+iv3+iv4)/3;
05795                                        iv = (Int_t)v;
05796                                        ColorModel(iv,ui1,ui2,ui3);
05797                                        box->SetFillColor(fNewColorIndex);
05798                                        box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
05799                                     }
05800                                  }
05801                               }
05802                            }
05803                         }
05804                      }
05805                   }
05806                }
05807                break;
05808             case kDisplayModeTriangles:
05809                if (fModeGroup==kModeGroupSimple) {
05810                   if ((q1!=q2||smer!=0)&&flag==1) {
05811                      s1 = q1+1;
05812                      t1 = q2;
05813                      s2 = q1;
05814                      t2 = q2;
05815                      s3 = q1;
05816                      t3 = q2+1;
05817                      s4 = q1+1;
05818                      t4 = q2+1;
05819                   }
05820                   if (turni==1) {
05821                      i1 = (Int_t)TMath::Min(w1,s1);
05822                      i2 = (Int_t)TMath::Min(w1,s2);
05823                      i3 = (Int_t)TMath::Min(w1,s3);
05824                      i4 = (Int_t)TMath::Min(w1,s4);
05825                   } else {
05826                      i1 = (Int_t)TMath::Max(w1-s1,0);
05827                      i2 = (Int_t)TMath::Max(w1-s2,0);
05828                      i3 = (Int_t)TMath::Max(w1-s3,0);
05829                      i4 = (Int_t)TMath::Max(w1-s4,0);
05830                   }
05831                   if (turnj==1) {
05832                      j1 = (Int_t)TMath::Min(w2,t1);
05833                      j2 = (Int_t)TMath::Min(w2,t2);
05834                      j3 = (Int_t)TMath::Min(w2,t3);
05835                      j4 = (Int_t)TMath::Min(w2,t4);
05836                   } else {
05837                      j1 = (Int_t)TMath::Max(w2-t1,0);
05838                      j2 = (Int_t)TMath::Max(w2-t2,0);
05839                      j3 = (Int_t)TMath::Max(w2-t3,0);
05840                      j4 = (Int_t)TMath::Max(w2-t4,0);
05841                   }
05842                   Transform(i1,j1,0);
05843                   x1 = fXt;
05844                   y1 = fYt;
05845                   Transform(i2,j2,0);
05846                   x2 = fXt;
05847                   y2 = fYt;
05848                   Transform(i3,j3,0);
05849                   x3 = fXt;
05850                   y3 = fYt;
05851                   Transform(i4,j4,0);
05852                   x4 = fXt;
05853                   y4 = fYt;
05854                   if ((q1!=q2||smer!=0)&&flag==1) {
05855                      Envelope(x1,y1,x2,y2);
05856                      if (fLine!=0) {
05857                         if (fLine==1) {
05858                            fXe = x2;
05859                            fYe = y2;
05860                         }
05861                         line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
05862                      }
05863                      Envelope(x2,y2,x3,y3);
05864                      if (fLine!=0) {
05865                         if (fLine==1) {
05866                            fXe = x3;
05867                            fYe = y3;
05868                         }
05869                         line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
05870                      }
05871                      Envelope(x2,y2,x4,y4);
05872                      if (fLine!=0) {
05873                         if (fLine==1) {
05874                            fXe = x4;
05875                            fYe = y4;
05876                         }
05877                         line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
05878                      }
05879                      Envelope(x1,y1,x4,y4);
05880                      if (fLine!=0) {
05881                         if (fLine==1) {
05882                            fXe = x4;
05883                            fYe = y4;
05884                         }
05885                         line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
05886                      }
05887                      Envelope(x3,y3,x4,y4);
05888                      if (fLine!=0) {
05889                         if (fLine==1) {
05890                            fXe = x4;
05891                            fYe = y4;
05892                         }
05893                         line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
05894                      }
05895                   }
05896                } else {
05897                   if ((q1!=q2||smer!=0)&&flag==1) {
05898                      s1 = q1+1;
05899                      t1 = q2;
05900                      s2 = q1;
05901                      t2 = q2;
05902                      s3 = q1;
05903                      t3 = q2+1;
05904                      s4 = q1+1;
05905                      t4 = q2+1;
05906                      if (fShading==kShaded) {
05907                         sr1 = s1;
05908                         tr1 = (Int_t)TMath::Max(t1-1,0);
05909                         sr2 = s2;
05910                         tr2 = (Int_t)TMath::Max(t2-1,0);
05911                         sr3 = (Int_t)TMath::Max(s2-1,0);
05912                         tr3 = t2;
05913                         sr4 = (Int_t)TMath::Max(s3-1,0);
05914                         tr4 = t3;
05915                         sr5 = s3;
05916                         tr5 = t3+1;
05917                         sr6 = s4;
05918                         tr6 = t4+1;
05919                         sr7 = s4+1;
05920                         tr7 = t4;
05921                         sr8 = s1+1;
05922                         tr8 = t1;
05923                      }
05924                      if (turni==1) {
05925                         i1 = s1;
05926                         i2 = s2;
05927                         i3 = s3;
05928                         i4 = s4;
05929                      } else {
05930                         i1 = (Int_t)TMath::Max(w1-s1,0);
05931                         i2 = (Int_t)TMath::Max(w1-s2,0);
05932                         i3 = (Int_t)TMath::Max(w1-s3,0);
05933                         i4 = (Int_t)TMath::Max(w1-s4,0);
05934                         if (fShading==kShaded) {
05935                            sr1 = (Int_t)TMath::Max(w1-sr1,0);
05936                            sr2 = (Int_t)TMath::Max(w1-sr2,0);
05937                            sr3 = (Int_t)TMath::Max(w1-sr3,0);
05938                            sr4 = (Int_t)TMath::Max(w1-sr4,0);
05939                            sr5 = (Int_t)TMath::Max(w1-sr5,0);
05940                            sr6 = (Int_t)TMath::Max(w1-sr6,0);
05941                            sr7 = (Int_t)TMath::Max(w1-sr7,0);
05942                            sr8 = (Int_t)TMath::Max(w1-sr8,0);
05943                         }
05944                      }
05945                      if (turnj==1) {
05946                         j1 = t1;
05947                         j2 = t2;
05948                         j3 = t3;
05949                         j4 = t4;
05950                      } else {
05951                         j1 = (Int_t)TMath::Max(w2-t1,0);
05952                         j2 = (Int_t)TMath::Max(w2-t2,0);
05953                         j3 = (Int_t)TMath::Max(w2-t3,0);
05954                         j4 = (Int_t)TMath::Max(w2-t4,0);
05955                         if (fShading==kShaded) {
05956                            tr1 = (Int_t)TMath::Max(w2-tr1,0);
05957                            tr2 = (Int_t)TMath::Max(w2-tr2,0);
05958                            tr3 = (Int_t)TMath::Max(w2-tr3,0);
05959                            tr4 = (Int_t)TMath::Max(w2-tr4,0);
05960                            tr5 = (Int_t)TMath::Max(w2-tr5,0);
05961                            tr6 = (Int_t)TMath::Max(w2-tr6,0);
05962                            tr7 = (Int_t)TMath::Max(w2-tr7,0);
05963                            tr8 = (Int_t)TMath::Max(w2-tr8,0);
05964                         }
05965                      }
05966                      Transform(i1,j1,0);
05967                      x1  = fXt;
05968                      y1  = fYt;
05969                      dx1 = fDxspline;
05970                      dy1 = fDyspline;
05971                      z1  = fZ;
05972                      Transform(i2,j2,0);
05973                      x2  = fXt;
05974                      y2  = fYt;
05975                      dx2 = fDxspline;
05976                      dy2 = fDyspline;
05977                      z2  = fZ;
05978                      Transform(i3,j3,0);
05979                      x3  = fXt;
05980                      y3  = fYt;
05981                      dx3 = fDxspline;
05982                      dy3 = fDyspline;
05983                      z3  = fZ;
05984                      Transform(i4,j4,0);
05985                      x4  = fXt;
05986                      y4  = fYt;
05987                      dx4 = fDxspline;
05988                      dy4 = fDyspline;
05989                      z4  = fZ;
05990                      Envelope(x1,y1,x2,y2);
05991                      Envelope(x2,y2,x3,y3);
05992                      xtaz = (dx1+dx2+dx4)/3;
05993                      ytaz = (dy1+dy2+dy4)/3;
05994                      ztaz = (z1+z2+z4)/3;
05995                      v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
05996                      if (fShading==kShaded) {
05997                         if (fShadow==kShadowsNotPainted) {
05998                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
05999                            else                              Transform(sr1,tr1,0);
06000                            dxr1 = fDxspline;
06001                            dyr1 = fDyspline;
06002                            zr1  = fZ;
06003                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
06004                            else                              Transform(sr8,tr8,0);
06005                            dxr2 = fDxspline;
06006                            dyr2 = fDyspline;
06007                            zr2  = fZ;
06008                            v    = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
06009                            v    = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
06010                            v    = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
06011                            v1   = v/4;
06012                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
06013                            else                              Transform(sr3,tr3,0);
06014                            dxr1 = fDxspline;
06015                            dyr1 = fDyspline;
06016                            zr1  = fZ;
06017                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
06018                            else                              Transform(sr2,tr2,0);
06019                            dxr2 = fDxspline;
06020                            dyr2 = fDyspline;
06021                            zr2  = fZ;
06022                            v    = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
06023                            v    = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
06024                            v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
06025                            v    = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
06026                            v2   = v/4;
06027                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
06028                            else                              Transform(sr5,tr5,0);
06029                            dxr1 = fDxspline;
06030                            dyr1 = fDyspline;
06031                            zr1  = fZ;
06032                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
06033                            else                              Transform(sr4,tr4,0);
06034                            dxr2 = fDxspline;
06035                            dyr2 = fDyspline;
06036                            zr2  = fZ;
06037                            v    = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
06038                            v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
06039                            v    = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
06040                            v    = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
06041                            v3   = v/4;
06042                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
06043                            else                              Transform(sr7,tr7,0);
06044                            dxr1 = fDxspline;
06045                            dyr1 = fDyspline;
06046                            zr1  = fZ;
06047                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
06048                            else                              Transform(sr6,tr6,0);
06049                            dxr2 = fDxspline;
06050                            dyr2 = fDyspline;
06051                            zr2  = fZ;
06052                            v    = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
06053                            v    = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
06054                            v    = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
06055                            v    = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
06056                            v4   = v/4;
06057                         } else {
06058                            spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
06059                            v     = v+spriz;
06060                            v     = v/2;
06061                            if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
06062                            else                              Transform(sr1,tr1,0);
06063                            dxr1  = fDxspline;
06064                            dyr1  = fDyspline;
06065                            zr1   = fZ;
06066                            if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
06067                            else                              Transform(sr8,tr8,0);
06068                            dxr2  = fDxspline;
06069                            dyr2  = fDyspline;
06070                            zr2   = fZ;
06071                            da    = (dxr1+dx2+dx1)/3;
06072                            db    = (dyr1+dy2+dy1)/3;
06073                            dc    = (zr1+z2+z1)/3;
06074                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06075                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
06076                            da    = (dxr1+dxr2+dx1)/3;
06077                            db    = (dyr1+dyr2+dy1)/3;
06078                            dc    = (zr1+zr2+z1)/3;
06079                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06080                            v     = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
06081                            da    = (dxr2+dx1+dx4)/3;
06082                            db    = (dyr2+dy1+dy4)/3;
06083                            dc    = (zr2+z1+z4)/3;
06084                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06085                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
06086                            v1    = v/4;
06087                            if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
06088                            else                              Transform(sr3,tr3,0);
06089                            dxr1  = fDxspline;
06090                            dyr1  = fDyspline;
06091                            zr1   = fZ;
06092                            if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
06093                            else                              Transform(sr2,tr2,0);
06094                            dxr2  = fDxspline;
06095                            dyr2  = fDyspline;
06096                            zr2   = fZ;
06097                            da    = (dx1+dx2+dx3)/3;
06098                            db    = (dy1+dy2+dy3)/3;
06099                            dc    = (z1+z2+z3)/3;
06100                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06101                            v     = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
06102                            da    = (dx2+dxr1+dx3)/3;
06103                            db    = (dy2+dyr1+dy3)/3;
06104                            dc    = (z2+zr1+z3)/3;
06105                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06106                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
06107                            da    = (dx2+dxr2+dxr1)/3;
06108                            db    = (dy2+dyr2+dyr1)/3;
06109                            dc    = (z2+zr2+zr1)/3;
06110                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06111                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
06112                            da    = (dxr2+dx2+dx1)/3;
06113                            db    = (dyr2+dy2+dy1)/3;
06114                            dc    = (zr2+z2+z1)/3;
06115                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06116                            v     = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
06117                            v2    = v/4;
06118                            if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
06119                            else                              Transform(sr5,tr5,0);
06120                            dxr1  = fDxspline;
06121                            dyr1  = fDyspline;
06122                            zr1   = fZ;
06123                            if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
06124                            else                              Transform(sr4,tr4,0);
06125                            dxr2  = fDxspline;
06126                            dyr2  = fDyspline;
06127                            zr2   = fZ;
06128                            da    = (dx2+dx3+dx4)/3;
06129                            db    = (dy2+dy3+dy4)/3;
06130                            dc    = (z2+z3+z4)/3;
06131                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06132                            v     = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
06133                            da    = (dx4+dx3+dxr1)/3;
06134                            db    = (dy4+dy3+dyr1)/3;
06135                            dc    = (z4+z3+zr1)/3;
06136                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06137                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
06138                            da    = (dx3+dxr2+dxr1)/3;
06139                            db    = (dy3+dyr2+dyr1)/3;
06140                            dc    = (z3+zr2+zr1)/3;
06141                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06142                            v     = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
06143                            da    = (dx2+dxr2+dx3)/3;
06144                            db    = (dy2+dyr2+dy3)/3;
06145                            dc    = (z2+zr2+z3)/3;
06146                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06147                            v     = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
06148                            v3    = v/4;
06149                            if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
06150                            else                              Transform(sr7,tr7,0);
06151                            dxr1  = fDxspline;
06152                            dyr1  = fDyspline;
06153                            zr1   = fZ;
06154                            if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
06155                            else                              Transform(sr6,tr6,0);
06156                            dxr2  = fDxspline;
06157                            dyr2  = fDyspline;
06158                            zr2   = fZ;
06159                            da    = (dx1+dx3+dx4)/3;
06160                            db    = (dy1+dy3+dy4)/3;
06161                            dc    = (z1+z3+z4)/3;
06162                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06163                            v     = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
06164                            da    = (dx4+dx3+dxr2)/3;
06165                            db    = (dy4+dy3+dyr2)/3;
06166                            dc    = (z4+z3+zr2)/3;
06167                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06168                            v     = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
06169                            da    = (dx4+dxr2+dxr1)/3;
06170                            db    = (dy4+dyr2+dyr1)/3;
06171                            dc    = (z4+zr2+zr1)/3;
06172                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06173                            v     = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
06174                            da    = (dx1+dx4+dxr1)/3;
06175                            db    = (dy1+dy4+dyr1)/3;
06176                            dc    = (z1+z4+zr1)/3;
06177                            spriz = ShadowColorCalculation(da,db,dc,shad_noise);
06178                            v     = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
06179                            v4    = v/4;
06180                         }
06181                      }
06182                      spriz = 0;
06183                      if (fShadow==kShadowsNotPainted) {
06184                         if (fShading==kNotShaded) {
06185                            v  = v*fLevels+0.5;
06186                            iv = fLevels-(Int_t)v;
06187                         } else {
06188                            v1  = v1*fLevels;
06189                            iv1 = fLevels-(Int_t)v1;
06190                            v2  = v2*fLevels;
06191                            iv2 = fLevels-(Int_t)v2;
06192                            v4  = v4*fLevels;
06193                            iv4 = fLevels-(Int_t)v4;
06194                         }
06195                      } else {
06196                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
06197                         if (fShading==kNotShaded) {
06198                            v  = v*fLevels/2.0;
06199                            iv = fLevels-(Int_t)(v+0.5);
06200                         } else {
06201                            v1  = v1*fLevels;
06202                            iv1 = fLevels-(Int_t)v1;
06203                            v2  = v2*fLevels;
06204                            iv2 = fLevels-(Int_t)v2;
06205                            v4  = v4*fLevels;
06206                            iv4 = fLevels-(Int_t)v4;
06207                         }
06208                      }
06209                      if (fShading==kNotShaded) {
06210                         ColorModel(iv,ui1,ui2,ui3);
06211                         line->SetLineColor(fNewColorIndex);
06212                      } else {
06213                         dx1 = x1;
06214                         dy1 = y1;
06215                         dx2 = x2;
06216                         dy2 = y2;
06217                         dx3 = x4;
06218                         dy3 = y4;
06219                         z1  = iv1;
06220                         z2  = iv2;
06221                         z3  = iv4;
06222                         da  = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
06223                         db  = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
06224                         dc  = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
06225                         dd  = -da*dx1-db*dy1-dc*z1;
06226                      }
06227                      sx1 = x1;
06228                      sy1 = y1;
06229                      sx2 = x2;
06230                      sy2 = y2;
06231                      if (sx2<sx1) {
06232                         sx4 = sx1;
06233                         sy4 = sy1;
06234                         sx1 = sx2;
06235                         sy1 = sy2;
06236                         sx2 = sx4;
06237                         sy2 = sy4;
06238                      }
06239                      sdx1 = 0;
06240                      pom1 = sy2-sy1;
06241                      pom2 = sx2-sx1;
06242                      if (pom2!=0) sdx1 = pom1/pom2;
06243                      pom1 = sy1;
06244                      pom2 = sx1;
06245                      sdy1 = pom1-sdx1*pom2;
06246                      for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
06247                         pom1 = sx4;
06248                         sdy4 = sdx1*pom1+sdy1;
06249                         sy4  = (Int_t)sdy4;
06250                         if (sy4<=fEnvelope[sx4]) {
06251                            fEnvelope[sx4] = sy4;
06252                            if (fShading==kNotShaded) {
06253                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06254                            } else {
06255                               dx1 = sx4;
06256                               dy1 = sy4;
06257                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06258                               else v = (iv1+iv2+iv4)/3;
06259                               iv = (Int_t)v;
06260                               ColorModel(iv,ui1,ui2,ui3);
06261                               line->SetLineColor(fNewColorIndex);
06262                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06263                            }
06264                            sy5 = sy4;
06265                         } else {
06266                         sy4 = fEnvelope[sx4];
06267                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
06268                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06269                            } else if (sy5<=fEnvelope[sx5]) {
06270                               dx1 = sx4;
06271                               dy1 = sy4;
06272                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06273                               else v = (iv1+iv2+iv4)/3;
06274                               iv = (Int_t)v;
06275                               ColorModel(iv,ui1,ui2,ui3);
06276                               line->SetLineColor(fNewColorIndex);
06277                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06278                            }
06279                            sy5 = fEnvelope[sx4];
06280                         }
06281                         sx5 = sx4;
06282                      }
06283                      sx1 = x1;
06284                      sy1 = y1;
06285                      sx3 = x4;
06286                      sy3 = y4;
06287                      if (sx3<sx1) {
06288                         sx4 = sx1;
06289                         sy4 = sy1;
06290                         sx1 = sx3;
06291                         sy1 = sy3;
06292                         sx3 = sx4;
06293                         sy3 = sy4;
06294                      }
06295                      pom1 = sy3-sy1;
06296                      pom2 = sx3-sx1;
06297                      if (pom2!=0) sdx2 = pom1/pom2;
06298                      pom1  = sy1;
06299                      pom2  = sx1;
06300                      sdy2  = pom1-sdx2*pom2;
06301                      sx1p  = sx1;
06302                      sy1p  = sy1;
06303                      sx3p  = sx3;
06304                      sdx2p = sdx2;
06305                      sdy2p = sdy2;
06306                      dap   = da;
06307                      dbp   = db;
06308                      dcp   = dc;
06309                      ddp   = dd;
06310                      uip   = fNewColorIndex;
06311                      xtaz  = (dx3+dx2+dx4)/3;
06312                      ytaz  = (dy3+dy2+dy4)/3;
06313                      ztaz  = (z3+z2+z4)/3;
06314                      if (fShading==kNotShaded) v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
06315                      spriz = 0;
06316                      if (fShadow==kShadowsNotPainted) {
06317                         if (fShading==kNotShaded) {
06318                            v  =  v*fLevels;
06319                            iv = fLevels-(Int_t)v;
06320                         } else {
06321                            v3 = v3*fLevels;
06322                            iv3 = fLevels-(Int_t)v3;
06323                         }
06324                      } else {
06325                         spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
06326                         if (fShading==kNotShaded) {
06327                            v  =  v*fLevels/2;
06328                            iv = fLevels-(Int_t)v;
06329                            iv = (Int_t)(iv-fLevels*spriz/2);
06330                         } else {
06331                            v3  = v3*fLevels;
06332                            iv3 = fLevels-(Int_t)v3;
06333                         }
06334                      }
06335                      if (fShading==kNotShaded) {
06336                         ColorModel(iv,ui1,ui2,ui3);
06337                         line->SetLineColor(fNewColorIndex);
06338                      } else {
06339                         dx1 = x2;
06340                         dy1 = y2;
06341                         dx2 = x3;
06342                         dy2 = y3;
06343                         dx3 = x4;
06344                         dy3 = y4;
06345                         z1 = iv2;
06346                         z2 = iv3;
06347                         z3 = iv4;
06348                         da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
06349                         db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
06350                         dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
06351                         dd = -da*dx1-db*dy1-dc*z1;
06352                      }
06353                      sx1 = x2;
06354                      sy1 = y2;
06355                      sx2 = x3;
06356                      sy2 = y3;
06357                      if (sx2<sx1) {
06358                         sx4 = sx1;
06359                         sy4 = sy1;
06360                         sx1 = sx2;
06361                         sy1 = sy2;
06362                         sx2 = sx4;
06363                         sy2 = sy4;
06364                      }
06365                      pom1 = sy2-sy1;
06366                      pom2 = sx2-sx1;
06367                      sdx1 = 0;
06368                      if (pom2!=0) sdx1 = pom1/pom2;
06369                      pom1 = sy1;
06370                      pom2 = sx1;
06371                      sdy1 = pom1-sdx1*pom2;
06372                      for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
06373                         pom1 = sx4;
06374                         sdy4 = sdx1*pom1+sdy1;
06375                         sy4  = (Int_t)sdy4;
06376                         if (sy4<=fEnvelope[sx4]) {
06377                            fEnvelope[sx4] = sy4;
06378                            if (fShading==kNotShaded) {
06379                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06380                            } else {
06381                               dx1 = sx4;
06382                               dy1 = sy4;
06383                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06384                               else v = (iv1+iv2+iv4)/3;
06385                               iv = (Int_t)v;
06386                               ColorModel(iv,ui1,ui2,ui3);
06387                               line->SetLineColor(fNewColorIndex);
06388                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06389                            }
06390                            sy5 = sy4;
06391                         } else {
06392                            sy4 = fEnvelope[sx4];
06393                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
06394                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06395                            } else if (sy5<=fEnvelope[sx5]) {
06396                               dx1 = sx4;
06397                               dy1 = sy4;
06398                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06399                               else v = (iv1+iv2+iv4)/3;
06400                               iv = (Int_t)v;
06401                               ColorModel(iv,ui1,ui2,ui3);
06402                               line->SetLineColor(fNewColorIndex);
06403                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06404                            }
06405                            sy5 = fEnvelope[sx4];
06406                         }
06407                         sx5 = sx4;
06408                      }
06409                      sx1 = x2;
06410                      sy1 = y2;
06411                      sx2 = x4;
06412                      sy2 = y4;
06413                      if (sx2<sx1) {
06414                         sx4 = sx1;
06415                         sy4 = sy1;
06416                         sx1 = sx2;
06417                         sy1 = sy2;
06418                         sx2 = sx4;
06419                         sy2 = sy4;
06420                      }
06421                      pom1 = sy2-sy1;
06422                      pom2 = sx2-sx1;
06423                      sdx1 = 0;
06424                      if (pom2!=0) sdx1 = pom1/pom2;
06425                      pom1 = sy1;
06426                      pom2 = sx1;
06427                      sdy1 = pom1-sdx1*pom2;
06428                      for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
06429                         pom1 = sx4;
06430                         sdy4 = sdx1*pom1+sdy1;
06431                         sy4  = (Int_t)sdy4;
06432                         if (sy4<=fEnvelope[sx4]) {
06433                            fEnvelope[sx4] = sy4;
06434                            if (fShading==kNotShaded) {
06435                            line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06436                         } else {
06437                            dx1 = sx4;
06438                            dy1 = sy4;
06439                            if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06440                            else v = (iv1+iv2+iv4)/3;
06441                            iv = (Int_t)v;
06442                            ColorModel(iv,ui1,ui2,ui3);
06443                            line->SetLineColor(fNewColorIndex);
06444                            line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06445                         }
06446                         sy5 = sy4;
06447                         } else {
06448                            sy4 = fEnvelope[sx4];
06449                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
06450                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06451                            } else if (sy5<=fEnvelope[sx5]) {
06452                               dx1 = sx4;
06453                               dy1 = sy4;
06454                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06455                               else v = (iv1+iv2+iv4)/3;
06456                               iv = (Int_t)v;
06457                               ColorModel(iv,ui1,ui2,ui3);
06458                               line->SetLineColor(fNewColorIndex);
06459                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06460                            }
06461                            sy5 = fEnvelope[sx4];
06462                         }
06463                         sx5 = sx4;
06464                      }
06465                      for (sx4=sx1p,sx5=sx1p,sy5=sy1p;sx4<=sx3p;sx4++) {
06466                         pom1 = sx4;
06467                         sdy4 = sdx2p*pom1+sdy2p;
06468                         sy4  = (Int_t)sdy4;
06469                         if (sy4<=fEnvelope[sx4]) {
06470                            fEnvelope[sx4] = sy4;
06471                            if (fShading==kNotShaded) {
06472                               line->SetLineColor(uip);
06473                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06474                            } else {
06475                               dx1 = sx4;
06476                               dy1 = sy4;
06477                               if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
06478                               else v = (iv1+iv2+iv4)/3;
06479                               iv = (Int_t)v;
06480                               ColorModel(iv,ui1,ui2,ui3);
06481                               line->SetLineColor(fNewColorIndex);
06482                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06483                            }
06484                            sy5 = sy4;
06485                         } else {
06486                            sy4 = fEnvelope[sx4];
06487                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
06488                               line->SetLineColor(uip);
06489                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06490                            } else if (sy5<=fEnvelope[sx5]) {
06491                               dx1 = sx4;
06492                               dy1 = sy4;
06493                               if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
06494                               else v = (iv1+iv2+iv4)/3;
06495                               iv = (Int_t)v;
06496                               ColorModel(iv,ui1,ui2,ui3);
06497                               line->SetLineColor(fNewColorIndex);
06498                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06499                            }
06500                            sy5 = fEnvelope[sx4];
06501                         }
06502                         sx5 = sx4;
06503                      }
06504                      sx2 = x3;
06505                      sy2 = y3;
06506                      sx3 = x4;
06507                      sy3 = y4;
06508                      if (sx3<sx2) {
06509                         sx4 = sx2;
06510                         sy4 = sy2;
06511                         sx2 = sx3;
06512                         sy2 = sy3;
06513                         sx3 = sx4;
06514                         sy3 = sy4;
06515                      }
06516                      sdx2 = 0;
06517                      pom1 = sy3-sy2;
06518                      pom2 = sx3-sx2;
06519                      if (pom2!=0) sdx2 = pom1/pom2;
06520                      pom1 = sy2;
06521                      pom2 = sx2;
06522                      sdy2 = pom1-sdx2*pom2;
06523                      for (sx4=sx2,sx5=sx2,sy5=sy2;sx4<=sx3;sx4++) {
06524                         pom1 = sx4;
06525                         sdy4 = sdx2*pom1+sdy2;
06526                         sy4  = (Int_t)sdy4;
06527                         if (sy4<=fEnvelope[sx4]) {
06528                            fEnvelope[sx4] = sy4;
06529                            if (fShading==kNotShaded) {
06530                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06531                            } else {
06532                               dx1 = sx4;
06533                               dy1 = sy4;
06534                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06535                               else v = (iv1+iv2+iv4)/3;
06536                               iv = (Int_t)v;
06537                               ColorModel(iv,ui1,ui2,ui3);
06538                               line->SetLineColor(fNewColorIndex);
06539                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06540                            }
06541                            sy5 = sy4;
06542                         } else {
06543                            sy4 = fEnvelope[sx4];
06544                            if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
06545                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06546                            } else if (sy5<=fEnvelope[sx5]) {
06547                               dx1 = sx4;
06548                               dy1 = sy4;
06549                               if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
06550                               else v = (iv1+iv2+iv4)/3;
06551                               iv = (Int_t)v;
06552                               ColorModel(iv,ui1,ui2,ui3);
06553                               line->SetLineColor(fNewColorIndex);
06554                               line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
06555                            }
06556                            sy5 = fEnvelope[sx4];
06557                         }
06558                         sx5 = sx4;
06559                      }
06560                   }
06561                }
06562                break;
06563          }
06564          if (flag==1) {
06565             x   = x1;
06566             y   = y1;
06567             x1  = x2;
06568             y1  = y2;
06569             x2  = x;
06570             y2  = y;
06571             x   = x1d;
06572             y   = y1d;
06573             x1d = x2d;
06574             y1d = y2d;
06575             x2d = x;
06576             y2d = y;
06577             if (smer==0) q1 += 1;
06578             else         q2 += 1;
06579          } else {
06580             x1  = x2;
06581             y1  = y2;
06582             x1d = x2d;
06583             y1d = y2d;
06584          }
06585       } while ((q1!=qv||(q2!=(qv-1) && q2!=w2)||smer!=0||flag!=1) &&
06586                ((q1!=(qv-1) && q1!=w1)||q2!=qv||smer!=1||flag!=1) &&
06587                 uhl!=1);
06588       if (qv<=w2&&qv<=w1) {
06589          if (uhl==0) {
06590             if (smer==0) {
06591                smer = 1;
06592                q1   = 0;
06593                flag = 0;
06594                q2   = qv;
06595                xp1  = x1;
06596                yp1  = y1;
06597                goto l2;
06598             } else {
06599                smer = 0;
06600                uhl  = 1;
06601                q1   = qv;
06602                q2   = qv-1;
06603                xp2  = x1;
06604                yp2  = y1;
06605                x1   = xp1;
06606                y1   = yp1;
06607                flag = 1;
06608                goto l2;
06609             }
06610          } else {
06611             if (smer==0) {
06612                smer = 1;
06613                x1   = xp2;
06614                y1   = yp2;
06615                q1   = qv-1;
06616                q2   = qv;
06617                flag = 1;
06618                goto l2;
06619             }
06620          }
06621       }
06622       q2 = 0;
06623       qv += 1;
06624       q1 = qv;
06625       if (q1>w1) {
06626          q2   = qv;
06627          q1   = 0;
06628          smer = 1;
06629          flag = 0;
06630          uhl  = 0;
06631          if (q2<=w2) goto l2;
06632       }
06633    } while (q1<=w1&&q2<=w2);
06634    if (fChanmarkEnDis==kChannelMarksDrawn ||
06635        fChanlineEnDis==kChannelGridDrawn) {
06636       line->SetLineWidth(1);
06637       for (i=fBx1;i<=fBx2;i++) fEnvelope[i] = fBy2;
06638       turni = 0;
06639       turnj = 0;
06640       Transform(w1,0,0);
06641       x1 = fXt;
06642       Transform(0,0,0);
06643       x2 = fXt;
06644       Transform(0,w2,0);
06645       x3 = fXt;
06646       if (x2>=x1) turnj = 1;
06647       if (x3>=x2) turni = 1;
06648       q1 = 1;
06649       q2 = 0;
06650       qv = 1;
06651       do {
06652          uhl  = 0;
06653          smer = 0;
06654          flag = 0;
06655 lc2:
06656          if (turni==1) {
06657             i = q1;
06658          } else {
06659             i = w1-q1;
06660          }
06661          if (turnj==1) {
06662             j = q2;
06663          } else {
06664             j = w2-q2;
06665          }
06666          Transform(i,j,0);
06667          x1 = fXt;
06668          y1 = fYt;
06669          Transform(i,j,-1);
06670          x1d = fXt;
06671          y1d = fYt;
06672          do {
06673             if (flag==0) {
06674                flag = 1;
06675                if (smer==0) q1 -= 1;
06676                else         q2 -= 1;
06677             } else {
06678                flag = 0;
06679                if (smer==0) q2 += 1;
06680                else         q1 += 1;
06681             }
06682             if (turni==1) {
06683                i = q1;
06684             } else {
06685                i = w1-q1;
06686             }
06687             if (turnj==1) {
06688                j = q2;
06689             } else {
06690                j = w2-q2;
06691             }
06692             Transform(i,j,0);
06693             x2 = fXt;
06694             y2 = fYt;
06695             if (flag==1) {
06696                x  = x1;
06697                y  = y1;
06698                x1 = x2;
06699                y1 = y2;
06700                x2 = x;
06701                y2 = y;
06702             }
06703             Envelope(x1,y1,x2,y2);
06704             if (fChanlineEnDis==kChannelGridDrawn) {
06705                if (fLine!=0) {
06706                   if (fLine==1) {
06707                      fXe = x2;
06708                      fYe = y2;
06709                   }
06710                   line->SetLineColor(fChanlineColor);
06711                   line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
06712                }
06713             }
06714             if (fChanmarkEnDis==kChannelMarksDrawn) {
06715                if (y1<=fEnvelope[x1]) {
06716                   DrawMarker(x1,y1,fChanmarkWidth,fChanmarkHeight,fChanmarkStyle);
06717                }
06718             }
06719             if (flag==1) {
06720                x   = x1;
06721                y   = y1;
06722                x1  = x2;
06723                y1  = y2;
06724                x2  = x;
06725                y2  = y;
06726                x   = x1d;
06727                y   = y1d;
06728                x1d = x2d;
06729                y1d = y2d;
06730                x2d = x;
06731                y2d = y;
06732                if (smer==0) q1 += 1;
06733                else         q2 += 1;
06734             } else {
06735                x1  = x2;
06736                y1  = y2;
06737                x1d = x2d;
06738                y1d = y2d;
06739             }
06740          } while ((q1!=qv||(q2!=(qv-1)&&q2!=w2)||smer!=0||flag!=1) &&
06741                   ((q1!=(qv-1)&&q1!=w1)||q2!=qv||smer!=1||flag!=1) &&
06742                    uhl!=1);
06743          if (qv<=w2&&qv<=w1) {
06744             if (uhl==0) {
06745                if (smer==0) {
06746                   smer = 1;
06747                   q1   = 0;
06748                   flag = 0;
06749                   q2   = qv;
06750                   xp1  = x1;
06751                   yp1  = y1;
06752                   goto lc2;
06753                } else {
06754                   smer = 0;
06755                   uhl  = 1;
06756                   q1   = qv;
06757                   q2   = qv-1;
06758                   xp2  = x1;
06759                   yp2  = y1;
06760                   x1   = xp1;
06761                   y1   = yp1;
06762                   flag = 1;
06763                   goto lc2;
06764                }
06765             } else {
06766                if (smer==0) {
06767                   smer = 1;
06768                   x1   = xp2;
06769                   y1   = yp2;
06770                   q1   = qv-1;
06771                   q2   = qv;
06772                   flag = 1;
06773                   goto lc2;
06774                }
06775             }
06776          }
06777          q2  = 0;
06778          qv += 1;
06779          q1  = qv;
06780          if (q1>w1) {
06781             q2   = qv;
06782             q1   = 0;
06783             smer = 1;
06784             flag = 0;
06785             uhl  = 0;
06786             if (q2<=w2) goto lc2;
06787          }
06788       } while (q1<=w1&&q2<=w2);
06789    }
06790 
06791    // Paint axis.
06792    static char chopt[10] = "";
06793    if (fViewAngle==0) {
06794       axis->PaintAxis(p101x, p101y, p111x, p111y, bmin, bmax, ndivx, "");
06795       axis->PaintAxis(p011x, p011y, p111x, p111y, bmin, bmax, ndivx, "");
06796       if(fAlpha+fBeta<90)
06797          axis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivx, "");
06798       ndivx = fH2->GetXaxis()->GetNdivisions();
06799       bmin  = fH2->GetXaxis()->GetXmin();
06800       bmax  = fH2->GetXaxis()->GetXmax();
06801       xaxis->SetLabelOffset(xaxis->GetLabelOffset()-xaxis->GetTickSize());
06802       chopt[0] = 0; strlcat(chopt, "SDH-",10);
06803       if (ndivx < 0) {
06804          strlcat(chopt, "N",10);
06805          ndivx = -ndivx;
06806       }
06807       xaxis->PaintAxis(p010x, p010y, p110x, p110y, bmin, bmax, ndivx, chopt);
06808       ndivy = fH2->GetYaxis()->GetNdivisions();
06809       bmin  = fH2->GetYaxis()->GetXmin();
06810       bmax  = fH2->GetYaxis()->GetXmax();
06811       yaxis->SetLabelOffset(yaxis->GetLabelOffset()+yaxis->GetTickSize());
06812       chopt[0] = 0; strlcat(chopt, "SDH+",10);
06813       if (ndivy < 0) {
06814          strlcat(chopt, "N",10);
06815          ndivy = -ndivy;
06816       }
06817       yaxis->PaintAxis(p100x, p100y, p110x, p110y, bmin, bmax, ndivy, chopt);
06818       if(fAlpha+fBeta<90){
06819          ndivz = 510;
06820          bmin  = fZmin;
06821          bmax  = fZmax;
06822          zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
06823          if (fZscale==kZScaleLog) {
06824             ndivz = 510;
06825             if (bmin <= 0) bmin=0.001*bmax;
06826             zaxis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivz, "G+");
06827          } else if (fZscale==kZScaleSqrt) {
06828             TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
06829             TGaxis *a1 = new TGaxis(p010x, p010y, p011x, p011y, "f1", ndivz, "SDH+");
06830             a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
06831             a1->Paint();
06832             delete f1;
06833             delete a1;
06834          } else {
06835             chopt[0] = 0; strlcat(chopt, "SDH+",10);
06836             if (ndivz < 0) {
06837                strlcat(chopt, "N",10);
06838                ndivz = -ndivz;
06839             }
06840             zaxis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivz, chopt);
06841          }
06842       }
06843    } else if (fViewAngle==90) {
06844       axis->PaintAxis(p001x, p001y, p101x, p101y, bmin, bmax, ndivx, "");
06845       axis->PaintAxis(p111x, p111y, p101x, p101y, bmin, bmax, ndivx, "");
06846       if(fAlpha+fBeta<90)
06847          axis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivx, "");
06848       ndivx = fH2->GetXaxis()->GetNdivisions();
06849       bmin  = fH2->GetXaxis()->GetXmin();
06850       bmax  = fH2->GetXaxis()->GetXmax();
06851       xaxis->SetLabelOffset(xaxis->GetLabelOffset()+xaxis->GetTickSize());
06852       chopt[0] = 0; strlcat(chopt, "SDH+",10);
06853       if (ndivx < 0) {
06854          strlcat(chopt, "N",10);
06855          ndivx = -ndivx;
06856       }
06857       xaxis->PaintAxis(p000x, p000y, p100x, p100y, bmin, bmax, ndivx, chopt);
06858       ndivy = fH2->GetYaxis()->GetNdivisions();
06859       bmin  = fH2->GetYaxis()->GetXmin();
06860       bmax  = fH2->GetYaxis()->GetXmax();
06861       yaxis->SetLabelOffset(yaxis->GetLabelOffset()+yaxis->GetTickSize());
06862       chopt[0] = 0; strlcat(chopt, "SDH+",10);
06863       if (ndivy < 0) {
06864          strlcat(chopt, "N",10);
06865          ndivy = -ndivy;
06866       }
06867       yaxis->PaintAxis(p100x, p100y, p110x, p110y, bmin, bmax, ndivy, chopt);
06868       if(fAlpha+fBeta<90){
06869          ndivz = 510;
06870          bmin  = fZmin;
06871          bmax  = fZmax;
06872          zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
06873          if (fZscale==kZScaleLog) {
06874             ndivz = 510;
06875             if (bmin <= 0) bmin=0.001*bmax;
06876             zaxis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivz, "G+");
06877          } else if (fZscale==kZScaleSqrt) {
06878             TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
06879             TGaxis *a1 = new TGaxis(p110x, p110y, p111x, p111y, "f1", ndivz, "SDH+");
06880             a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
06881             a1->Paint();
06882             delete f1;
06883             delete a1;
06884          } else {
06885             chopt[0] = 0; strlcat(chopt, "SDH+",10);
06886             if (ndivz < 0) {
06887                strlcat(chopt, "N",10);
06888                ndivz = -ndivz;
06889             }
06890             zaxis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivz, chopt);
06891          }
06892       }
06893    } else if (fViewAngle==180) {
06894       axis->PaintAxis(p011x, p011y, p001x, p001y, bmin, bmax, ndivx, "");
06895       axis->PaintAxis(p101x, p101y, p001x, p001y, bmin, bmax, ndivx, "");
06896       if(fAlpha+fBeta<90)
06897          axis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivx, "");
06898       ndivx = fH2->GetXaxis()->GetNdivisions();
06899       bmin  = fH2->GetXaxis()->GetXmin();
06900       bmax  = fH2->GetXaxis()->GetXmax();
06901       xaxis->SetLabelOffset(xaxis->GetLabelOffset()+xaxis->GetTickSize());
06902       chopt[0] = 0; strlcat(chopt, "SDH+",10);
06903       if (ndivx < 0) {
06904          strlcat(chopt, "N",10);
06905          ndivx = -ndivx;
06906       }
06907       xaxis->PaintAxis(p000x, p000y, p100x, p100y, bmin, bmax, ndivx, chopt);
06908       ndivy = fH2->GetYaxis()->GetNdivisions();
06909       bmin  = fH2->GetYaxis()->GetXmin();
06910       bmax  = fH2->GetYaxis()->GetXmax();
06911       yaxis->SetLabelOffset(yaxis->GetLabelOffset()-yaxis->GetTickSize());
06912       chopt[0] = 0; strlcat(chopt, "SDH-",10);
06913       if (ndivy < 0) {
06914          strlcat(chopt, "N",10);
06915          ndivy = -ndivy;
06916       }
06917       yaxis->PaintAxis(p000x, p000y, p010x, p010y, bmin, bmax, ndivy, chopt);
06918       if(fAlpha+fBeta<90){
06919          ndivz = 510;
06920          bmin  = fZmin;
06921          bmax  = fZmax;
06922          zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
06923          if (fZscale==kZScaleLog) {
06924             ndivz=510;
06925             if (bmin <= 0) bmin=0.001*bmax;
06926             zaxis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivz, "G+");
06927          } else if (fZscale==kZScaleSqrt) {
06928             TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
06929             TGaxis *a1 = new TGaxis(p100x, p100y, p101x, p101y, "f1", ndivz, "SDH+");
06930             a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
06931             a1->Paint();
06932             delete f1;
06933             delete a1;
06934          } else {
06935             chopt[0] = 0; strlcat(chopt, "SDH+",10);
06936             if (ndivz < 0) {
06937                strlcat(chopt, "N",10);
06938                ndivz = -ndivz;
06939             }
06940             zaxis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivz, chopt);
06941          }
06942       }
06943    } else if (fViewAngle==270) {
06944       axis->PaintAxis(p111x, p111y, p011x, p011y, bmin, bmax, ndivx, "");
06945       axis->PaintAxis(p001x, p001y, p011x, p011y, bmin, bmax, ndivx, "");
06946       if(fAlpha+fBeta<90)
06947          axis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivx, "");
06948       ndivx = fH2->GetXaxis()->GetNdivisions();
06949       bmin  = fH2->GetXaxis()->GetXmin();
06950       bmax  = fH2->GetXaxis()->GetXmax();
06951       xaxis->SetLabelOffset(xaxis->GetLabelOffset()-xaxis->GetTickSize());
06952       chopt[0] = 0; strlcat(chopt, "SDH-",10);
06953       if (ndivx < 0) {
06954          strlcat(chopt, "N",10);
06955          ndivx = -ndivx;
06956       }
06957       xaxis->PaintAxis(p010x, p010y, p110x, p110y, bmin, bmax, ndivx, chopt);
06958       ndivy = fH2->GetYaxis()->GetNdivisions();
06959       bmin  = fH2->GetYaxis()->GetXmin();
06960       bmax  = fH2->GetYaxis()->GetXmax();
06961       yaxis->SetLabelOffset(yaxis->GetLabelOffset()-yaxis->GetTickSize());
06962       chopt[0] = 0; strlcat(chopt, "SDH-",10);
06963       if (ndivy < 0) {
06964          strlcat(chopt, "N",10);
06965          ndivy = -ndivy;
06966       }
06967       yaxis->PaintAxis(p000x, p000y, p010x, p010y, bmin, bmax, ndivy, chopt);
06968       if(fAlpha+fBeta<90){
06969          ndivz = 510;
06970          bmin  = fZmin;
06971          bmax  = fZmax;
06972          zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
06973          if (fZscale==kZScaleLog) {
06974             ndivz = 510;
06975             if (bmin <= 0) bmin=0.001*bmax;
06976             zaxis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivz, "G+");
06977          } else if (fZscale==kZScaleSqrt) {
06978             TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
06979             TGaxis *a1 = new TGaxis(p000x, p000y, p001x, p001y, "f1", ndivz, "SDH+");
06980             a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
06981             a1->Paint();
06982             delete f1;
06983             delete a1;
06984          } else {
06985             chopt[0] = 0; strlcat(chopt, "SDH+",10);
06986             if (ndivz < 0) {
06987                strlcat(chopt, "N",10);
06988                ndivz = -ndivz;
06989             }
06990             zaxis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivz, "SDH+");
06991          }
06992       }
06993    }
06994 
06995    // End.
06996    delete axis;
06997    delete xaxis;
06998    delete yaxis;
06999    delete zaxis;
07000 }
07001 
07002 
07003 //______________________________________________________________________________
07004 void TSpectrum2Painter::SetDisplayMode(Int_t modeGroup,Int_t displayMode)
07005 {
07006    // Sets display group mode and display mode:
07007    //    -modeGroup - the following group modes can be set: simple modes-kPicture2ModeGroupSimple, modes with shading according to light-kPicture2ModeGroupLight, modes with shading according to channels counts-kPicture2ModeGroupHeight, modes of combination of shading according to light and to channels counts-kPicture2ModeGroupLightHeight
07008    //    -displayMode - posible display modes are: points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles
07009 
07010    if (modeGroup>=kModeGroupSimple&&modeGroup<=kModeGroupLightHeight) {
07011       if (displayMode>=kDisplayModePoints&&displayMode<=kDisplayModeTriangles) {
07012          fModeGroup   = modeGroup;
07013          fDisplayMode = displayMode;
07014       }
07015    }
07016 }
07017 
07018 
07019 //______________________________________________________________________________
07020 void TSpectrum2Painter::SetPenAttr(Int_t color,Int_t style,Int_t width)
07021 {
07022    // Sets pen attributes:
07023    //    -color - color of spectrum
07024    //    -style - style of pen (solid, dash, dot, dash-dot)
07025    //    -width - width of pen in pixels
07026 
07027    if (color>=0 && style >=kPenStyleSolid && style <= kPenStyleDashDot && width > 0) {
07028       fPenColor = color;
07029       fPenDash  = style;
07030       fPenWidth = width;
07031    }
07032 }
07033 
07034 
07035 //______________________________________________________________________________
07036 void TSpectrum2Painter::SetNodes(Int_t nodesx,Int_t nodesy)
07037 {
07038    // Sets nodes in both directions:
07039    //    -nodesx, nodesy, only the bins at the nodes points are displayed
07040 
07041    if (nodesx>1&&nodesy>1) {
07042       fNodesx = nodesx;
07043       fNodesy = nodesy;
07044    }
07045 }
07046 
07047 
07048 //______________________________________________________________________________
07049 void TSpectrum2Painter::SetAngles(Int_t alpha,Int_t beta,Int_t view)
07050 {
07051    // Sets angles of the view:
07052    //    -alpha - angles of display,alpha+beta must be less or equal to 90, alpha- angle between base line of Canvas and right lower edge of picture base plane
07053    //    -beta - angle between base line of Canvas and left lower edge of picture base plane
07054    //    -view - rotation angle of the view, it can be 0, 90, 180, 270 degrees
07055 
07056    if (alpha>=0&&alpha<=90&&beta>=0&&beta<=90&&alpha+beta<=90) {
07057       fAlpha = alpha;
07058       fBeta  = beta;
07059    }
07060    view = view/90;
07061    if (view>=0&&view<=3) fViewAngle = view*90;
07062 }
07063 
07064 
07065 //______________________________________________________________________________
07066 void TSpectrum2Painter::SetZScale(Int_t scale)
07067 {
07068    // Sets z-axis scale:
07069    //    -scale - linear, sqrt or log
07070 
07071    if (scale>=kZScaleLinear&&scale<=kZScaleSqrt) {
07072       fZscale = scale;
07073    }
07074 }
07075 
07076 
07077 //______________________________________________________________________________
07078 void TSpectrum2Painter::SetColorAlgorithm(Int_t colorAlgorithm)
07079 {
07080    // Sets shading color algorithm:
07081    //    -colorAlgorithm - applies only for rainbowed display modes
07082    //    (rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm,
07083    //    cmy modulo color component, cie smooth alorithm,
07084    //    cie modulo color component, yiq smooth alorithm,
07085    //    yiq modulo color component, hsv smooth alorithm,
07086    //    hsv modulo color component, it does not apply for simple display modes
07087    //    algorithm group
07088 
07089    if (fModeGroup!=kModeGroupSimple) {
07090       if (colorAlgorithm>=kColorAlgRgbSmooth&&colorAlgorithm<=kColorAlgHvsModulo) fColorAlg = colorAlgorithm;
07091    }
07092 }
07093 
07094 
07095 //______________________________________________________________________________
07096 void TSpectrum2Painter::SetColorIncrements(Double_t r,Double_t g,Double_t b)
07097 {
07098    // Sets color increments between two color levels for r, g, b components:
07099    //    -r, g, b - color increments between two color levels
07100 
07101    if (r>=0&&r<=255&&g>=0&&g<=255&&b>=0&&b<=255) {
07102       fRainbow1Step = r;
07103       fRainbow2Step = g;
07104       fRainbow3Step = b;
07105    }
07106 }
07107 
07108 
07109 //______________________________________________________________________________
07110 void TSpectrum2Painter::SetLightPosition(Int_t x,Int_t y,Int_t z)
07111 {
07112    // Sets position of fictive light source in 3D space:
07113    //    -x, y, z
07114 
07115    if (x>=0&&y>=0&&z>=0) {
07116       fXlight = x;
07117       fYlight = y;
07118       fZlight = z;
07119    }
07120 }
07121 
07122 
07123 //______________________________________________________________________________
07124 void TSpectrum2Painter::SetShading(Int_t shading,Int_t shadow)
07125 {
07126    // Sets on/off shading and shadow switches:
07127    //    -shading - determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
07128    //    -shadow - determines whether shadow will be drawn, for rainbowed display modes with shading according to light
07129 
07130    if (fModeGroup!=kModeGroupSimple) {
07131       if (shading==kNotShaded||shading==kShaded) fShading = shading;
07132       if (shadow==kShadowsNotPainted||shadow==kShadowsPainted) fShadow = shadow;
07133    }
07134 }
07135 
07136 
07137 //______________________________________________________________________________
07138 void TSpectrum2Painter::SetBezier(Int_t bezier)
07139 {
07140    // Sets on/off Bezier smoothing:
07141    //    -bezier - determines Bezier interpolation (applies only for simple
07142    //    display modes group for grid, x_lines, y_lines display modes)
07143 
07144    if (fDisplayMode==kDisplayModeGrid || fDisplayMode==kDisplayModeLinesX ||
07145        fDisplayMode==kDisplayModeLinesY) {
07146       if (bezier==kBezierInterpol||bezier==kNoBezierInterpol) fBezier = bezier;
07147    }
07148 }
07149 
07150 
07151 //______________________________________________________________________________
07152 void TSpectrum2Painter::SetContourWidth(Int_t width)
07153 {
07154    // Sets width between horizontal slices:
07155    //    -width - width between contours, applies only for contours display mode
07156 
07157    if (width>=1) fContWidth = width;
07158 }
07159 
07160 
07161 //______________________________________________________________________________
07162 void TSpectrum2Painter::SetLightHeightWeight(Double_t weight)
07163 {
07164    // Sets weight between shading according to fictive light source and according to channels counts:
07165    //    -weight - weight between shading according to fictive light source and according to channels counts, applies only for kPicture2ModeGroupLightHeight modes group
07166 
07167    if (fModeGroup==kModeGroupLightHeight) {
07168       if (weight>=0&&weight<=1) fLHweight = weight;
07169    }
07170 }
07171 
07172 
07173 //______________________________________________________________________________
07174 void TSpectrum2Painter::SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style)
07175 {
07176    // Sets enables/disables drawing of channel marks and sets their attributes:
07177    //    -enable - decides whether the channel marks are shown or not
07178    //    -color - color of channel marks
07179    //    -width - width of channel marks in pixels
07180    //    -height - height of channel marks in pixels
07181    //    -style - style of channel marks (dot, cross, star, rectangle, X, diamond, triangle)
07182 
07183    if (enable==kChannelMarksNotDrawn||enable==kChannelMarksDrawn) {
07184       if (enable==kChannelMarksDrawn) {
07185          if (style>=kChannelMarksStyleDot&&style<=kChannelMarksStyleTriangle) {
07186             fChanmarkStyle  = style;
07187             fChanmarkColor  = color;
07188             if (width>=4) {
07189                fChanmarkWidth  = width;
07190             }
07191             else fChanmarkWidth  = 4;
07192             if (height>=4) {
07193                fChanmarkHeight = height;
07194             }
07195             else fChanmarkHeight  = 4;
07196          }
07197       }
07198       fChanmarkEnDis = enable;
07199    }
07200 }
07201 
07202 
07203 //______________________________________________________________________________
07204 void TSpectrum2Painter::SetChanGrid(Int_t enable,Int_t color)
07205 {
07206    //   This function sets enables/disables drawing of channel grid and sets its color:
07207    //         -enable - decides whether the channel grid is shown or not
07208    //         -color - color of channel grid
07209 
07210    if (enable==kChannelGridNotDrawn||enable==kChannelGridDrawn) {
07211       if (enable==kChannelGridDrawn) {
07212          fChanlineColor=color;
07213       }
07214       fChanlineEnDis=enable;
07215    }
07216 }
07217 
07218 
07219 //______________________________________________________________________________
07220 void TSpectrum2Painter::GetDisplayMode(Int_t &modeGroup,Int_t &displayMode)
07221 {
07222    // Gets display group mode and display mode:
07223    //    -modeGroup - the following group modes might have been set: simple modes-kPicture2ModeGroupSimple, modes with shading according to light-kPicture2ModeGroupLight, modes with shading according to channels counts-kPicture2ModeGroupHeight, modes of combination of shading according to light and to channels counts-kPicture2ModeGroupLightHeight
07224    //    -displayMode - display modes that might have been set: points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles
07225 
07226    modeGroup   = fModeGroup;
07227    displayMode = fDisplayMode;
07228 }
07229 
07230 
07231 //______________________________________________________________________________
07232 void TSpectrum2Painter::GetPenAttr(Int_t &color, Int_t &style, Int_t &width)
07233 {
07234    // Gets pen attributes:
07235    //    -color - color of spectrum
07236    //    -style - style of pen (solid, dash, dot, dash-dot)
07237    //    -width - width of pen in pixels
07238 
07239    color = fPenColor;
07240    style = fPenDash;
07241    width = fPenWidth;
07242 }
07243 
07244 
07245 //______________________________________________________________________________
07246 void TSpectrum2Painter::GetNodes(Int_t &nodesx,Int_t &nodesy)
07247 {
07248    // Gets nodes in both directions:
07249    //    -nodesx, nodesy, only the bins at the nodes points are displayed
07250 
07251    nodesx = fNodesx;
07252    nodesy = fNodesy;
07253 }
07254 
07255 
07256 //______________________________________________________________________________
07257 void TSpectrum2Painter::GetAngles(Int_t &alpha,Int_t &beta,Int_t &view)
07258 {
07259    // Gets angles of the view:
07260    //    -alpha - angle between base line of Canvas and right lower edge of picture base plane
07261    //    -beta - angle between base line of Canvas and left lower edge of picture base plane
07262    //    -view - rotation angle of the view, it can be 0, 90, 180, 270 degrees
07263 
07264    alpha = fAlpha;
07265    beta  = fBeta;
07266    view  = fViewAngle;
07267 }
07268 
07269 
07270 //______________________________________________________________________________
07271 void TSpectrum2Painter::GetZScale(Int_t &scale)
07272 {
07273    // Gets z-axis scale:
07274    //    -scale - it can be linear, sqrt or log
07275 
07276    scale = fZscale;
07277 }
07278 
07279 
07280 //______________________________________________________________________________
07281 void TSpectrum2Painter::GetColorAlgorithm(Int_t &colorAlgorithm)
07282 {
07283    // Gets shading color algorithm:
07284    //    -colorAlgorithm - rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm, cmy modulo color component, cie smooth alorithm, cie modulo color component, yiq smooth alorithm, yiq modulo color component, hsv smooth alorithm, hsv modulo algorithm
07285 
07286    colorAlgorithm = fColorAlg;
07287 }
07288 
07289 
07290 //______________________________________________________________________________
07291 void TSpectrum2Painter::GetColorIncrements(Double_t &r,Double_t &g,Double_t &b)
07292 {
07293    // Gets color increments between two color levels for r, g, b components:
07294    //    -r, g, b - color increments between two color levels
07295 
07296    r = fRainbow1Step;
07297    g = fRainbow2Step;
07298    b = fRainbow3Step;
07299 }
07300 
07301 
07302 //______________________________________________________________________________
07303 void TSpectrum2Painter::GetLightPosition(Int_t &x,Int_t &y,Int_t &z)
07304 {
07305    // Gets position of fictive light source in 3D space:
07306    //    -x, y, z
07307 
07308    x = fXlight;
07309    y = fYlight;
07310    z = fZlight;
07311 }
07312 
07313 
07314 //______________________________________________________________________________
07315 void TSpectrum2Painter::GetShading(Int_t &shading,Int_t &shadow)
07316 {
07317    // Gets shading and shadow switches:
07318    //    -shading - determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
07319    //    -shadow - determines whether shadow will be drawn, for rainbowed display modes with shading according to light
07320 
07321    shading = fShading;
07322    shadow  = fShadow;
07323 }
07324 
07325 
07326 //______________________________________________________________________________
07327 void TSpectrum2Painter::GetBezier(Int_t &bezier)
07328 {
07329    // Gets Bezier smoothing switch:
07330    //    -bezier - determines Bezier interpolation (applies only for simple display modes group for grid, x_lines, y_lines display modes)
07331 
07332    bezier = fBezier;
07333 }
07334 
07335 
07336 //______________________________________________________________________________
07337 void TSpectrum2Painter::GetContourWidth(Int_t &width)
07338 {
07339    // Gets width between horizontal slices:
07340    //    -width - width between contours, applies only for contours display mode
07341 
07342    width = fContWidth;
07343 }
07344 
07345 
07346 //______________________________________________________________________________
07347 void TSpectrum2Painter::GetLightHeightWeight(Double_t &weight)
07348 {
07349    // Gets weight between shading according to fictive light source and according to channels counts:
07350    //    -weight - weight between shading according to fictive light source and according to channels counts, applies only for kPicture2ModeGroupLightHeight modes group
07351 
07352    weight = fLHweight;
07353 }
07354 
07355 
07356 //______________________________________________________________________________
07357 void TSpectrum2Painter::GetChanMarks(Int_t &enable,Int_t &color,Int_t &width,Int_t &height,Int_t &style)
07358 {
07359    // Gets drawing attributes for channel marks:
07360    //    -enable - decides whether the channel marks are shown or not
07361    //    -color - color of channel marks
07362    //    -width - width of channel marks in pixels
07363    //    -height - height of channel marks in pixels
07364    //    -style - style of channel marks (dot, cross, star, rectangle, X, diamond, triangle)
07365 
07366    style  = fChanmarkStyle,width=fChanmarkWidth,height=fChanmarkHeight,color=fChanmarkColor;
07367    enable = fChanmarkEnDis;
07368 }
07369 
07370 
07371 //______________________________________________________________________________
07372 void TSpectrum2Painter::GetChanGrid(Int_t &enable,Int_t &color)
07373 {
07374    // This function gets attributes for drawing channel:
07375    //    -enable - decides whether the channel grid is shown or not
07376    //    -color - color of channel grid
07377 
07378    color  = fChanlineColor;
07379    enable = fChanlineEnDis;
07380 }
07381 
07382 
07383 //______________________________________________________________________________
07384 void TSpectrum2Painter::PaintSpectrum(TH2* h2, Option_t *option, Int_t bs)
07385 {
07386    // This function allows to set all the possible options available in
07387    // TSpectrum2Painter and paint "h2".
07388    //
07389    // TSpectrum2Painter offers a large set of options/attributes. In the
07390    // "option" parameter each of them can be set to specific values via
07391    // "operators" in the option itself. for instance on can do:
07392    //
07393    //  h2->Draw("SPEC a(30,30,0)");
07394    //
07395    // to draw h2 with TSpectrum2Painter using all the default attributes except
07396    // the viewing angles. The operators' names are case unsensitive (one can use
07397    // "a" or "A"). Operators parameters are seperated by ",". The operators can
07398    // be put is any order in the option. Operators must be serparated by " ".
07399    // No " " characters should be put in an operator. This help page describes
07400    // all the available operators.
07401    //
07402    //                               * * *
07403    //
07404    // The way "h2" will be painted is controled with 2 parameters the "Display
07405    // modes groups" and the "Display Modes".
07406    //
07407    //   "Display modes groups" can take the following values:
07408    //
07409    //   0 = Simple      - it covers simple display modes using one color only
07410    //   1 = Light       - in this group the shading is carried out according to
07411    //                     the position of the fictive light source
07412    //   2 = Height      - in this group the shading is carried out according to
07413    //                     the channel contents
07414    //   3 = LightHeight - combination of two previous shading algorithms. One
07415    //                     can control the weight between both algorithms.
07416    //
07417    //   "Display modes" can take the following values:
07418    //
07419    //    1 = Points.
07420    //    2 = Grid.
07421    //    3 = Contours.
07422    //    4 = Bars.
07423    //    5 = LinesX.
07424    //    6 = LinesY.
07425    //    7 = BarsX.
07426    //    8 = BarsY.
07427    //    9 = Needles.
07428    //   10 = Surface.
07429    //   11 = Triangles.
07430    //
07431    // Using this function these parameters can be set using the "dm" operator
07432    // in the option. Example:
07433    //
07434    //   h2->Draw("SPEC dm(1,2)");
07435    //
07436    // will paint the 2D histogram h2 using the "Light Display mode group" and
07437    // the "Grid Display mode". The following table summarizes all the possible
07438    // combinations of the "Display modes groups" and the "Display modes".
07439    //
07440    //                  +--------+-------+--------+--------------+
07441    //                  | Simple | Light | Height | Light-Height |
07442    //      +-----------+--------+-------+--------+--------------+
07443    //      | Points    |   X    |   X   |   X    |      X       |
07444    //      +-----------+--------+-------+--------+--------------+
07445    //      | Grid      |   X    |   X   |   X    |      X       |
07446    //      +-----------+--------+-------+--------+--------------+
07447    //      | Contours  |   X    |   -   |   X    |      -       |
07448    //      +-----------+--------+-------+--------+--------------+
07449    //      | Bars      |   X    |   -   |   X    |      -       |
07450    //      +-----------+--------+-------+--------+--------------+
07451    //      | LinesX    |   X    |   X   |   X    |      X       |
07452    //      +-----------+--------+-------+--------+--------------+
07453    //      | LinesY    |   X    |   X   |   X    |      X       |
07454    //      +-----------+--------+-------+--------+--------------+
07455    //      | BarsX     |   X    |   -   |   X    |      -       |
07456    //      +-----------+--------+-------+--------+--------------+
07457    //      | BarsY     |   X    |   -   |   X    |      -       |
07458    //      +-----------+--------+-------+--------+--------------+
07459    //      | Needles   |   X    |   -   |   -    |      -       |
07460    //      +-----------+--------+-------+--------+--------------+
07461    //      | Surface   |   -    |   X   |   X    |      X       |
07462    //      +-----------+--------+-------+--------+--------------+
07463    //      | Triangles |   X    |   X   |   X    |      X       |
07464    //      +-----------+--------+-------+--------+--------------+
07465    //
07466    //                               * * *
07467    //
07468    // The Pen Attributes can be changed using pa(color, style, width). Example:
07469    //
07470    //   h2->Draw("SPEC dm(1,2) pa(2,1,2)");
07471    //
07472    // sets the line color to 2, line type to 1 and line width to2. Note that if
07473    // pa() is not specified, the histogram "h2" line attributes are used. Note
07474    // also that operators for SPEC option can be cummulated and specified in
07475    // any order.
07476    //
07477    //                               * * *
07478    //
07479    // The buffer size can be change with bf(size). Example:
07480    //
07481    //   h2->Draw("SPEC bf(8000)");
07482    //
07483    // The spectrum painter needs a buffer to paint the spectrum. By default the
07484    // buffer size is set to 1600. In most cases this buffer size is enough. But
07485    // if the canvas size is very big, for instance 8000x5000 this buffer size is
07486    // too small. An error message is issued telling to use the option bf().
07487    //
07488    //                               * * *
07489    //
07490    // The number of nodes can be change with n(nodesx, nodesy). Example:
07491    //
07492    //   h2->Draw("SPEC n(40,40)");
07493    //
07494    // Sometimes the displayed region is rather large. When displaying all
07495    // channels pictures become very dense and complicated. It is very difficult
07496    // to understand the overall shape of data. "n(nx,ny)" allows to change the
07497    // density of displayed channels. Only the channels coinciding with given
07498    // nodes are displayed.
07499    //
07500    //                               * * *
07501    //
07502    // The visualization angles can be changed with a(alpha, beta, view).
07503    // Example:
07504    //
07505    //   h2->Draw("SPEC n(40,40) dm(0,1) a(30,30,0)");
07506    //
07507    // Alpha defines the angle between bottom horizontal screen line and the
07508    // displayed space on the right side of the picture and beta on the left
07509    // side, respectively. One can rotate the 3-d space around vertical axis
07510    // going through the center of it employing the view parameter. Allowed
07511    // values are 0, 90, 180 and 270 degrees.
07512    //
07513    //                               * * *
07514    //
07515    // zs(scale) changes the scale of the Z-axis Possible values are:
07516    //
07517    //   0 = Linear (default)
07518    //   1 = Log
07519    //   2 = Sqrt
07520    //
07521    // If gPad->SetLogz() has been set, log scale on Z-axis is set automatically.
07522    // No need to use the zs() operator. Note that the X and Y axis are always
07523    // linear.
07524    //
07525    //                               * * *
07526    //
07527    // ci(r,g,b), were r,g and b are floats defines the colors increments.
07528    // For sophisticated shading (Light, Height and LightHeight Display Modes
07529    // Groups) the color palette starts from the basic pen color (see pa()
07530    // function). There is a predefined number of color levels (256). Color in
07531    // every level is calculated by adding the increments of the r, g, b
07532    // components to the previous level. Using this function one can change the
07533    // color increments between two neighboring color levels. The function does
07534    // not apply dor the Simple Display Modes Group. The default values are:
07535    // (1,1,1).
07536    //
07537    //                               * * *
07538    //
07539    // ca(color_algorithm) allows to choose the Color Algorithm.
07540    // To define the colors one can employ one of the following color algorithms
07541    // (RGB, CMY, CIE, YIQ, HVS models). When the level of a component reaches
07542    // the limit value one can choose either smooth transition (by decreasing
07543    // the limit value) or a sharp modulo transition (continuing with 0 value).
07544    // This makes possible to realize various visual effects. One can choose from
07545    // the following set of the algorithms:
07546    //
07547    //   0 = RGB Smooth
07548    //   1 = RGB Modulo
07549    //   2 = CMY Smooth
07550    //   3 = CMY Modulo
07551    //   4 = CIE Smooth
07552    //   5 = CIE Modulo
07553    //   6 = YIQ Smooth
07554    //   7 = YIQ Modulo
07555    //   8 = HVS Smooth
07556    //   9 = HVS Modulo
07557    //
07558    // This function does not apply on Simple display modes group. Default
07559    // value is 0. Example:
07560    //
07561    //   h2->Draw("SPEC c1(4) dm(0,1) a(30,30,0)");
07562    //
07563    // choose CMY Modulo to paint the "h2" histogram.
07564    //
07565    //                               * * *
07566    //
07567    // lp(x,y,z) set the light position.
07568    // In Light and LightHeight display modes groups the color palette is
07569    // calculated according to the fictive light source position in 3-d space.
07570    // Using this function one can change the position of the source and thus
07571    // to achieve various graphical effects. This function does not apply for
07572    // Simple and Height display modes groups. Default is:
07573    // lp(1000,1000,100).
07574    //
07575    //                               * * *
07576    //
07577    // s(shading,shadow) allows to set the shading.
07578    // The picture's surface is composed of triangles. If desired the edges of
07579    // the neighboring triangles can be smoothed (shaded). If desired the
07580    // display of the shadow can be painted as well. The function does not apply
07581    // for Simple display modes group. The possible values for shading are:
07582    //
07583    //   0 = Not Shaded
07584    //   1 = Shaded
07585    //
07586    // The possible values for shadow are:
07587    //
07588    //   0 = Shadows are not painted
07589    //   1 = Shadows are painted
07590    //
07591    // Default values: s(1,0)
07592    //
07593    //                               * * *
07594    //
07595    // b(bezier) set the Bezier smoothing.
07596    // For Simple display modes group and for Grid, LinesX and LinesY display
07597    // modes one can smooth data using Bezier smoothing algorithm. The function
07598    // does not apply for other display modes groups and display modes. Possible
07599    // values are:
07600    //
07601    //   0 = No bezier smoothing
07602    //   1 = Bezier smoothing
07603    //
07604    // Default value is: b(0)
07605    //
07606    //                               * * *
07607    //
07608    // cw(width) set the contour width.
07609    // This function applies only for the Contours display mode. One can change
07610    // the width between horizontal slices and thus their density.
07611    // Default value: cw(50)
07612    //
07613    //                               * * *
07614    //
07615    // lhw(weight) set the light height weight.
07616    // For LightHeight display modes group one can change the weight between
07617    // both shading algorithms. The function does not apply for other display
07618    // modes groups. Default value is lhw(0.5).
07619    //
07620    //                               * * *
07621    //
07622    // cm(enable,color,width,height,style) allows to draw a marker on each node.
07623    // In addition to the surface drawn using any above given algorithm one can
07624    // display channel marks. One can control the color as well as the width,
07625    // height (in pixels) and the style of the marks. The parameter enable can
07626    // be set to
07627    //
07628    //   0 =  Channel marks are not drawn
07629    //   1 =  Channel marks drawn
07630    //
07631    // The possible styles can be chosen from the set:
07632    //
07633    //   1 = Dot
07634    //   2 = Cross
07635    //   3 = Star
07636    //   4 = Rectangle
07637    //   5 = X
07638    //   6 = Diamond
07639    //   7 = Triangle.
07640    //
07641    //                               * * *
07642    //
07643    // cg(enable,color) channel grid.
07644    // In addition to the surface drawn using any above given algorithm one can
07645    // display grid using the color parameter. The parameter enable can be set
07646    // to:
07647    //
07648    //   0 = Grid not drawn
07649    //   1 = Grid drawn
07650    //
07651    //                               * * *
07652    //
07653    // See example in $ROOTSYS/tutorials/spectrum/spectrumpainter.C
07654    //Begin_Html
07655    /*
07656    <img src="gif/spectrumpainter.gif">
07657    */
07658    //End_Html
07659 
07660    TString opt = option;
07661 
07662    TSpectrum2Painter sp(h2, bs);
07663 
07664    if (gPad->GetLogz()) sp.SetZScale(kZScaleLog);
07665    sp.SetPenAttr(h2->GetLineColor(), h2->GetLineStyle(), h2->GetLineWidth());
07666 
07667    TString token;
07668    Int_t i1, i2, i3, i4, i5;
07669    Double_t f1, f2, f3;
07670    Ssiz_t from = 4;
07671 
07672    // Decode the paint options.
07673    while (opt.Tokenize(token, from, "[ (]")) {
07674 
07675       // Display Mode
07676       if (token=="dm") {
07677          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07678          if (i1<0 || i1>3) {
07679             printf("PaintSpectrum: Display modes groups should be in the [0,3] range\n");
07680             i1 = 0;
07681          }
07682          opt.Tokenize(token, from, ")"); i2 = token.Atoi();
07683          if (i2<1 || i2>11) {
07684             printf("PaintSpectrum: Display modes should be in the [1,11] range\n");
07685             i2 = 1;
07686          }
07687          sp.SetDisplayMode(i1, i2);
07688 
07689       // Pen Attributes
07690       } else if (token=="pa") {
07691          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07692          opt.Tokenize(token, from, ","); i2 = token.Atoi();
07693          opt.Tokenize(token, from, ")"); i3 = token.Atoi();
07694          sp.SetPenAttr(i1, i2, i3);
07695 
07696       // Nodes
07697       } else if (token=="n") {
07698          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07699          opt.Tokenize(token, from, ")"); i2 = token.Atoi();
07700          sp.SetNodes(i1, i2);
07701 
07702       // Color Algorithm
07703       } else if (token=="ca") {
07704          opt.Tokenize(token, from, ")"); i1 = token.Atoi();
07705          if (i1<0 || i1>9) {
07706             printf("PaintSpectrum: Color Algorithm should be in the [0,9] range\n");
07707             i1 = 1;
07708          }
07709          sp.SetColorAlgorithm(i1);
07710 
07711       // Z Scale
07712       } else if (token=="zs") {
07713          opt.Tokenize(token, from, ")"); i1 = token.Atoi();
07714          if (i1<0 || i1>2) {
07715             printf("PaintSpectrum: Z-Scale should be in the [0,2] range\n");
07716             i1 = 0;
07717          }
07718          sp.SetZScale(i1);
07719 
07720       // Color Increment
07721       } else if (token=="ci") {
07722          opt.Tokenize(token, from, ","); f1 = token.Atof();
07723          opt.Tokenize(token, from, ","); f2 = token.Atof();
07724          opt.Tokenize(token, from, ")"); f3 = token.Atof();
07725          sp.SetColorIncrements(f1, f2, f3);
07726 
07727       // Light Height Weight
07728       } else if (token=="lhw") {
07729          opt.Tokenize(token, from, ")"); f1 = token.Atof();
07730          sp.SetLightHeightWeight(f1);
07731 
07732       // Light Position
07733       } else if (token=="lp") {
07734          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07735          opt.Tokenize(token, from, ","); i2 = token.Atoi();
07736          opt.Tokenize(token, from, ")"); i3 = token.Atoi();
07737          sp.SetLightPosition(i1, i2, i3);
07738 
07739       // Contour Width
07740       } else if (token=="cw") {
07741          opt.Tokenize(token, from, ")"); i1 = token.Atoi();
07742          sp.SetContourWidth(i1);
07743 
07744       // Bezier
07745       } else if (token=="b") {
07746          opt.Tokenize(token, from, ")"); i1 = token.Atoi();
07747          if (i1<0 || i1>1) {
07748             printf("PaintSpectrum: Bezier should be in the [0,1] range\n");
07749             i1 = 0;
07750          }
07751          sp.SetBezier(i1);
07752 
07753       // Shading
07754       } else if (token=="s") {
07755          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07756          if (i1<0 || i1>1) {
07757             printf("PaintSpectrum: Shading should be in the [0,1] range\n");
07758             i1 = 0;
07759          }
07760          opt.Tokenize(token, from, ")"); i2 = token.Atoi();
07761          if (i2<0 || i2>1) {
07762             printf("PaintSpectrum: Shadow should be in the [0,1] range\n");
07763             i2 = 0;
07764          }
07765          sp.SetShading(i1, i2);
07766 
07767       // Channel Marks
07768       } else if (token=="cm") {
07769          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07770          opt.Tokenize(token, from, ","); i2 = token.Atoi();
07771          opt.Tokenize(token, from, ","); i3 = token.Atoi();
07772          opt.Tokenize(token, from, ","); i4 = token.Atoi();
07773          opt.Tokenize(token, from, ")"); i5 = token.Atoi();
07774          sp.SetChanMarks(i1, i2, i3, i4, i5);
07775 
07776       // Channel Grid
07777       } else if (token=="cg") {
07778          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07779          opt.Tokenize(token, from, ")"); i2 = token.Atoi();
07780          sp.SetChanGrid(i1, i2);
07781 
07782       // Angles
07783       } else if (token=="a" || token=="a=") {
07784          opt.Tokenize(token, from, ","); i1 = token.Atoi();
07785          opt.Tokenize(token, from, ","); i2 = token.Atoi();
07786          opt.Tokenize(token, from, ")"); i3 = token.Atoi();
07787          sp.SetAngles(i1, i2, i3);
07788 
07789       // Buffer size
07790       } else if (token=="bf") {
07791          // Nothing to do here, The option "bf" has been handle before.
07792          // But it is a valid option.
07793          opt.Tokenize(token, from, ")");
07794 
07795       // Unknown option
07796       } else {
07797          if (!token.IsNull()) {
07798             printf("Unknown option \"%s\"\n",token.Data());
07799             return;
07800          }
07801       }
07802    }
07803 
07804    sp.Paint("");
07805 }

Generated on Tue Jul 5 14:24:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1