简体   繁体   中英

UIImage -drawAtPoint: very slow for large images

So I have a massive UIImage, maybe 10,000x10,000 px (I know they're not supposed to exceed 1024x1024 apparently, but anyway that's not the main problem). Moving this around the screen (constantly drawing at different points using -drawAtPoint) is very slow.

So I split the image into 100x100 px UIImages, and decided to draw them all separately using drawAtPoint. The result was even worse.

Is there a more efficient way of drawing UIImages to screen like this? Or a more efficient method of managing the images? Thanks.

EDIT.. When I broke it into tiles I was only drawing the tiles that were in view.

Apple has this really nice sample code called PhotoScroller - it shows how to use CATiledLayers along with pre-tiled images. But, you have to create the hundreds of tiles before hand, and either include them in your app bundle or download each.

There is another project on github called PhotoScrollerNetwork that has the ability to download massive jpeg only images and do all the various tiling for you, as it downloads. It leverages another open source library, libjpegturbo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM