-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinedraw.h
More file actions
26 lines (23 loc) · 764 Bytes
/
linedraw.h
File metadata and controls
26 lines (23 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once
#include <stdint.h>
#include "vec.h"
enum {
LINE_STYLE_MOV = 0,
LINE_STYLE_AVG,
LINE_STYLE_ADD,
LINE_STYLE_SUB,
LINE_STYLE_ADDS,
LINE_STYLE_SUBS,
LINE_STYLE_ADD_AA,
LINE_STYLE_SUB_AA,
LINE_STYLE_ADDS_AA,
LINE_STYLE_SUBS_AA,
LINE_STYLE_ADDS_128, // saturated on start point only
LINE_STYLE_ADDS_128_AA, // saturated on start point only
};
void linedraw_bresenham(uint8_t *dst, int pitch, vec2i *a, vec2i *b, int color);
void linedraw_subpixel(uint8_t *dst, int pitch, vec2x *a, vec2x *b, int color, int style);
int lineclip(vec2i *a, vec2i *b, int xres, int yres);
// linedraw setup
void linedraw_calc_aa_table(int color, int invert = 0);
void linedraw_calc_pitch_table(int pitch);