Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
Signed-off-by: Thxios <[email protected]>
  • Loading branch information
Thxios committed Mar 7, 2020
1 parent de0c69d commit 1cb6646
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Brush.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def OnMouseDown(self, clickedPixel, layer: Layer) -> (int, int, int, int):


class Brush:
_layer = None
_layer: Layer

pencil = _PencilBrush()
eraser = _EraserBrush()
Expand Down
8 changes: 4 additions & 4 deletions src/Window.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class MainWindow:

originX, originY = 200, 800

Brush.SetBrush('Pencil')
# ----- for test -----
Brush.pencil.SetCurrentColor((255, 0, 127, 255))

CanvasSection.Setup(originX, 0, w - originX, originY)
CanvasSection.SetupCanvas(64, 64)

Expand All @@ -29,10 +33,6 @@ class MainWindow:
mouseButtonCount = len(mouseButton)
mouseX, mouseY = 0, 0
mousePreviousX, mousePreviousY = 0, 0

Brush.SetBrush('Pencil')
# ----- for test -----
Brush.pencil.SetCurrentColor((255, 0, 127, 255))
currentSection = None

def Run(self):
Expand Down
55 changes: 41 additions & 14 deletions src/numpy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,44 @@ def End():
print(time() - t)


class Boo:
def DoSomething(self):
return


class TestClass:
member: [Boo]

def __init__(self):
self.member = []


a = TestClass()
print(a.member)
def draw(arr, x0, y0, x1, y1):
dx = x1 - x0
dy = y1 - y0
e = 0
if abs(dy) > abs(dx):
if y0 > y1:
x0, x1 = x1, x0
y0, y1 = y1, y0
x = x0
slope = abs(dx / dy)
print(slope)
for y in range(y0, y1 + 1):
arr[x, y] = 1
print(x, y, e)
e += slope
if e > 0.5:
x += 1
e -= 1
else:
if x0 > x1:
x0, x1 = x1, x0
y0, y1 = y1, y0
y = y0
slope = abs(dy / dx)
print(slope)
for x in range(x0, x1 + 1):
arr[x, y] = 1
print(x, y, e)
e += slope
if e > 0.5:
y += 1
e -= 1


a = np.zeros((32, 32), dtype=np.int8)
for i in a:
print(*i)
print('------------------------------------')
draw(a, 31, 0, 10, 31)
for i in a:
print(*i)

0 comments on commit 1cb6646

Please sign in to comment.