• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Question about aliasing (analog clock hands)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Question about aliasing (analog clock hands)
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Lan/Airport Notification
  • Next by Date: Re: Does initWithCoder re-create observers made with addObserver?
  • Previous by thread: Set Continuous Feedback and Duration For UISlider:setValue:animated
  • Next by thread: Re: Question about aliasing (analog clock hands)
  • Index(es):
    • Date
    • Thread