cgimage

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

iPad (very) simple drawing

十年热恋 提交于 2019-12-02 18:55:34
I'm trying to implement a very simple drawing view in my app. This is only a small part of my app but it's turning into a real hassle. This is what I have so far, but all it's displaying right now is morse code like dots and lines. - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docsPath = [paths objectAtIndex:0]; NSString *savePath = [NSString stringWithFormat:@"%@/notePadImage.jpg",docsPath]; NSData *data = [NSData dataWithContentsOfFile

how to handle tiling of images on the fly

笑着哭i 提交于 2019-12-02 08:03:00
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 directory for one URL and would like to do the same for 5 URLs. Is it recommended to go with this approach

Why is my CGImage 3 x the size of the UIImage

耗尽温柔 提交于 2019-12-02 07:20:14
问题 I have a function that takes a UIImage and a colour and uses it to return a UIImage in just that colour. As part of the function the UIImage is converted to a CGImage but for some reason the CGImage is 3 times the size of the UIImage which means that the final result is 3 times the size that it should be. Here is the function func coloredImageNamed(name: String, color: UIColor) -> UIImage { let startImage: UIImage = UIImage(named: name)! print("UIImage W: \(startImage.size.width) H\

Why is my CGImage 3 x the size of the UIImage

ⅰ亾dé卋堺 提交于 2019-12-02 04:24:18
I have a function that takes a UIImage and a colour and uses it to return a UIImage in just that colour. As part of the function the UIImage is converted to a CGImage but for some reason the CGImage is 3 times the size of the UIImage which means that the final result is 3 times the size that it should be. Here is the function func coloredImageNamed(name: String, color: UIColor) -> UIImage { let startImage: UIImage = UIImage(named: name)! print("UIImage W: \(startImage.size.width) H\(startImage.size.height)") let maskImage: CGImage = startImage.CGImage! print("CGImage W: \(CGImageGetWidth

Proper use of MKOverlayView

家住魔仙堡 提交于 2019-12-02 03:27:33
问题 I am writing an iPhone app in which I place a large PNG image (1936 × 2967) on an MKMapView using MKOverlayView. I am a little confused about how to appropriately implement the drawMapRect: function in MKOverlayView - should I manually segment my image before drawing it? Or should I let the mechanisms of MKOverlayView handle all that? My impression from other posts is that before MKOverlayView was available, you were expected to segment images yourself for this kind of task, and use a

How to avoid malloc while using CGImageDestinationFinalize

ぐ巨炮叔叔 提交于 2019-12-02 01:47:42
I am trying to programmatically create GIF in iOS, using the following stack's question: Create and and export an animated gif via iOS? My code looks like this: // File Parameters const void *keys[] = { kCGImagePropertyGIFLoopCount }; const void *values[] = { (CFNumberRef) 0 }; CFDictionaryRef params = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL); const void *keys2[] = { kCGImagePropertyGIFDictionary }; const void *values2[] = { (CFDictionaryRef) params }; CFDictionaryRef fileProperties = CFDictionaryCreate(NULL, keys2 , values2, 1, NULL, NULL); // URL to the documents directory NSURL

Proper use of MKOverlayView

泄露秘密 提交于 2019-12-01 23:34:20
I am writing an iPhone app in which I place a large PNG image (1936 × 2967) on an MKMapView using MKOverlayView. I am a little confused about how to appropriately implement the drawMapRect: function in MKOverlayView - should I manually segment my image before drawing it? Or should I let the mechanisms of MKOverlayView handle all that? My impression from other posts is that before MKOverlayView was available, you were expected to segment images yourself for this kind of task, and use a CATiledLayer. I thought maybe MKOverlayView took care of all the dirty work. The real reason I ask though is

AVCAPTURE image orientation

China☆狼群 提交于 2019-12-01 20:53:34
I have a view controller which allows a user to take a picture. I am setting the avcapture bounds to be the bounds of a view on screen. Above this view I have a collection view. So users can capture multiple pictures, they are then added to the collection view above. I am having trouble with the correct orientation appearing in my preview above. Code is as follows: @IBOutlet weak var imagePreviews: UICollectionView! @IBOutlet weak var imgPreview: UIView! var session: AVCaptureSession? var stillImageOutput: AVCaptureStillImageOutput? var videoPreviewLayer: AVCaptureVideoPreviewLayer? var images

CGImageRelease: [Not A Type release]: message sent to deallocated instance

久未见 提交于 2019-12-01 12:09:55
I'm getting this error "[Not A Type release]: message sent to deallocated instance" on the last line of code "CGImageRelease(imageToSave);". Please explain why and what I need to use to fix it. I'm using ARC, but I don't think that applies to CG objects. I've updated the code with the suggested answers after testing that they work. CGImageRef imageToSave; UIImage *uiImageToSave = [[UIImage alloc] init]; if (sender == nil) { imageToSave = [originalImage CGImage]; } else { uiImageToSave = [self addTitleBlock:annotatedImage]; imageToSave = [uiImageToSave CGImage]; } [library