|
@@ -85,8 +85,8 @@ def main():
|
|
|
cursorSetting = {
|
|
|
'FrameCount': 1,
|
|
|
'FrameDuration': cursorConfig['FrameDuration'],
|
|
|
- 'HotSpotX': cursorConfig['HotSpot'][0],
|
|
|
- 'HotSpotY': cursorConfig['HotSpot'][1],
|
|
|
+ 'HotSpotX': cursorConfig['HotSpot'][0] + 2.0,
|
|
|
+ 'HotSpotY': cursorConfig['HotSpot'][1] + 2.0,
|
|
|
'Representations': []
|
|
|
}
|
|
|
hidpiRatio = 2 if capeConfig['HiDPI'] else 1
|
|
@@ -100,15 +100,17 @@ def main():
|
|
|
for frameIndex in range(len(res['msg'])):
|
|
|
b = io.BytesIO(res['msg'][frameIndex])
|
|
|
frame, (width, height) = readCUR(b, width, height)
|
|
|
- position = (0, int(width * frameIndex))
|
|
|
+ position = (2, 2 + int((height + 4) * frameIndex))
|
|
|
if frameIndex == 0:
|
|
|
- spriteSheet = Image.new('RGBA', (int(width), int(height) * len(res['msg'])))
|
|
|
+ spriteSheet = Image.new('RGBA', (int(width + 4), int(height + 4) * len(res['msg'])))
|
|
|
spriteSheet.paste(frame, position)
|
|
|
else:
|
|
|
logging.info('尝试作为CUR读入')
|
|
|
- spriteSheet, (width, height) = readCUR(f, width, height)
|
|
|
+ frame, (width, height) = readCUR(f, width, height)
|
|
|
+ spriteSheet = Image.new('RGBA', (int(width + 4), int(height + 4)))
|
|
|
+ spriteSheet.paste(frame, (2, 2))
|
|
|
logging.info(f'目标尺寸:{width}x{height}@{hidpiRatio}x')
|
|
|
- cursorSetting['PointsHigh'], cursorSetting['PointsWide'] = width, height
|
|
|
+ cursorSetting['PointsHigh'], cursorSetting['PointsWide'] = width + 4, height + 4
|
|
|
for scale in (1, 2) if capeConfig['HiDPI'] else (1,):
|
|
|
byteBuffer = io.BytesIO()
|
|
|
scaleImage(spriteSheet, scale).save(byteBuffer, format='tiff', compression='tiff_lzw')
|