FACT++  1.0
void MGImage::DrawLine ( UChar_t *  buf,
int  w,
int  h,
Float_t  x1,
Float_t  y1,
Float_t  x2,
Float_t  y2,
UChar_t  col,
Int_t  style = 1 
)
static

Definition at line 279 of file MGImage.cc.

References i.

Referenced by DisableSyncMode(), DrawBox(), DrawCross(), DrawHexagon(), and DrawMultiply().

280 {
281  const Int_t step = style==kSolid?1:3;
282  const Double_t len = TMath::Hypot(x2-x1, y2-y1);
283  const Double_t dx = (x2-x1)/len*step;
284  const Double_t dy = (y2-y1)/len*step;
285 
286  Double_t x = x1;
287  Double_t y = y1;
288 
289  for (int i=0; i<len; i+=step)
290  {
291  x+= dx;
292  y+= dy;
293 
294  const Int_t iy = TMath::Nint(y);
295  if (iy<0 || iy>=h)
296  continue;
297 
298  const Int_t ix = TMath::Nint(x);
299  if (ix<0 || ix>=w)
300  continue;
301 
302  buf[ix+iy*w] = col;
303  }
304 }
int i
Definition: db_dim_client.c:21

+ Here is the caller graph for this function: