1
我有PNG文件,內容所有圖像,但我無法加載超過1024 * 1024的圖像。Android:1024px圖像大小限制?
我試圖加載圖像作爲紋理:
InputStream istr = CCDirector.sharedDirector().getActivity().getAssets().open(this.src + "balloon.png");
Bitmap mybit = BitmapFactory.decodeStream(istr);
istr.close();
CCTexture2D metexture = new CCTexture2D();
metexture.initWithImage(mybit);
for (int i = 0; i < 16; i++)
{
CCSpriteFrame myframe = CCSpriteFrame.frame(metexture, CGRect.make(0, i * 128, 80, 128), CGPoint.make(0, 0));
this.balloons_images.add(myframe);
}
而作爲的.plist
CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames(this.src + "balloon.plist");
this.addChild(CCSprite.sprite(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("balloon_16.png")), 20);
...
<key>balloon_16.png</key>
<dict>
<key>frame</key>
<string>{{0,1920},{80,128}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{80,128}}</string>
<key>sourceSize</key>
<string>{80,128}</string>
</dict>
...
結果的一部分是相同的。超過1024的所有圖像看起來像條紋。
有沒有辦法使用1024 * 1024多個圖像?
太棒了!這有幫助。謝謝! – dex07