GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Functions
gp_line_clip.h File Reference

Line clipping algorithm. More...

Go to the source code of this file.

Functions

int gp_line_clip (int *px0, int *py0, int *px1, int *py1, int xmax, int ymax)
 Clips a line.
 

Detailed Description

Line clipping algorithm.

Definition in file gp_line_clip.h.

Function Documentation

◆ gp_line_clip()

int gp_line_clip ( int *  px0,
int *  py0,
int *  px1,
int *  py1,
int  xmax,
int  ymax 
)

Clips a line.

Clips a line so that the start and end points are within (0, xmax) and (0, ymax). This is used by the line drawing algorithms to make sure that the we only draw the part of line within pixmap.

Parameters
px0A starting x coordinate to clip.
py0A starting y cooridinate to clip.
px1An ending x coordinate to clip.
py1An ending y coordinate to clip.
xmaxA x coordinate upper limit.
ymaxA y coordinate upper limit.
Returns
Zero if the line is completely outside of the pixmap, non-zero otherwise.