开发者

finding rgb value of cut point of diagonal of rectangle in objective-c

开发者 https://www.devze.com 2022-12-17 05:09 出处:网络
I have to find the RGB of point wh开发者_运维百科ere two diagonals of a rectangle cut each other in objective-c.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消