FireBirdLib - Topfield TMS PVR TAP Programming Library
DrawOSDLine.c
Go to the documentation of this file.
1#include "libFireBird.h"
2
3void DrawOSDLine(word OSDRgn, dword Ax, dword Ay, dword Bx, dword By, dword Color)
4{
6
7 int dX, dY, Xincr, Yincr, dist, Xerr, Yerr, d;
8
9 // distances
10 dX = Bx - Ax;
11 dY = By - Ay;
12
13 // increments
14 if(dX < 0)
15 {
16 dX = -dX;
17 Xincr = -1;
18 }
19 else Xincr = (dX > 0 ? 1 : 0);
20
21 if(dY < 0)
22 {
23 dY = -dY;
24 Yincr = -1;
25 }
26 else Yincr = (dY > 0 ? 1 : 0);
27
28 // longest distance
29 dist = (dX > dY ? dX : dY);
30
31 // initialize error terms
32 Xerr = dX;
33 Yerr = dY;
34
35 // draw line
36 for(d = 0; d < dist; d++)
37 {
38 TAP_Osd_PutPixel_Chk("DrawOSDLine A", OSDRgn, Ax, Ay, Color); // plot the pixel
39
40 Xerr += dX;
41 Yerr += dY;
42
43 if(Xerr > dist)
44 {
45 Xerr -= dist;
46 Ax += Xincr;
47 }
48
49 if(Yerr > dist)
50 {
51 Yerr -= dist;
52 Ay += Yincr;
53 }
54 }
55
56 TAP_Osd_PutPixel_Chk("DrawOSDLine B", OSDRgn, Bx, By, Color); // plot the pixel
57
58 TRACEEXIT();
59}
void DrawOSDLine(word OSDRgn, dword Ax, dword Ay, dword Bx, dword By, dword Color)
Definition: DrawOSDLine.c:3
word OSDRgn
Definition: OSDMenuInit.c:4
int TAP_Osd_PutPixel_Chk(char *Comment, word rgn, dword x, dword y, dword pix)
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243