quartz-2d

What's a good approach to implement a smudge tool for a drawing program on the iPad?

At a high level (or low level if you'd like), what's a good way to implement a smudge affect for a drawing program on the iPad using Quartz2D (Core Graphics)? Has anyone tried this? Thanks so much in advance for your wisdom! UPDATE I found this great article for those interested, check it! ...

Quartz PDF API Causing Out of Memory Crashes

I'm having crashing issues using the Quartz PDF API for iOS. At the moment I am compiling with the SDK 4.0 GM Seed and running on my 3.2 iPad (I have tried using the 3.2 SDK with identical results). All the code I am using is based on the standard Apple Quartz documentation and from various sources around the internets. So I can't image...

How can I easily change the overall opacity of a bitmap context using Quartz2D?

I'd like to create a fade out affect with one of my bitmap contexts that I use to draw a static image in one of my views. What's an easy way to adjust the overall opacity of the bitmap context on the fly before I render it to the view? Thanks so much in advance for your help! I'm going to continue researching this right now. ...

How can I create a floating toolbar for an iPhone/iPad app?

I'm working on a bitmap editor app for the iPad/iPhone and I'd like to have a floating toolbar that the user can move around the drawing canvas so it doesn't get in the way of the drawing surface. I'd use a standard UIToolbar, but I'd like the toolbar to have a zoom navigation view, which wouldn't fit elegantly in a standard UIToolbar. ...

How can I easily change the overall opacity of a CGImageRef using Quartz2D?

This question is similar to another question I just posted, but I'd also like to create a fade out affect with one of my CGImageRefs that I use to draw a static image in one of my bitmap contexts using CGContextDrawImage(mBitmapContext, imageRect, imageRef). What's an easy way to adjust the overall opacity of CGImageRef on the fly before...

Quartz 2d / Core Graphics: What is the right way to draw some text?

I've been at this for awhile, it seems that there's many ways to go about this in quartz 2d: 1) Draw text using core graphics methods... CGContextSelectFont CGContextSetRGBFillColor CGContextShowTextAtPoint and on and on, which is horribly low level. 2) using NSString drawAtPoint (so far the method I like) NSString* text = @"Hello"...

App crashes on invoking CGPDFContentStreamWithPage

Hi all, I am trying to parse a PDF and extract catalogue from it. For this purpose I am using following code: - CGPDFPageRef page = CGPDFDocumentGetPage(document, currentPage); //1 myContentStream = CGPDFContentStreamCreateWithPage (page); //2 myScanner = CGPDFScannerCreate (myContentStream, table, NULL); //3 CGPDFScannerSca...

Using triangle as clipping area results in unwanted diagonal line

All, I have a square region where I have two 45 degree triangles that are opposite of each other (i.e. mirror image). I've created a CGMutablePathRef for each triangle so I can use that as my clipping path when drawing an image. The problem is that I am getting a diagonal line in the resulting image that divides the two triangles. Ho...

How to draw a big background inside a UIScrollView?

I have a UIScrollView that contains a subview that I want to fill with a texture. - (void)drawRect:(CGRect)rect { CGImageRef image_to_tile_ret_ref = CGImageRetain(wood.CGImage); CGRect tile_rect; tile_rect.size = wood.size; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextBeginPath(context); CGC...

reseting CGContextRef after drawing pdf page using CGContextDrawPDFPage

I am trying to create thumb images for every pdf page in PDF document and place it in a UISCrollVIew. I have succeeded in this, but scrolling is not so smooth as I want when it's too fast. And I want to optimize thumb images creating for Pdf page. I want to create one CGContextRef and reset its content after CGContextDrawPDFPage, as a co...

reasonable expectations for CALayer number of property animations concurrently?

Hi, I'm using UIView animation blocks to animate CALayer properties (backgroundColor in this case) on multiple layers on the display at once. All layers are opaque, and I'm animating everything in one block, essentially like this [UIView beginAnimations:@"outer" context:nil]; float duration = .25; float offset = 0.0; for( NSArray *vie...

iPhone Quartz2D render expanding circle

I'm curious as to the 'proper' method for achieving the following functionality using Quarts2D: I want to have a view, and to be able to add a circle at any coordinate. As soon as I add the circle it should expand at a predefined rate; I'd also like to repeat this process and have a number if these expanding circles. Think Missile Comm...

iPhone, CGPDFDocument - PDF links

Hello! I'm trying to write a simple PDF viewer using CGPDFDocument, based on QuartzDemo. There is common rendering: -(void)drawInContext:(CGContextRef)context { // PDF page drawing expects a Lower-Left coordinate system, // so we flip the coordinate system before we start drawing. CGContextTranslateCTM(context, 0.0, self...

Quartz 2D Drawing String in Rect, how can I get an ellipsis?

[infoText drawInRect:CGRectMake(10, 10, 310, 40) withFont:infoTextFont lineBreakMode:UILineBreakModeWordWrap]; Any suggestions on how to produce an ellipsis when the text exceeds the size of the rect? ...

How could Dan Briklin's Note Taker draw lines so smoothly?

I tried to write a similar hand drawing app. But the line drawing is always a little slow. If you'd written a similar app and got the line drawing optimized, please explain a bit. Dan's Note Taker Lite. ...

Reduce the size of PDF file generated with Quartz2D

Hello, I'm looking for a way to reduce PDF size that I generate with Quartz. I'm drawing images with CGContextDrawImage in a CGPDFContext. What I'm afraid of is that the images are saved as Bitmap and not JPEG. Is there a way to check for that and a way to control that when writing the PDF? I also tried reducing downscaling the image b...

DrawRect method slowing over time. Why?

I posted this elsewhere bus was unable to get help. So basically I'm trying to make it so the user can "draw" an Image onto a view. The way I'm trying to accomplish this is by every 9ish pixel of movement on the screen, I create a mask of the line drawn and then clip the image with that mask. It actually works beautifully at first, and...

CALayer or UIView backgroundColor UIImage on iOS 4

Good day all; I am not sure what has changed to prevent this from working. On iOS 3 SDK, the following code worked fine in a CATiledLayer class: - (void)drawInContext:(CGContextRef)context { UIImage* image = [[ResourcesManager sharedResourcesManager] getUIImageFromArray:Image_Cell_Background Index:[mazeCell zone]]; UIColor* col...

Creating a PDF programmatically using CGContext - cannot get line breaks + iPhone

Hi I am creating a PDF programmatically in my iPhone app using CGContext and CGContextShowTextAtPoint. While this works fine for smaller text, whenever I have line breaks in my text (\n) or want the text to wrap automatically to the next line when it reaches the end of the page, this does not happen. Any line breaks in the text are sim...

how do I get a PDF object (string,image,etc) that was touched by user?

I am using CGPDF* set of classes to read a pdf document, is there a way to extract the object that was touched ('clicked') by user? In other way is there a way to get a PDF / (Quartz?) object at certain coordinates? ...