Question about aliasing (analog clock hands)
Question about aliasing (analog clock hands)
- Subject: Question about aliasing (analog clock hands)
- From: "Eric E. Dolecki" <email@hidden>
- Date: Thu, 3 Dec 2009 14:24:31 -0500
I have 2 UIImageView, each containing a PNG (about 2 pixels wide for the
images). When I rotate these around, the edges of the PNGs look terrible and
I was trying to get MORE anti-aliasing to happen to smooth out the jaggies.
hourHand.layer.anchorPoint = CGPointMake( 0.0, 0.9 );
*//TOTAL GUESS, no idea, trying to get one hand to look good:*
hourHand.layer.edgeAntialiasingMask = 0xf;
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |
NSDayCalendarUnit | NSHourCalendarUnit| NSMinuteCalendarUnit
|NSSecondCalendarUnit;
NSDate *date = [NSDate date];
NSDateComponents *comps = [gregorian components:unitFlags fromDate:date];
int h = [comps hour];
int m = [comps minute];
int s = [comps second];
CGAffineTransform cgaRotateHr =
CGAffineTransformMakeRotation(DEGREES_TO_RADIANS( h*30+m/2 ));
CGAffineTransform cgaRotateMin =
CGAffineTransformMakeRotation(DEGREES_TO_RADIANS( m*6+s/10 ));
[hourHand setTransform:cgaRotateHr];
[minuteHand setTransform:cgaRotateMin];;
I have seen plenty of analog clocks on the iPhone that look great - since
I'm pretty new to dev on the platform I'm wondering if I am missing a simple
one-liner someplace.
I really don't know if this is the correct approach - should I be using some
more complex way of displaying and rotating hands on an analog clock?
- Eric
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden