iOS平台下尺寸适中的遮罩导致URLImage.createMaskAdapter等方法失效
Codename One iOS平台
URLImage.createMaskAdapter()回归问题:中等尺寸遮罩创建失败 近期发现Codename One在iOS平台出现回归问题:调用URLImage.createMaskAdapter()创建遮罩适配器时会失败,但相同代码在Codename One模拟器、Android设备上运行正常,且几天前iOS平台也能正常工作。
初步排查后排除了近期UIScene改动的影响。
复现细节
- 可正常运行的小尺寸遮罩代码:
Image roundMask = Image.createImage(100, 100, 0xff000000); Graphics g = roundMask.getGraphics(); g.setColor(0xffffff); g.fillRoundRect(0, 0, 100, 100, 60, 60); URLImage.ImageAdapter ada = URLImage.createMaskAdapter(roundMask);
Image roundMask = Image.createImage(100, 150, 0xff000000); Graphics g = roundMask.getGraphics(); g.setColor(0xffffff); g.fillRoundRect(0, 0, 100, 150, 60, 60); URLImage.ImageAdapter ada = URLImage.createMaskAdapter(roundMask);
- 运行失败的中等尺寸遮罩代码:
Image roundMask = Image.createImage(410, 410, 0xff000000); Graphics g = roundMask.getGraphics(); g.setColor(0xffffff); g.fillRoundRect(0, 0, 410, 410, 60, 60); URLImage.ImageAdapter ada = URLImage.createMaskAdapter(roundMask);
Image roundMask = Image.createImage(410, 614, 0xff000000); Graphics g = roundMask.getGraphics(); g.setColor(0xffffff); g.fillRoundRect(0, 0, 410, 614, 60, 60); URLImage.ImageAdapter ada = URLImage.createMaskAdapter(roundMask);
抛出的异常
[EDT] 0:0:0,963 - Exception: java.lang.RuntimeException - null java.lang.RuntimeException at com_codename1_ui_Image.createMask:1090 at com_codename1_ui_URLImage.createMaskAdapter:231
问题总结
问题出在iOS平台下Image.createMask()/URLImage.createMaskAdapter()处理中等尺寸遮罩的逻辑上。410×410这类尺寸并不算特别大,但该功能近期在iOS平台出现回归,此前可正常运行。
内容的提问来源于stack exchange,提问作者Carlos Verdier
相关产品推荐
相关产品推荐

