Zwoptex生成的spritesheet除了可以导出png格式的图片外还有pvr格式。pvr格式是iOS的显示芯片可以直接读取的,不需要经过解析就能直接显示,所以渲染速度更快,更节省内存。
我特意在cocos2D 2.0 rc1版本做了一项测试:
PVRTC4: Compressed format, 4 bits per pixel, ok image quality
PVRTC2: Compressed format, 2 bits per pixel, poor image quality
一般pvr格式文件的图像格式有:
RGBA8888: 32-bit texture with alpha channel, best image quality
RGBA4444: 16-bit texture with alpha channel, good image quality
RGB565: 16-bit texture without alpha channel, good image quality but no alpha (transparency)
图像占用内存的公式是:
numBytes = width * height * bitsPerPixel / 8
也就是说2048*2048的RGBA8888占用内存16MB,而PVRTC4只占用2MB