I am interested how does iPhone built in photos app changes the clock's color when I previewing an image as a wallpaper. I have been searching for 2 days but no success. I understand that the method should analyze pixel's color behind the label. But going through each pixel seems to be inefficient. Could somebody guide me through this?
Asked
Active
Viewed 731 times
0
-
How does clock's color changes? Could you please elaborate a bit, for instance by uploading a snapshot? – Munahil Aug 06 '15 at 09:18
-
What's behind the label? Is it a UIImageView? This talks about how to get RGB from a UIImage at specific pixel positions. http://stackoverflow.com/questions/448125/how-to-get-pixel-data-from-a-uiimage-cocoa-touch-or-cgimage-core-graphics – mxs Aug 06 '15 at 09:19
-
@Munahil It changes dynamically. When you drag a photo and something too bright appears behind the label turns to black, otherwise white. I don't have the phone right now. – efimovdk Aug 06 '15 at 09:27
-
@MikeStrand suppose I got those RGBA values but what's next? – efimovdk Aug 06 '15 at 09:28
-
You would programmatically set the label text color with something like http://stackoverflow.com/questions/2532409/can-not-change-uilabel-text-color – mxs Aug 06 '15 at 09:33
-
@MikeStrand you didn't get the idea. I don't have just a point. I have a rectangle which is UILabel's frame. Thus, base on the color of the rect(which can consist of many colors), I need to setup label's color. The only reason I am asking this question is I want to know what to do. Should I calculate an average color or what and e.t.c – efimovdk Aug 06 '15 at 09:37
-
I guess it depends on the visual effect you want, but yeah - getting an average would be a good start and then picking something in contrast I'm guessing is what you want. https://github.com/mxcl/UIImageAverageColor/blob/master/UIImage%2BAverageColor.m – mxs Aug 06 '15 at 09:43
-
I think, you are looking for this: [color from background image][1] [1]: http://stackoverflow.com/questions/19456288/text-color-based-on-background-image – Bhanupriya Aug 06 '15 at 09:54