pep8 compliance: E302 expected 2 blank lines
This commit is contained in:
parent
b456f030a0
commit
657d6fc803
@ -1,6 +1,7 @@
|
|||||||
from pygame import draw, Surface
|
from pygame import draw, Surface
|
||||||
from pygame.locals import SRCALPHA
|
from pygame.locals import SRCALPHA
|
||||||
|
|
||||||
|
|
||||||
def frame_rect(surface, color, rect, thick = 1):
|
def frame_rect(surface, color, rect, thick = 1):
|
||||||
o = 1
|
o = 1
|
||||||
surface.fill(color, (rect.left+o, rect.top, rect.width-o-o, thick))
|
surface.fill(color, (rect.left+o, rect.top, rect.width-o-o, thick))
|
||||||
@ -8,6 +9,7 @@ def frame_rect(surface, color, rect, thick = 1):
|
|||||||
surface.fill(color, (rect.left, rect.top+o, thick, rect.height-o-o))
|
surface.fill(color, (rect.left, rect.top+o, thick, rect.height-o-o))
|
||||||
surface.fill(color, (rect.right - thick, rect.top+o, thick, rect.height-o-o))
|
surface.fill(color, (rect.right - thick, rect.top+o, thick, rect.height-o-o))
|
||||||
|
|
||||||
|
|
||||||
def blit_tinted(surface, image, pos, tint, src_rect = None):
|
def blit_tinted(surface, image, pos, tint, src_rect = None):
|
||||||
from Numeric import array, add, minimum
|
from Numeric import array, add, minimum
|
||||||
from pygame.surfarray import array3d, pixels3d
|
from pygame.surfarray import array3d, pixels3d
|
||||||
@ -21,11 +23,13 @@ def blit_tinted(surface, image, pos, tint, src_rect = None):
|
|||||||
buf_rgb = None
|
buf_rgb = None
|
||||||
surface.blit(buf, pos)
|
surface.blit(buf, pos)
|
||||||
|
|
||||||
|
|
||||||
def blit_in_rect(dst, src, frame, align = 'tl', margin = 0):
|
def blit_in_rect(dst, src, frame, align = 'tl', margin = 0):
|
||||||
r = src.get_rect()
|
r = src.get_rect()
|
||||||
align_rect(r, frame, align, margin)
|
align_rect(r, frame, align, margin)
|
||||||
dst.blit(src, r)
|
dst.blit(src, r)
|
||||||
|
|
||||||
|
|
||||||
def align_rect(r, frame, align = 'tl', margin = 0):
|
def align_rect(r, frame, align = 'tl', margin = 0):
|
||||||
if 'l' in align:
|
if 'l' in align:
|
||||||
r.left = frame.left + margin
|
r.left = frame.left + margin
|
||||||
@ -40,5 +44,6 @@ def align_rect(r, frame, align = 'tl', margin = 0):
|
|||||||
else:
|
else:
|
||||||
r.centery = frame.centery
|
r.centery = frame.centery
|
||||||
|
|
||||||
|
|
||||||
def brighten(rgb, factor):
|
def brighten(rgb, factor):
|
||||||
return [min(255, int(round(factor * c))) for c in rgb]
|
return [min(255, int(round(factor * c))) for c in rgb]
|
||||||
|
Reference in New Issue
Block a user