catiledlayer

Display large images on iOS without precut tiles

五迷三道 提交于 2019-12-05 07:28:03
问题 I'm building a camera application that saves the image data to a single JPEG file in the sandbox. The images average at about 2mb in size. Problem : I cannot display the images in a photo viewer because having a few images in memory throws memory warnings and makes scrolling through the images very slow. I cannot split the image into tiles and save them to disk because that's even more expensive than displaying the single image. I tried splitting the image up into tiles upon capture, but on

iOS CATiledLayer crash

房东的猫 提交于 2019-12-05 06:04:55
问题 I have a pdf reader app for the iPad where I am using a scrollview to display each page. I keep the page in view and one page either side of the page in view. I have seperate views for portrait and landscape views. The portrait view showns a single page and the landscape viewer shows 2 pages. When the iPad changes orientation I unload the view for the old orientation and load the view for the new orientation. So say it was in portrait view and then changes to landscape the app unloads the

Present and zoom large images on iOS without CATiledLayer

和自甴很熟 提交于 2019-12-04 21:09:39
I'd like to present and allow the user to zoom large images on the iPhone and iPad in much the same way that the Photos app works. I realize CATiledLayer is the goto class for this, but the aesthetic it uses won't work for my application. It renders tiles one after another, while the Photos app renders the whole screen at once (and shows a pixellated version during and after a zoom until the app can catch up). I could certainly implement a view which renders the image in the background after each zoom. However, once the source image gets to large, this will crash the app. So tiling is

How do I keep a CALayer, sublayer of a CATiledLayer, from changing it's scale after a zoom?

邮差的信 提交于 2019-12-04 13:55:43
I have a CATiledLayer that is used to display a PDF page (this CATiledLayer is the layer type of my UIView which is a subview of a UIScrollView). I want to add overlay markers on this page. So I add a sublayer to my CATiledLayer. This sublayer again hosts the different marker's layers and acts as a grouping layer. So graphically, I have: (keep in mind that I have multiple markers which are CALayers also, this is ascii art after all) pdf page (CATiledLayer) ---------------------- | CALayer | | +---------+ | | | +----+ | | | | |mker| | | | | +----+ | | | +---------+ | | | ----------------------

Any way to encode a PNG faster than UIImagePNGRepresentation?

允我心安 提交于 2019-12-04 10:23:24
问题 I'm generating a bunch of tiles for CATiledLayer . It takes about 11 seconds to generate 120 tiles at 256 x 256 with 4 levels of detail on an iPhone 4S. The image itself fits within 2048 x 2048. My bottleneck is UIImagePNGRepresentation . It takes about 0.10-0.15 seconds to generate every 256 x 256 image. I've tried generating multiple tiles on different background queue's, but this only cuts it down to about 9-10 seconds. I've also tried using the ImageIO framework with code like this: -

How do I remove those rotation artefacts from my CATiledLayer?

三世轮回 提交于 2019-12-04 07:21:29
I have a CATiledLayer into which I render content in the following method - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx I used the QuartzDemo code to draw a pattern. This works very well until I apply a rotation transform to the layer's parentLayer (a UIView): rotated: These zigzag artefacts become worse when I start drawing lines and texts into the CATiledLayer. I applied the transform as follows (I also tried using an affine transform on the view itself): self.containerView.layer.transform = CATransform3DMakeRotation(angleRadians, 0.0f, 0.0f, 1.0f); I transform the

Using NSString's drawAtPoint method in place of CGContextShowGlyphsAtPoint problems

别来无恙 提交于 2019-12-04 03:14:28
In my app I'm trying to render text along a path; this is fine for most characters but not for Japanese (or anything non mac-Roman). I've been advised to use [NSString drawAtPoint] which displays the correct characters in my CATiledLayer; however, they dissapear after approximately 5 seconds. In this time I can zoom the layer and they scale properly, but they don't seem to get committed to the CATiledLayer like the rest of the text usually is. Before I render, I check the string and decide whether any of them will not be renderable. If I'm going to have issues, I use drawAtpoint instead: if (

iOS CATiledLayer crash

↘锁芯ラ 提交于 2019-12-03 17:14:51
I have a pdf reader app for the iPad where I am using a scrollview to display each page. I keep the page in view and one page either side of the page in view. I have seperate views for portrait and landscape views. The portrait view showns a single page and the landscape viewer shows 2 pages. When the iPad changes orientation I unload the view for the old orientation and load the view for the new orientation. So say it was in portrait view and then changes to landscape the app unloads the portrait view and loads the landscape view. This all works great except when the pdf's are large. The pdf

Any way to encode a PNG faster than UIImagePNGRepresentation?

走远了吗. 提交于 2019-12-03 05:45:23
I'm generating a bunch of tiles for CATiledLayer . It takes about 11 seconds to generate 120 tiles at 256 x 256 with 4 levels of detail on an iPhone 4S. The image itself fits within 2048 x 2048. My bottleneck is UIImagePNGRepresentation . It takes about 0.10-0.15 seconds to generate every 256 x 256 image. I've tried generating multiple tiles on different background queue's, but this only cuts it down to about 9-10 seconds. I've also tried using the ImageIO framework with code like this: - (void)writeCGImage:(CGImageRef)image toURL:(NSURL*)url andOptions:(CFDictionaryRef) options {

how to handle tiling of images on the fly

本小妞迷上赌 提交于 2019-12-02 19:07:34
问题 I am writing an app which would tile the images 256 * 256 and write those tile files back in the directory. I am updating my URL each time if there are any updates and tile those images back and store in the iphone folder. I am worried about two main things : 1) Memory consumption -- will the memory consumption for 5 images of size 200 KB a lot ? 2) How fast I can process my app if I have to tile 5 different URL with images at the same time ? I have written a code to tile and save in the