pybitmessage.qidenticon module¶
Usage¶
>>> import qtidenticon
>>> qtidenticon.render_identicon(code, size)
Return a PIL Image class instance which have generated identicon image.
size
specifies patch size. Generated image size is 3 * size
.
-
class
DonRenderer
(code)[source]¶ Bases:
pybitmessage.qidenticon.IdenticonRendererBase
Don Park’s implementation of identicon see: http://www.docuverse.com/blog/donpark/2007/01/19/identicon-updated-and-source-released
-
MIDDLE_PATCH_SET
= [0, 4, 8, 15]¶
-
PATH_SET
= [[(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0), (0.0, 0.0)], [(0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (0.0, 0.0)], [(0.5, 0.0), (1.0, 1.0), (0.0, 1.0), (0.5, 0.0)], [(0.0, 0.0), (0.5, 0.0), (0.5, 1.0), (0.0, 1.0), (0.0, 0.0)], [(0.5, 0.0), (1.0, 0.5), (0.5, 1.0), (0.0, 0.5), (0.5, 0.0)], [(0.0, 0.0), (1.0, 0.5), (1.0, 1.0), (0.5, 1.0), (0.0, 0.0)], [(0.5, 0.0), (1.0, 1.0), (0.5, 1.0), (0.75, 0.5), (0.25, 0.5), (0.5, 1.0), (0.0, 1.0), (0.5, 0.0)], [(0.0, 0.0), (1.0, 0.5), (0.5, 1.0), (0.0, 0.0)], [(0.25, 0.25), (0.75, 0.25), (0.75, 0.75), (0.25, 0.75), (0.25, 0.25)], [(0.5, 0.0), (1.0, 0.0), (0.0, 1.0), (0.0, 0.5), (0.5, 0.5), (0.5, 0.0)], [(0.0, 0.0), (0.5, 0.0), (0.5, 0.5), (0.0, 0.5), (0.0, 0.0)], [(0.0, 0.5), (1.0, 0.5), (0.5, 1.0), (0.0, 0.5)], [(0.5, 0.5), (1.0, 1.0), (0.0, 1.0), (0.5, 0.5)], [(0.5, 0.0), (0.5, 0.5), (0.0, 0.5), (0.5, 0.0)], [(0.0, 0.0), (0.5, 0.0), (0.0, 0.5), (0.0, 0.0)], []]¶
-
decode
(code, twoColor)¶ decode the code
-
idx
= 15¶
-
p
= [(0.0, 0.0), (0.5, 0.0), (0.0, 0.5)]¶
-
vec
= (0, 2)¶
-
-
class
IdenticonRendererBase
(code)[source]¶ Bases:
object
Encapsulate methods around rendering identicons
-
PATH_SET
= []¶
-
decode
(code, twoColor)¶ virtual functions
-
drawPatchQt
(pos, turn, invert, patch_type, image, size, foreColor, backColor, penwidth)¶ Parameters: size – patch size
-
render
(size, twoColor, opacity, penwidth)¶ render identicon to QPicture
Parameters: size – identicon patchsize. (image size is 3 * [size]) Returns: QPicture
-