Remove Image.key, add Letter.key.
This commit is contained in:
parent
08a6d004e7
commit
a537f2140c
2 changed files with 6 additions and 5 deletions
|
|
@ -127,11 +127,6 @@ class Image(object):
|
||||||
def isspace(self):
|
def isspace(self):
|
||||||
return not _is_nonblank(self.bitmap)
|
return not _is_nonblank(self.bitmap)
|
||||||
|
|
||||||
@property
|
|
||||||
def key(self):
|
|
||||||
"""Return a byte string uniquely representing the image."""
|
|
||||||
return self.tostring()
|
|
||||||
|
|
||||||
def tostring(self):
|
def tostring(self):
|
||||||
"""Serialize the image as a string."""
|
"""Serialize the image as a string."""
|
||||||
height, width, *_ = self.shape
|
height, width, *_ = self.shape
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,12 @@ class Letter(PageObject):
|
||||||
super().__init__(image)
|
super().__init__(image)
|
||||||
self.elevation = elevation
|
self.elevation = elevation
|
||||||
|
|
||||||
|
@property
|
||||||
|
def key(self):
|
||||||
|
"""Return a dictionary key uniquely representing this letter."""
|
||||||
|
return self.elevation, self.image.tostring()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Space(Letter):
|
class Space(Letter):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue