Skip to content

Commit 42afc4b

Browse files
committed
Removing unused functions in examples
1 parent 56c7c4a commit 42afc4b

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

examples/drawing_functions.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from math import *
21
from casioplot import *
32

43

@@ -9,47 +8,6 @@ def get_color(rgb, rgba):
98
return int(r), int(g), int(b)
109

1110

12-
def draw(p, color=(0, 0, 0)):
13-
x, y = p
14-
x += casioplot_settings.get('width') // 2
15-
y += casioplot_settings.get('height') // 2
16-
17-
if casioplot_settings.get('width') >= x >= 0 and casioplot_settings.get('height') >= y >= 0:
18-
bg = get_pixel(x, y)
19-
if len(color) == 4:
20-
c = get_color(bg, (color[0], color[1], color[2], color[3]))
21-
else:
22-
c = get_color(bg, (color[0], color[1], color[2], 255))
23-
24-
set_pixel(round(x), round(y), c)
25-
else:
26-
print("Warning: Pixel at position ({};{}) doesn't exist.".format(
27-
x - casioplot_settings.get('width') // 2,
28-
y - casioplot_settings.get('height') // 2))
29-
30-
31-
def line(p1, p2, color):
32-
"""
33-
Test of a line drawing function that use trigonometry to find the nearest pixel for each point of a line.
34-
"""
35-
xa, ya = p1
36-
xb, yb = p2
37-
x, y = xa - xb, ya - yb
38-
d = dist(x, y)
39-
if x != 0:
40-
a = atan2(y, x)
41-
# if x < 0:
42-
# a += pi
43-
elif y > 0:
44-
a = pi / 2
45-
else:
46-
a = 3 * pi / 2
47-
for i in range(round(d)):
48-
x1 = round(cos(a) * i) - xa
49-
y1 = round(sin(a) * i) - ya
50-
draw((x1, y1), color)
51-
52-
5311
def _f_part(x):
5412
return x - int(x)
5513

0 commit comments

Comments
 (0)