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])
|
# pprint.pprint([[hex(c) for c in row] for row in colors])
|
||||||
|
|
||||||
# Print SVG
|
# Print SVG
|
||||||
matrix = NibbleMatricizer(w, h).hash_to_matrix(hashdata)
|
matrix = NibbleMatricizer(w, h).matricize(hashdata)
|
||||||
colors = PaletteColorizer(palette).colorize(matrix)
|
colors = PaletteColorizer(palette).colorize(matrix)
|
||||||
print(gensvg(colors, 32))
|
print(gensvg(colors, 32))
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ class Matricizer(metaclass=abc.ABCMeta):
|
|||||||
self.h = h
|
self.h = h
|
||||||
|
|
||||||
@abc.abstractmethod
|
@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.
|
Convert a hash to a matrix of given width and height.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class NibbleMatricizer(Matricizer):
|
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.
|
Convert a set of bytes to a list of rows of nibbles.
|
||||||
"""
|
"""
|
||||||
@@ -43,3 +43,7 @@ class NibbleMatricizer(Matricizer):
|
|||||||
row = []
|
row = []
|
||||||
|
|
||||||
return cols
|
return cols
|
||||||
|
|
||||||
|
|
||||||
|
class PerlinMatricizer(Matricizer):
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user