: pygame, , .
: http://www.pygame.org/docs/ref/surface.html#pygame.Surface.convert
:
, , . blitting.
, , . [ ].
, .
, (.. , )
, . [, ,] .
blit, [] [C] memcpy, . . [ - 2D 6].
, , . , .
, -, - .
, , /, .
UPDATE:
, , , .
, 80 . , .
"" , [] (, ..).
, ?
, , , : 45 80. 22, . (, 30 ), , , , . , , N N + 1.
, , .
[] blit convert (.. - ).
, , blit_convert , ability_manager_surface.
, blit (, blit_fast blit_slow ). . , . , . .
blit_convert ability_manager_surface " " (, precalc_manager_surface), blit_fast precalc_manager_surface. "" .
def blit_fast(dstv,dsthgt,dstwid,dstybase,dstxbase,srcv,srchgt,srcwid):
for yoff in range(dstybase,dstybase + srchgt):
dstypos = (yoff * dstwid) + dstxbase
srcypos = (yoff * srcwid);
for xoff in range(0,srcwid):
dstv[dstypos + xoff] = srcv[srcypos + xoff]
def blit_slow(dstv,dsthgt,dstwid,dstybase,dstxbase,srcv,srchgt,srcwid):
for yoff in range(0,srchgt):
for xoff in range(0,srcwid):
dstv[dstybase + yoff][dstxbase + xoff] = srcv[yoff][xoff]
def blit_convert(dstv,dsthgt,dstwid,dstybase,dstxbase,srcv,srchgt,srcwid):
for yoff in range(0,srchgt):
for xoff in range(0,srcwid):
dstv[dstybase + yoff][dstxbase + xoff] = convert(srcv,yoff,xoff)
def convert(srcv,ypos,xpos):
cur = srcv[ypos][xpos]
top = srcv[ypos - 1][xpos]
bot = srcv[ypos + 1][xpos]
left = srcv[ypos][xpos - 1]
right = srcv[ypos][xpos + 1]
out = (cur * 0.6) + (top * 0.1) + (bot * 0.1) + (left * 0.1) + (right * 0.1)
return out
. "". / (, 1024x768 → 1920x1080), / " ", . , , . [ ]: https://cnx.org/contents/xOVdQmDl@10/Polyphase-Resampling-with-a-Ra
# 2:
,
. , . , .
, , , , .
, / .
, , blit, , ,
[]. ...
(, , .png), , . , .
, , [blit], . , - . , , ?
- . " ", pygame.display.flip .
, , .
[ ]: http://www.balloonbuilding.com/index.php?chapter=example_code
- " " " pygame". , [ ] , , .