PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Social
libbadgewxtools
oled_line.c
1
#include <stdlib.h>
2
#include <propeller.h>
3
#include "
badgewxtools.h
"
4
5
volatile
screen
*
self
;
6
7
void
line
(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t c)
8
{
9
int
dx = x1-x0;
10
signed
char
ix = (dx > 0) - (dx < 0);
11
dx = abs(dx) << 1;
12
13
int
dy = y1 - y0;
14
signed
char
iy = (dy > 0) - (dy < 0);
15
dy = abs(dy) << 1;
16
17
point
( x0, y0, c);
18
19
if
( dx >= dy )
20
{
21
int
err = dy - (dx >> 1);
22
while
(x0 != x1)
23
{
24
if
( (err >= 0) && (err || (ix > 0)) )
25
{
26
err -= dx;
27
y0 += iy;
28
}
29
30
err += dy;
31
x0 += ix;
32
point
( x0, y0, c );
33
}
34
}
35
else
36
{
37
int
err = dx - (dy >> 1);
38
while
(y0 != y1)
39
{
40
if
( (err >= 0) && (err || (iy > 0)) )
41
{
42
err -= dy;
43
x0 += ix;
44
}
45
46
err += dx;
47
y0 += iy;
48
point
( x0, y0, c );
49
}
50
}
51
52
if
(self->AutoUpdate)
screen_update
();
53
}
54
55
/*
56
TERMS OF USE: MIT License
57
58
Permission is hereby granted, free of charge, to any person obtaining a
59
copy of this software and associated documentation files (the "Software"),
60
to deal in the Software without restriction, including without limitation
61
the rights to use, copy, modify, merge, publish, distribute, sublicense,
62
and/or sell copies of the Software, and to permit persons to whom the
63
Software is furnished to do so, subject to the following conditions:
64
65
The above copyright notice and this permission notice shall be included in
66
all copies or substantial portions of the Software.
67
68
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
71
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
73
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
74
DEALINGS IN THE SOFTWARE.
75
*/
76
badgewxtools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
point
void point(int x, int y, int color)
Plot a point on the oLED screen.
screen_update
int screen_update(void)
Manually update the screen image after. Typically used after multiple oLED function calls after scree...
Definition:
oled_asmfast.c:426
line
void line(int x0, int y0, int x1, int y1, int c)
Plot a line on the oLED screen.
screen
Definition:
badgetools.h:1709
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17