MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / decode

Method decode

src/qidenticon.py:217–249  ·  view source on GitHub ↗
(self, code, twoColor)

Source from the content-addressed store, hash-verified

215 PATH_SET[idx] = p + p[:1]
216
217 def decode(self, code, twoColor):
218 # decode the code
219 shift = 0; middleType = (code >> shift) & 0x03
220 shift += 2; middleInvert= (code >> shift) & 0x01
221 shift += 1; cornerType = (code >> shift) & 0x0F
222 shift += 4; cornerInvert= (code >> shift) & 0x01
223 shift += 1; cornerTurn = (code >> shift) & 0x03
224 shift += 2; sideType = (code >> shift) & 0x0F
225 shift += 4; sideInvert = (code >> shift) & 0x01
226 shift += 1; sideTurn = (code >> shift) & 0x03
227 shift += 2; blue = (code >> shift) & 0x1F
228 shift += 5; green = (code >> shift) & 0x1F
229 shift += 5; red = (code >> shift) & 0x1F
230 shift += 5; second_blue = (code >> shift) & 0x1F
231 shift += 5; second_green= (code >> shift) & 0x1F
232 shift += 5; second_red = (code >> shift) & 0x1F
233 shift += 1; swap_cross = (code >> shift) & 0x01
234
235 middleType = self.MIDDLE_PATCH_SET[middleType]
236
237 foreColor = (red << 3, green << 3, blue << 3)
238 foreColor = QtGui.QColor(*foreColor)
239
240 if twoColor:
241 secondColor = (second_blue << 3, second_green << 3, second_red << 3)
242 secondColor = QtGui.QColor(*secondColor)
243 else:
244 secondColor = foreColor
245
246 return (middleType, middleInvert, 0),\
247 (cornerType, cornerInvert, cornerTurn),\
248 (sideType, sideInvert, sideTurn),\
249 foreColor, secondColor, swap_cross
250
251
252def render_identicon(code, size, twoColor=False, opacity=255, penwidth=0, renderer=None):

Callers 15

delMilAddrFunction · 0.45
genMilAddrFunction · 0.45
saveFileFunction · 0.45
inboxFunction · 0.45
outboxFunction · 0.45
readSentMsgFunction · 0.45
readMsgFunction · 0.45
replyMsgFunction · 0.45
buildKnownAddressesFunction · 0.45
listAddressBookEntriesFunction · 0.45
UIFunction · 0.45
APIAuthenticateClientMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected