core-graphics

In Cocoa, how could you create an NSImage from a view? (Very similar to Top Sites in Safari 4.)

Actually, almost exactly the same thing. A matrix of small views that would expand out when you click on them. I don't know if it makes more sense to take a snapshot of the view as an image and work with that, or if there is a way to keep the views "live". Thoughts on either approach are welcome! ...

CATiledLayer blanking tiles before drawing contents

All, I'm having trouble getting behavior that I want from CATiledLayer. Is there a way that I can trigger the tiles to redraw without having the side-effect that their areas are cleared to white first? I've already subclassed CATiledLayer to set fadeDuration to return 0. To be more specific, here are the details of what I'm seeing an...

CGContextDrawImage leak

I have a custom view that draws an CGImage using: - (void) drawImage { CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; CGRect imageRect = {{0,0}, {CGImageGetWidth(image), CGImageGetHeight(image)}}; CGContextDrawImage(context, imageRect, image); } It looks like the memory used by the ...

Thread Safety Of Custom Sequential CGDataProvider

When creating a custom sequential CGDataProvder to render a custom image format you specify the CGDataProviderSequentialCallbacks that should be used. While doing some optimization work to improve the speed of my sequential CGDataProvider I started to wonder about the thread safety of those callbacks. Let's assume I have created a si...

CGImage create thumbnail image with desired size

Hi, I want to create the thumbnail using the CG. It creates the thumbnails. Here i want to have the thumbnail with the size 1024 (with aspect ratio.) Is it possible to get the desired size thumbnail directly from the CG? In the options dictionary i can pass the max size of the thumnail can be created, but is there any way to have mi...

Animating a shape with CoreAnimation

Hello folks, I approaching core animation and drawing empirically. I am trying to animate a simple shape; the shape in question is formed by 3 lines plus a bezier curve. A red line is also drawn, to show the curve control points. My main controller simply adds this subview and calls the adjustWave method whenever touchesEnd. Here is t...

Set image colors from core graphics

I have image in png file like this. I load it and draw in drawRect method. Can I change colors of image in Core Graphics or Quartz on iphone? I want to have red football ball, not black. Can I do it? ...

How to swap negative rotation values over to positive rotation values?

Example: I have a circle which is split up into two halfs. One half goes from 0 to -179,99999999999 while the other goes from 0 to 179,99999999999. Typical example: transform.rotation.z of an CALayer. Instead of reaching from 0 to 360 it is slip up like that. So when I want to develop a gauge for example (in theory), I want to read val...

iPhone – Photoshop like effects

Can I make in iphone multiply, screen, color or other photoshop like effects? ...

Preserve line width while scaling all points in the context with CGAffineTransform

Hi there, I have a CGPath in some coordinate system that I'd like to draw. Doing so involves scaling the old coordinate system onto the Context's one. For that purpose, I use CGContextConcatCTM() which does transform all the points as it should. But, as it is a scaling operation, the horizontal/vertical line widths get changed to. E.g. ...

What's the difference between Quartz Core, Core Graphics and Quartz 2D?

I wonder if someone can distinguish precisely between these? For my understanding, Core Graphics is just a "Framework Package" which contains Quartz Core and Quartz 2D. But I'm not sure about if Quartz 2D actually is Quartz Core? Maybe someone can draw some lines there? What makes up the differences between these? When looking at the do...

How do I use a mask to punch out my image?

I have a mask (loaded from a 256 grey PNG) that I want to apply to an image that's being used as part of my process for drawing a UITableViewCell's imageView.image property. When the cell isn't selected/highlighted, I CGImageCreateWithMask with a square of the proper color and the mask, then drawAtPoint: it into the image I'm building. ...

Allow horizontal scrolling only in the core-plot barchart?

Hi all, I am using core-plot lib to draw bar charts in my app like this My problem is that i want the enabling of grapgh movement only in horizontal direction so that I can see the records for a long period of time, But the problem is that i just wnt to keep the y axis fixed to its place, How can i do this? Waiting for help.... ...

How do I use CGAffineTransformMakeScale and Rotation at once?

((UIImageView*)[dsry objectAtIndex:0]).transform = CGAffineTransformMakeRotation(1.57*2); ((UIImageView*)[dsry objectAtIndex:0]).transform = CGAffineTransformMakeScale(.5,.5); Just one of these works at a time. How can I save a transformation and then apply another? Cheers ...

Keeping the y-axis fixed at place?

Hi all, this is the code in the continuation of this question....http://stackoverflow.com/questions/1892544/allow-horizontal-scrolling-only-in-the-core-plot-barchart -(BOOL)pointingDeviceDraggedAtPoint:(CGPoint)interactionPoint { if ( !self.allowsUserInteraction || !self.graph.plotArea ) { return NO; } CGPoint pointI...

Rounded rect with Gradient color

I have not really done much programming with Core Graphics. And I tend to stick with QuartzCore now that it does a lot of what I need through the layer property :) However, I have a UIView, which is currently gradient. I'd like to add rounded corners to this UIView and the layer property does not do this when I draw the gradient: - (vo...

Sliding from One View to Another.

How would I change from one view to another with a slide transition? Thanks. ...

how to draw on the surface of imageview transparently

i want to track finger touch and draw the path on top of the imageView. following is what i did: In the touch event: UIgraphicsBeginImageContext(imageView.frame.size); [imageView.image drawInRect:CGRectMake(0,0,imageView.size.width,imageView.size.height)]; //drawing..... imageView.image=UIGraphicsGetImageFromCurrentImageContext(); UIG...

Create a porthole animation transition on the iPhone?

Can anyone recommend how I might be able to create a view transition that looks like a circle expanding from the center of the view? Any pointers would be helpful, or maybe a link to some similar code, even in a different language. ...

Drawing a PNG Image Into a Graphics Context for Blending Mode Manipulation

I need to draw a series of PNGs into a CG context so I can blend them together: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetBlendMode (context, kCGBlendModeOverlay); Currently I have my app working based on just drawing each image as a UIImageView and adding them as a subview to the view file via: [self addSubview...