quartz-graphics

Scaling up iPhone "vector-based graphics" on affine transforms

I made a "Circle" view with this drawRect - (void)drawRect:(CGRect)rect { CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(ctx, color.CGColor); CGContextAddEllipseInRect(ctx, rect); CGContextFillPath(ctx); } When I try to scale the view up using CGAffineTransformMakeScale(2.0, 2.0), th...

What framework/library to use for custom animated controls

We are making an app whose primary purpose is to display data, but we want to do so in a rich way. Our design includes several custom controls. For example, one control will be a wheel the user can spin to pick a time of day. You see an entire circle - a disk - that has time values going out like spokes from the center. It needs to spin...

iPhone Quartz 2d development using C++?

Could I write c++ code that interacts with the iPhone Quartz 2D framework, or can I only using objective-c? Thanks ...

iPhone context: How do i extract palette information from an image?

Hi everybody: i want to take a picture and retrieve the main color analyzing its palette (i think this should be the easiest way), but i don't know really where to start. ...

MKAnnotationView disappearing on swipe and double-tap zoom

I have subclassed MKAnnotationView to create an annotation that basically draws a circle around a point on a map view through override of drawRect. The circle draws fine in the following situations (in the simulator): On initial load of the map view On swipe, but only when swipe motion is stopped before touch ends (so that map doesn't...

How to Draw some sample images on the iPhone?

I just want draw some simples circle on the iPhone, I think it is too complex to using openGL doing this sample job, but I find that the UIB don't have something like canvas, any suggestion on drawing sample images on iPhone? thx a lot. ...

Why I can't draw something on my UIView?

This is my Main View, I just want it draw some thing to test, but I find that my UI don't have any thing, here is the code: - (void)viewDidLoad { [super viewDidLoad]; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor redColor].C...

iPhone SDK Quartz Glyph Drawing

I am trying to render font glyphs at a specific point with some precision, and am having quite a bit of trouble with it. To begin with, the Text Position Y value never changes, so I cannot get the glyph's height at all. For example, in the following code, the assertion always fires: CGContextSelectFont(g, "Arial", 32.0f, kCGEncoding...

iPhone Quartz 2D: CGContextSetLineJoin equivalent for CGMutablePathRef?

Hi, What is the CGMutablePathRef equivalent of CGContextSetLineJoin? CGContextSetLineJoin works directly on the graphics context, so requires a CGContextRef parameter, which I do not have since I'm working with CGMutablePathRef. I can't find anything in CGPath.h that does CGContextSetLineJoin's job. Thank you. ...

How do I clip or change alpha of an image (pixels) in Quartz?

Hi, I'm working on making an iPhone App where there are two ImageViews and when you touch the top one, wherever you tapped, the bottom one shows instead. Basically what I want to do is cut an ellipse/roundedrect out of an image. To do this I was thinking on either clipping the image, or changing the alpha pixels in the rect to zero. I a...

Pixel color replacement working fine on simulator but not on iPhone

Hi, I am dealing with an iphone application which would choose a specific colored pixel from the image and replace it with some other color shades i choose from color menu. Problem is that the code i have implemented is working fine on simulator, but when i run the same code on device all i get is that, the image's pixels are replaced b...

Custom UILabel does not show text.

Hi! I've made an custom UILabel class in which i draw a red line at the bottom of the frame. The red line is showing but i cant get the text to show. #import <UIKit/UIKit.h> @interface LetterLabel : UILabel { } @end #import "LetterLabel.h" @implementation LetterLabel - (id)initWithFrame:(CGRect)frame { if (self = [sup...

Nested CALayers not picking up perspective tranform

Hi, I'm trying to make use of CALayers to create a 3D style effect in one of my applications. However, it seems that nested CALayers do not have perspective applied to them. To illustrate with pseudo-code, if I have a layer with perspective applied like so: CATransform3D subLayerTransform = CATransform3DIdentity; /* set perspective */...

Do I have a memory management problem in here?

Something must be wrong with this code right here: + (UIImage*)captureView:(UIView *)theView { UIGraphicsBeginImageContext(theView.frame.size); [theView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; ...

Build a nice progress bar

Hi, I need some inspiration on how to build a nice progress bar for the iPhone. What I want to build is a custom progress bar, as I've drawn here: My approach up to now is to use a PNG (gray in the figure above) with a transparent rounded rectangle. Through this rectangle, users see the moving bar. It would be nice to draw this bar ...

How to create a screen that let user to draw a 'sketch' through finger touch?

Hi I am developing an app which will let users to 'draw' on screen via finger touch - so basically users can write, draw shapes - similar to a white board. The problem is I am a newbie as far as iphone graphics programming is concerned, I would highly appreciate if community here provide some sample code link or suggest a direction as w...

Quartz compositions created in Snow Leopard (10.6) doesn't work in Leopard (10.5) despite testing in runtime

Hi I have a reasonably advanced (many patches and subpatches) quartz composition that was created in Snow Leopard but doesn't run well (many elements are not rendered) in Leopard. The composition tested OK via Quartz Composer's Test in Runtime option and works fine for both Leopard 32-bits and Leopard 64-bits (menu item "File | Test in...

How to draw an animatable ruler with Quartz2D?

I'd like to draw the lines of a simple ruler with Quartz2D, just for practice. Since I have no idea about doing vector graphics programmatically on the iPhone, maybe someone can point me to a good tutorial to get started? ...

Arc text in iphone application

Hi all I want to bend the text that of UILabel from corner. It just like appear as arc or as following link. http://picasaweb.google.com/lh/photo/kfBzK4R4IlvyHfVywUNd1A?feat=directlink please suggest me, from where i start. any documentation,link, sample code. thanks amit battan ...

How do I draw lines and rectangles on the iPhone?

I would like to draw a line and rectangle in my iPhone application, for that i want to used structure concept to draw line and rectangle.In strut shall i want to be struct line { float X1; float Y1; float X2; float Y3; color of line draw line function }; And similarly in case of rectangle. struct rect { float left X1; float top Y1; flo...