iPhone SDK中包含了一个称为texturetool的命令行程序,用户可以通过该程序从非压缩图片中生成PVRTC数据,其具体位置如下所示:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/developer/usr/bin/
上述路径可能有变化
示例:
texturetool -m -e PVRTC -f PVR -p Preview.png -o Grid16.pvr Grid16.png
相关参数解释:
-m
生成纹理链路
-e PVRTC
使用PVRTC压缩
-f PVR
选择文件格式,而非解码规则
-p PreviewFile
可选参数,可使用户预览压缩后的有损PNG图像
-o OutFile
生成最终的PVR文件名
另外解码规则也可以通过以下参数调整:
-e PVRTC --bits-per-pixel-2
解码操作定义为2位/像素
-e PVRTC --bits-per-pixel-4
解码操作定义为4位/像素,这也是默认的解码方式
-e PVRTC --channel-weighting-perceptual -bits-per-pixel-2
采用自定义压缩以及2位/像素格式,自定义压缩并不改变图像数据的格式,而只是调整相应的压缩算法
-e PVRTC --channel-weighting-linear
该参数针对全部颜色分量进行压缩操作且默认状态下为“开”
texturetool目前并未出现与alpha值相关的控制参数 alpha值仍取决于源文件格式。
http://stackoverflow.com/questions/6671680/pvr-texturetool-build-phase
http://stackoverflow.com/questions/1823392/can-you-create-custom-build-rules-for-xcode-based-on-file-type
https://discussions.apple.com/thread/1916845?start=0&tstart=0
https://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TextureTool/TextureTool.html
https://developer.apple.com/library/ios/#qa/qa2008/qa1611.html