I have to find the RGB of point wh开发者_运维百科ere two diagonals of a rectangle cut each other in objective-c.
more explanation of my requirements:
lets take a rectangular image draw two diagonal from the corner like we make cross. I need the RGB value of the cut point.
Regards
Satya
Here's how I'd do it on the Mac. With focus locked on the graphics context in question:
NSRect aRect;
NSPoint centerOfRect = NSMakePoint(NSMidX(aRect), NSMidY(aRect));
NSColor *aColor = NSReadPixel(centerOfRect);
If you're working on the iPhone, then you'll want to find the equivalent macros for CGRect instead of NSRect, and the related CG Function.
精彩评论