Drawing an arc fill inside an image

2011-05-26 Thread Alex Kac
I'm not sure what the best way to tackle this is... so I thought I'd ask here. 
I have an image with a circular button inside of it. I'd like to dynamically 
fill this button in an arc to show progress much like how when you are on 
iTunes Store on an iOS and its playing the preview its animating filling the 
circle in a sweep of an arc. Mine doesn't need to animate however.

So I have the image, and I suppose I can draw that image to a context and then 
draw an arc on that image, and then make another image out of it. That seems 
like it would get slow if I needed to do that a lot. Any suggestions? I also 
wouldn't mind any links that might show similar code. This is for iOS. I tried 
searching Google, but my GoogleFu is not showing anything, probably due to me 
not using the right terms.

Thanks in advance.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing an arc fill inside an image

2011-05-26 Thread Jens Alfke

On May 26, 2011, at 11:21 AM, Alex Kac wrote:

 So I have the image, and I suppose I can draw that image to a context and 
 then draw an arc on that image, and then make another image out of it. That 
 seems like it would get slow if I needed to do that a lot.


No need to make a new image. Just draw directly into the original one:

[image lockFocus];
…draw stuff…
[image unlockFocus];

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing an arc fill inside an image

2011-05-26 Thread Steve Christensen
Custom view that sits on top of a UIImageView? Implement -drawRect: and a 
progress property and you're done.


On May 26, 2011, at 11:21 AM, Alex Kac wrote:

 I'm not sure what the best way to tackle this is... so I thought I'd ask 
 here. I have an image with a circular button inside of it. I'd like to 
 dynamically fill this button in an arc to show progress much like how when 
 you are on iTunes Store on an iOS and its playing the preview its animating 
 filling the circle in a sweep of an arc. Mine doesn't need to animate however.
 
 So I have the image, and I suppose I can draw that image to a context and 
 then draw an arc on that image, and then make another image out of it. That 
 seems like it would get slow if I needed to do that a lot. Any suggestions? I 
 also wouldn't mind any links that might show similar code. This is for iOS. I 
 tried searching Google, but my GoogleFu is not showing anything, probably due 
 to me not using the right terms.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing an arc fill inside an image

2011-05-26 Thread Conrad Shultz
The OP wants a solution for iOS. lock/unlockFocus only exist in NSView, not 
UIView. 

FWIW, I think you (that is, the OP) should start with the simplest solution 
available (e.g. Steve's suggestion), test performance, and only optimize if 
needed. Don't try to optimize if it's not actually required!

--
Conrad Shultz
www.synthetiqsolutions.com

On May 26, 2011, at 11:40, Jens Alfke j...@mooseyard.com wrote:
 [image lockFocus];
 …draw stuff…
 [image unlockFocus];

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing an arc fill inside an image

2011-05-26 Thread Alex Kac
Sure, I get the idea of only optimizing if needed. That said, experience (15 
years) tells me very strongly that if I know that X will be slow and Y will be 
fast and either way works properly, I'd probably choose Y. So I prefer to stand 
on the shoulders of giants where possible. I've got a working solution - thanks 
guys!

On May 26, 2011, at 2:46 PM, Conrad Shultz wrote:

 The OP wants a solution for iOS. lock/unlockFocus only exist in NSView, not 
 UIView. 
 
 FWIW, I think you (that is, the OP) should start with the simplest solution 
 available (e.g. Steve's suggestion), test performance, and only optimize if 
 needed. Don't try to optimize if it's not actually required!
 
 --
 Conrad Shultz
 www.synthetiqsolutions.com
 
 On May 26, 2011, at 11:40, Jens Alfke j...@mooseyard.com wrote:
 [image lockFocus];
 …draw stuff…
 [image unlockFocus];
 

Alex Kac - President and Founder
Web Information Solutions, Inc.

Patience is the companion of wisdom.
--Anonymous




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com