core-graphics

How to pass values from uitextfield to CGAffineTransformMakeRotation

CGAffineTransformMakeRotation(90); How can I send mytextfield.text to CGAffineTransformMakeRotation like : CGAffineTransformMakeRotation(mytextfield.text); ...

Can a CGImage be added to the contents property of a CAShapeLayer?

I have a custom view with a layerClass override like: + (Class) layerClass { return [CAShapeLayer class]; } I want to be able to add a CGImage to the contents property like so: - (void) animateView { UIImage *layerImage = ...; CAShapeLayer *layer = (CAShapeLayer *)self.layer; layer.contents = layerImage.CGImage; ...

Painting on UIImageView with better performance

Hello :-) I have a view in which I paint a dotted line when the user moves their finger across the screen of the iPad/iPhone. I draw the line between a point stored as LastLocation, and the point that is the CurrentLocation. The drawings are to be persistant on the screen. This happens every time the touchMoved event is fired, and ends...

CGContext widths seem to be over stretched

I'm working with CGContext to create a simple square with four given points (the points should make a perfect square). However, instead of a 200px x 200px square, the iPad app makes, what looks like, 680w by 300h. Am I missing something? int beginPointX, beginPointY, gridSize, gridPadding; gridSize = 200; gridPadding = 10; beginPointX...

PDF Parsing in iPhone

Hello friend, I am trying to read a PDF on iPhone, I got to know that we can get the info about PDF from CGPDFDocumentGetCatalog method. But, this method returns a CGPDFDictionaryRef. I have browsed through the documentation and didn't find any method to extract its Key/Values. Please help me if anybody has solution for the problem. Or ...

Drawing rich text on iPhone using CoreGraphics

I'm showing a Twitter feed in a UITableView on the iPhone. Scrolling performance is an issue, so I'm doing my own drawing in table cells -- that is, cells have no subviews, and they draw their content with drawRect:. In drawRect: cells draw tweets' text using the drawAtPoint:forWidth:withFont:minFontSize:actualFontSize:lineBreakMode:ba...

Text drawn to CGContextRef Not Always complete

I am new to the Mac world and am seeing some behavior that is puzzling to me. I am working on a basic full screen utility that will capture the main display of the Mac and display some text. The problem I am having is that if I capture the display multiple times, after the first time the text that I am writing the the contextRef begins t...

Creating iPhone PDF Reader: CGPDFDocumentCreateWithURL zoom in text

Hi together, I want to make a newspaper on iPhone - in fact a pdf reader. In other magazin/pdf reader apps you can zoom in and text is still shape. How can I do that? With CGPDFDocumentCreateWithURL? Thx & best :-) ...

How to cache lines to a CGLayer? iPhone Programming

Hello there, I'm having performance issues when drawing with CoreGraphics in my iPhone application, the Idea is to draw a line with the finger. Every suggestion I could find on the internet targeting this problem was: "cache the lines to a CGLayer, so that the application doesn't have to redraw all those lines over and over again". No...

Can any one help me in drawing a bar graph...?

In my application I have to read data from a file or core data and draw a bar graph using that data. Can any one help me in drawing the bar graph in a simple way? ...

Corners from CGContextAddArc are too dark

Hey all, i have little problem with my code. I want to add a footer to a uitableview-section, but that's not my problem. My problem is that i want to have rounded corners on my footer-view, but not on all corners, just the two on the bottom. But the corners are just too dark and i don't know why... Heres my code: - (void)drawRect:(CG...

How do I draw a simple ellipse using CoreGraphics on the iPhone (specifically iPad)?

Just wondering how to draw an ellipse using CoreGraphics. ...

Rendering multiple document formats with Cocoa's CoreGraphics

CoreGraphics gives the possibility to render PDF documents, this is great. But it seems like it could support other types too like Word documents, HTML, RTF and others. A quick look in the doc2pdf.py example on the Mac OS X Developer DVD makes me think so : pageRect = CGRectMake(0, 0, 612, 792) c = CGPDFContextCreateWithFilename(ou...

Issue with erase or transparent stroke using CoreGraphics framework

In one of my apps, am trying to erase/transparent stroke a part of UIImage which am drawing using CoreGraphics framework (CGContextRef etc..). Well in the process I am able to clear the drawing in one shot by calling "removeAllObjects" message, but I was not able to figure out, how to erase a part of the drawing image. Gosh!! I sat the w...

Transparent repaint on UIView

I'm making an iPhone-app with particles moving on a custom UIView, drawn with Core Graphics. I want my particles to leave a trace, so when the view is repainted I want it to fill the background with 0.8 alpha. Anyone knows how to do this? I've tried setting the background color of the view to something transparent in IB, but that doesn...

How do I use CGContext to draw on top of an existing UIView?

I have a subclass of UIView in which I've added some subviews to in my initWithFrame method. I've added a background, amongst other things. I want to draw some shapes on top of these views (which happen to cover the entire screen). But, when I implement drawRect: to draw these shapes, they didn't show up. Upon removing the other subvie...

trouble getting multiple plot spaces to work in core-plot

I apologize for cross-posting to this and to the discussion list, but more eyes are better. I'm trying to create a discontinuous plot using the method described here: http://groups.google.com/group/coreplot-discuss/browse_thread/thread/..., and I'm having trouble getting the plots to render. I have one continuous plot that is associa...

Gradient layer not showing up/working on an existing View

I have a view with has another view (called swipeView) inside it. I'm trying to gradient color it using the CAGradientLayer - the code is below CAGradientLayer *layer = [CAGradientLayer layer]; layer.colors = [NSArray arrayWithObjects:(id)[UIColor darkGrayColor].CGColor, [UIColor lightGrayColor].CGColor, nil]; layer...

Optimize Core Graphics animated drawing (iPhone)

I have a loop that fires a function 30 times per second. The function changes the position of a couple of points that I use to animate. I draw lines through all the points, meaning that the lines will change 30 times per second. I draw these lines to a CGLayer, which then is drawn to a UIView in the drawRect: method. I do this because I...

CALayer moves instantly when trying to animate?

The code below handles a stack of CALayers. Every time a new layer is pushed onto the stack the function is locked, and all existing layers and moved down on the screen to make room for the new layer. Once the last layer is done animating the function is unlocked again so that new layers can be pushed. My problem is that every time this...