quartz-2d

Copy Table of Contents from one PDF to another

痴心易碎 提交于 2019-12-06 19:33:19
问题 You might find it as duplicate of this Question, but I didnt get any solution there. My scenario is like I am creating a PDF from existing PDF with some edits. That all works fine. My question is I want to add metadata, table of contents, bookmarks, what ever you call that is in metadata of PDF to newly created PDF. I am not able to understand XMP format as suggested here. Is there any way I can directly add TOC to new PDF. I am using following function but it is not working at all.

Problem adapting scale factor for iPad x2 compatibility mode

情到浓时终转凉″ 提交于 2019-12-06 12:51:22
问题 I wonder if anyone can help me with following. I have written a Quartz 2d ap and have used the following code to get the correct scale factor for each device : if ([UIScreen instancesRespondToSelector:@selector(scale)]) { return [[UIScreen mainScreen] scale]; } else { return 1.0; } I then multiply all values by this scale mulitplier in my code. The problem I have is that the app does not display propertly in x2 mode on the ipad - everything is two times too big. Can anybody help me ? Thanks,

Reading CGImageRef in a background thread crashes the app

眉间皱痕 提交于 2019-12-06 11:37:37
i have a big jpeg image that i want to load in tiles asynchronously in my opengl engine. Everything works well if its done on the main thread but its slow. When i try to put the tile loading on an NSOperationBlock, it always crashes when trying to access the shared image data pointer that i previously loaded on the main thread. There must be something i don't get with background operation because i assume i can access memory sections that i created on the main thread. What i try to do is the following : @interface MyViewer { } @property (atomic, assign) CGImageRef imageRef; @property (atomic,

Annotation (notes, comments) using Quartz 2d in ios

限于喜欢 提交于 2019-12-06 09:31:20
I am doing PDF based application for iPad. It supports thumbnail view, Free hand comment, And annotations (Notes). Ya and I searched lot on net but I didnt find any relevant answer for making annotation on PDF using Quartz 2d. We can get PDF page info using CGPDFDictionaryRef CGPDFPageGetDictionary ( CGPDFPageRef page ); And using Annots key. bool CGPDFDictionaryGetArray ( CGPDFDictionaryRef dict, "Annots", CGPDFArrayRef *value ); you can get annotation for particular page. If I am right what is key for Notes and if it is there how to update page dictionary. If i am wrong at all in above

Core Text With Asymmetric Shape on iOS

ぃ、小莉子 提交于 2019-12-06 05:48:47
问题 I want to write text in a path that can take up any shape. Right now I can draw flipped text in it: NSArray *coordinates = ...; CGMutablePathRef pathRef = [self objectPathGivenCoordinates:coordinates]; ... // Draw the shapes // Now draw the text CGContextSetTextMatrix(context, CGAffineTransformIdentity); NSAttributedString* attString = [[NSAttributedString alloc] initWithString:@"0,1,2..."]; CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef

In CoreGraphics drawing how can I keep the point of overlap from being darker than the rest of the line?

本秂侑毒 提交于 2019-12-05 16:56:39
My app uses core graphics for custom finger paint drawing. I allow the user to change the alpha of the line and a new line is continuously drawn on touches moved. When I make the alpha lower than 1.0 the point of overlap is darker than the rest of the line. I know why this occurs but how can I stop this? Kris Van Bael I suppose you want a single stroke not to darken itself, but still to darken previous strokes (that's how most painting apps work). For this to work, you need two views/buffers, one for the 'current background' and one for the current stroke. Merge the latter with the background

CGContextStrokePath triggers EXC_BAD_ACCESS in iOS > 5 [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-05 16:26:51
This question already has an answer here: Assigning an existing CGColor to a CGColor property works in iOS Simulator, not iOS device. Why? 3 answers I have a custom UIButton class that adds a gradient and a gloss effect to the UIButton the code works perfectly in iOS 4 and on iOS5 simulator but when i run it on iOS 5 devices it gives me the exception EXC_BAD_ACCESS , the exception is triggered by the line : CGContextStrokePath(context); any help is really appreciated , here's my code - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGFloat actualBrightness

UIGraphicsBeginPDFPage() randomly crashes on 64bit devices (CGPDFSecurityManagerCreateDecryptor ())

狂风中的少年 提交于 2019-12-05 10:39:35
I'm struggling with a pdf export method that's was running just fine until I ported the app to the arm64 achitecture. Bacisally, the method opens an existing PDF, it creates a new pdf file, and draws the content of the first pdf into the newly created one before adding more content pages. When the method tries to create a new pdf page to the document (after the first pdf was integrated to the new pdf) the app crashes with a EXC_BAD_ACCESS warning on UIGraphicsBeginPDFPage(); call . It only happens with some PDF files, not all and only on 64 bit devices. Here's the stacktrace which shows the

Clipping a CGGradient to a CGPath

倖福魔咒の 提交于 2019-12-05 07:12:28
问题 I've been banging my head against the wall for a long while trying to figure out why this is not working. Basically, I am trying to plot a graph (chart) with CGPath and then use that to clip a gradient. The end effect should be like the Stocks app which comes with the iPhone. The gradient and the path draw fine separately as two layered (unclipped) elements. But if I comment out the CGContextDrawPath, neither the line nor the gradient draw to the screen. Here's my drawRect code: CGContextRef

How to obtain a CGImageRef from the content of an UIView?

大城市里の小女人 提交于 2019-12-05 05:23:48
I have an UIView where I was drawing some stuff inside -drawRect:. Now I need a CGImageRef from this graphics context or bitmap of the UIView. Is there an easy way to get that? Like this (typed from memory, so it might not be 100% correct): // Get a UIImage from the view's contents UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, view.contentScaleFactor); CGContextRef context = UIGraphicsGetCurrentContext(); [view.layer renderInContext:context]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // Convert UIImage to CGImage