PDA

View Full Version : Drawing Bezier curve,rectangle,Text




santoshgornal
Feb 26, 2009, 12:27 AM
Hi ALL,

In my application i want to draw Bezier curves which includes Drawing rectangle,Square,and text
i am using view Based template in iphone application please can any body provide details regarding this, i have used code

CGRect rect =CGRectMake(10,20,300,300);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextClearRect(ctx, rect);
CGContextSetRGBFillColor(ctx, 255, 0, 0, 1);
CGContextFillRect(ctx, CGRectMake(10, 10, 50, 50));
CGContextSetRGBFillColor(ctx, 0, 255, 0, 1);
CGContextFillEllipseInRect(ctx, CGRectMake(100, 100, 25, 25));

but its not drawing any thing on the screen, please any body provide tutorials from scratch to creat graphics.

thanks
santosh



Bakerman
Feb 26, 2009, 01:12 AM
At a glance I'm noticing that your arguments to CGContextSetRGBFillColor are off; this function accepts floating point numbers between 0.0 and 1.0.

kainjow
Feb 26, 2009, 06:38 AM
Also make sure you're putting this code in the drawRect: method.

santoshgornal
Feb 27, 2009, 04:31 AM
At a glance I'm noticing that your arguments to CGContextSetRGBFillColor are off; this function accepts floating point numbers between 0.0 and 1.0.

hi

ihave tried these things, but i am not getting please can u provide me working code for cococa touch

dejo
Feb 27, 2009, 09:10 AM
I'd suggest looking at the Quartz Demo sample app.