tags:

views:

27

answers:

1

I have to find the RGB of point where 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

A: 

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 GCRect instead of NSRect, and the related GC Function.

NSResponder