TinyGL 0.4.1 for MinGW
Macros | Functions | Variables
zline.h File Reference

Go to the source code of this file.

Macros

#define RGB(x)
 
#define RGBPIXEL   *pp = color
 
#define ZZ(x)
 
#define PUTPIXEL()   RGBPIXEL
 
#define DRAWLINE(dx, dy, inc_1, inc_2)
 

Functions

 if (p1->y > p2->y||(p1->y==p2->y &&p1->x > p2->x))
 
 if (dx==0 &&dy==0)
 
else if (dx > 0)
 
 if (dx >=dy)
 

Variables

register int a
 
register PIXELpp = (PIXEL *) ((char *) zb->pbuf + zb->linesize * p1->y + p1->x * PSZB)
 
 sx = zb->xsize
 
 dx = p2->x - p1->x
 
 dy = p2->y - p1->y
 
 else
 

Macro Definition Documentation

◆ DRAWLINE

#define DRAWLINE (   dx,
  dy,
  inc_1,
  inc_2 
)
Value:
n=dx;\
ZZ(zinc=(p2->z-p1->z)/n);\
RGB(rinc=((p2->r-p1->r) << 8)/n;\
ginc=((p2->g-p1->g) << 8)/n;\
binc=((p2->b-p1->b) << 8)/n);\
a=2*dy-dx;\
dy=2*dy;\
dx=2*dx-dy;\
pp_inc_1 = (inc_1) * PSZB;\
pp_inc_2 = (inc_2) * PSZB;\
do {\
PUTPIXEL();\
ZZ(z+=zinc);\
RGB(r+=rinc;g+=ginc;b+=binc);\
if (a>0) { pp=(PIXEL *)((char *)pp + pp_inc_1); ZZ(pz+=(inc_1)); a-=dx; }\
else { pp=(PIXEL *)((char *)pp + pp_inc_2); ZZ(pz+=(inc_2)); a+=dy; }\
} while (--n >= 0);
#define PSZB
Definition: zbuffer.h:49
unsigned short PIXEL
Definition: zbuffer.h:48
dy
Definition: zline.h:31
register PIXEL * pp
Definition: zline.h:4
dx
Definition: zline.h:30
register int a
Definition: zline.h:1
#define ZZ(x)
Definition: zline.h:70

Definition at line 74 of file zline.h.

◆ PUTPIXEL

#define PUTPIXEL ( )    RGBPIXEL

Definition at line 71 of file zline.h.

◆ RGB

#define RGB (   x)

Definition at line 51 of file zline.h.

◆ RGBPIXEL

#define RGBPIXEL   *pp = color

Definition at line 55 of file zline.h.

◆ ZZ

#define ZZ (   x)

Definition at line 70 of file zline.h.

Function Documentation

◆ if() [1/4]

else if ( dx  ,
 
)

Definition at line 97 of file zline.h.

◆ if() [2/4]

if ( dx >=  dy)

Definition at line 105 of file zline.h.

◆ if() [3/4]

if ( dx  = = 0 && dy == 0)

Definition at line 95 of file zline.h.

◆ if() [4/4]

if ( p1->  y,
p2->y||  p1->y==p2->y &&p1->x > p2->x 
)

Definition at line 17 of file zline.h.

Variable Documentation

◆ a

register int a
Initial value:
{
int n, dx, dy, sx, pp_inc_1, pp_inc_2
sx
Definition: zline.h:23

Definition at line 3 of file zline.h.

◆ dx

dx = p2->x - p1->x

Definition at line 30 of file zline.h.

◆ dy

dy = p2->y - p1->y

Definition at line 31 of file zline.h.

◆ else

else
Initial value:
{
dx = -dx

Definition at line 103 of file zline.h.

◆ pp

pp = (PIXEL *) ((char *) zb->pbuf + zb->linesize * p1->y + p1->x * PSZB)

Definition at line 4 of file zline.h.

◆ sx

sx = zb->xsize

Definition at line 23 of file zline.h.