Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » LineDDA
LineDDA [message #4881] Thu, 24 August 2006 04:45 Go to previous message
unknown user
Window has a function I think very useful,does Linux have one too?
following code comes from WINE:
============================================================ =====
BOOL WINAPI LineDDA(INT nXStart, INT nYStart, INT nXEnd, INT nYEnd,
LINEDDAPROC callback, LPARAM lParam )
{
INT xadd = 1, yadd = 1;
INT err,erradd;
INT cnt;
INT dx = nXEnd - nXStart;
INT dy = nYEnd - nYStart;

if (dx < 0) {
dx = -dx; xadd = -1;
}
if (dy < 0) {
dy = -dy; yadd = -1;
}
if (dx > dy) { /* line is "more horizontal" */
err = 2*dy - dx; erradd = 2*dy - 2*dx;
for(cnt = 0;cnt <= dx; cnt++) {
callback(nXStart,nYStart,lParam);
if (err > 0) {
nYStart += yadd;
err += erradd;
} else {
err += 2*dy;
}
nXStart += xadd;
}
} else { /* line is "more vertical" */
err = 2*dx - dy; erradd = 2*dx - 2*dy;
for(cnt = 0;cnt <= dy; cnt++) {
callback(nXStart,nYStart,lParam);
if (err > 0) {
nXStart += xadd;
err += erradd;
} else {
err += 2*dx;
}
nYStart += yadd;
}
}
return TRUE;
}
============================================================ ==
can U++ provide one?
 
Read Message
Read Message
Read Message
Previous Topic: Using 605 in Linux several windows are not resizeable and don't fit in screen
Next Topic: Microsoft Visual C++ workspace
Goto Forum:
  


Current Time: Sun Apr 28 02:31:22 CEST 2024

Total time taken to generate the page: 3.96261 seconds