mirror of
https://mikeslab.dix.asia/gogs/My-Mods/ANI2Cape.git
synced 2025-10-01 23:14:57 +00:00
Add cursor rotation
This commit is contained in:
parent
32270a18f3
commit
86edaa4b67
1 changed files with 3 additions and 0 deletions
|
@ -102,6 +102,7 @@ def main():
|
||||||
}
|
}
|
||||||
hidpiRatio = 2 if capeConfig['HiDPI'] else 1
|
hidpiRatio = 2 if capeConfig['HiDPI'] else 1
|
||||||
width, height = cursorConfig.get('Size', (-1.0, -1.0))
|
width, height = cursorConfig.get('Size', (-1.0, -1.0))
|
||||||
|
rotation = cursorConfig.pop('Rotation', 0)
|
||||||
|
|
||||||
with open(cursorConfig['Path'], 'rb') as f:
|
with open(cursorConfig['Path'], 'rb') as f:
|
||||||
spriteSheet = None
|
spriteSheet = None
|
||||||
|
@ -111,6 +112,7 @@ def main():
|
||||||
for frameIndex in range(len(res['msg'])):
|
for frameIndex in range(len(res['msg'])):
|
||||||
b = io.BytesIO(res['msg'][frameIndex])
|
b = io.BytesIO(res['msg'][frameIndex])
|
||||||
frame, (width, height) = readCUR(b, width, height)
|
frame, (width, height) = readCUR(b, width, height)
|
||||||
|
frame = frame.rotate(rotation)
|
||||||
position = (2, 2 + int((height + 4) * frameIndex))
|
position = (2, 2 + int((height + 4) * frameIndex))
|
||||||
if frameIndex == 0:
|
if frameIndex == 0:
|
||||||
spriteSheet = Image.new('RGBA', (int(width + 4), int(height + 4) * len(res['msg'])))
|
spriteSheet = Image.new('RGBA', (int(width + 4), int(height + 4) * len(res['msg'])))
|
||||||
|
@ -118,6 +120,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
logging.info('尝试作为CUR读入')
|
logging.info('尝试作为CUR读入')
|
||||||
frame, (width, height) = readCUR(f, width, height)
|
frame, (width, height) = readCUR(f, width, height)
|
||||||
|
frame = frame.rotate(rotation)
|
||||||
spriteSheet = Image.new('RGBA', (int(width + 4), int(height + 4)))
|
spriteSheet = Image.new('RGBA', (int(width + 4), int(height + 4)))
|
||||||
spriteSheet.paste(frame, (2, 2))
|
spriteSheet.paste(frame, (2, 2))
|
||||||
logging.info(f'目标尺寸:{width}x{height}@{hidpiRatio}x')
|
logging.info(f'目标尺寸:{width}x{height}@{hidpiRatio}x')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue