DrawImage() Failing

Monkey Targets Forums/iOS/DrawImage() Failing

nigelibrown(Posted 2013) [#1]
Using DrawImage() on IOS target fails to display the image! MonkeyPro68c

The image is a multi-frame PNG with alpha transparency, loaded with image = LoadImage("path", width, height, 100 ) where width equals image width / 100.

On Glfw target the image is displayed correctly using DrawImage( image, xpos, ypos, frame )

On IOS target the image is not displayed at all, however if you use image = LoadImage("path") and DrawImage( image, xpos, ypos ) I am getting a white strip plotted where i would expect to see the whole image plotted?

Is there anyhthing else I can try to track this problem down?


therevills(Posted 2013) [#2]
How large is the PNG? It might actually be to large for the device.


nigelibrown(Posted 2013) [#3]
The image is 59829 bytes (58.4KB), 4800x48 pixels, with a bit depth 32bpp.


Uncle(Posted 2013) [#4]
I think the max size on iOS is 2048 x 2048. Perhaps you can chop up your image into several bits, and draw them separately.


nigelibrown(Posted 2013) [#5]
Uncle, thank you for the tip dropped BPP down to check if it was a space related thing and it was not, then reduced the frames to 10 so a width of 480 in the original image and it is displaying correctly. Shame it did not give a warning that the image was too large.


ElectricBoogaloo(Posted 2013) [#6]
LoadImage "Version Two" can handle squared spritesheets, so you're best off using those.

( where..
LoadImage(path,Frames,flags) is Version One
LoadImage(path,width,height,Frames,flags) is Version Two.
)

Pop your images into a square spritesheet, lined left->right, top->bottom.
[1][2][3]
[4][5][6]
[7][8][9]

They all fit much nicer, and will load easier on multiple targets.


nigelibrown(Posted 2013) [#7]
@ElectricBoogaloo, thanks for the tip downloaded TexturePackerGUI and managed to get it to output the images in the sheet format required. All working well under Glfw but not IOS same as before no image displaying?

Image 480x480 containing 10x10 48x48 pixel images.


nigelibrown(Posted 2013) [#8]
Another update, Finaly, nothing wrong with DrawImage it's just me not using rotation offsets for that part of the display update. Thanks for the sheet sprite tip will be using that from now on.