Rename hash_to_matrix to matricize
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -64,6 +64,6 @@ colorizer = PaletteColorizer(palette)
|
||||
# pprint.pprint([[hex(c) for c in row] for row in colors])
|
||||
|
||||
# Print SVG
|
||||
matrix = NibbleMatricizer(w, h).hash_to_matrix(hashdata)
|
||||
matrix = NibbleMatricizer(w, h).matricize(hashdata)
|
||||
colors = PaletteColorizer(palette).colorize(matrix)
|
||||
print(gensvg(colors, 32))
|
||||
|
||||
@@ -11,14 +11,14 @@ class Matricizer(metaclass=abc.ABCMeta):
|
||||
self.h = h
|
||||
|
||||
@abc.abstractmethod
|
||||
def hash_to_matrix(self, data: bytes) -> Matrix:
|
||||
def matricize(self, data: bytes) -> Matrix:
|
||||
"""
|
||||
Convert a hash to a matrix of given width and height.
|
||||
"""
|
||||
|
||||
|
||||
class NibbleMatricizer(Matricizer):
|
||||
def hash_to_matrix(self, data: bytes) -> Matrix:
|
||||
def matricize(self, data: bytes) -> Matrix:
|
||||
"""
|
||||
Convert a set of bytes to a list of rows of nibbles.
|
||||
"""
|
||||
@@ -43,3 +43,7 @@ class NibbleMatricizer(Matricizer):
|
||||
row = []
|
||||
|
||||
return cols
|
||||
|
||||
|
||||
class PerlinMatricizer(Matricizer):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user