Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6683 Discussions

## Drawing Lines with IPP

Beginner
333 Views
I wrote a line drawing algorithm using the wu technique. It works but has issues. See below.

What I'm wondering is if anyone has tackled the problem of drawing anti-aliased lines using IPP. Or better yet, does IPP have this ability?

If anyone wants sample code for the following function let me know. It does not use IPP. I'm hoping to replace this with a more robust function, but I have not found one yet.

`void wuline(xya*& out, int x0, int y0, int x1, int y1){ short DeltaX, DeltaY, XDir; static const int intensity = 8;  if (y0 > y1) { short Temp = y0;  y0 = y1;  y1 = Temp; Temp = x0;  x0 = x1;  x1 = Temp; } *out++ = xya(x0,y0,255); if ((DeltaX = x1 - x0) >= 0) { XDir = 1; }  else  { XDir = -1; DeltaX = -DeltaX;  } if ((DeltaY = y1 - y0) == 0) { while (DeltaX-- != 0)  { x0 += XDir; *out++ = xya(x0,y0,255);			 }  return; }  if (DeltaX == 0)  { do  { y0++; *out++ = xya(x0,y0,255);			 }  while (--DeltaY != 0); return; } if (DeltaX == DeltaY)  { do  { x0 += XDir; y0++; *out++ = xya(x0,y0,255);			 }  while (--DeltaY != 0); return; } if (DeltaY > DeltaX)  { unsigned short ErrorAcc = 0;   unsigned short ErrorAdj = ((unsigned long) DeltaX << 16) / (unsigned long) DeltaY; while (--DeltaY)  { unsigned short ErrorAccTemp = ErrorAcc;    ErrorAcc += ErrorAdj;       if (ErrorAcc <= ErrorAccTemp)  x0 += XDir;  y0++; unsigned short Weighting = ErrorAcc >> intensity; *out++ = xya(x0,y0,Weighting ^ 255); *out++ = xya(x0+XDir,y0,Weighting); } *out++ = xya(x1,y1,255);			 } else { unsigned short ErrorAcc = 0;   unsigned short ErrorAdj = ((unsigned long) DeltaY << 16) / (unsigned long) DeltaX; while (--DeltaX)  { unsigned short ErrorAccTemp = ErrorAcc;    ErrorAcc += ErrorAdj;       if (ErrorAcc <= ErrorAccTemp)  y0++; x0 += XDir;  unsigned short Weighting = ErrorAcc >> intensity; *out++ = xya(x0,y0,Weighting ^ 255);			 *out++ = xya(x0,y0+1,Weighting); } *out++ = xya(x1,y1,255); }}`
Innovator
333 Views
reportbase,

IPP is not meant be a graphics drawing library, while it is very good for processing images, videos, and other signals.
IPP provides a high performance processing array/matrix based data.

regards,
Tamer