On 11/04/2011, at 11:33 AM, Eric Gorr wrote:

> Hummm...I can't seem to get it to do much. If I alter the code to:


Have you tried using NSAffineTransform to offset the coordinate system to where 
you want to draw? You probably don't need or want to mess with your view 
coordinates or frame, you just need to move the coordinate system around within 
the view using the CTM.

e.g. if you want to highlight the rect <hr> (typed into mail, untested):

NSRect hr = NSMakeRect( 100, 100, 200, 120 );

[NSGraphicsContext saveGraphicsState];

NSAffineTransform* tfm = [NSAffineTransform transform];
[tfm translateXBy:hr.origin.x yBy:hr.origin.y];
[tfm concat];

hr.origin = NSZeroPoint;

NSRectFill( hr );

[NSGraphicsContext restoreGraphicsState];



So you offset to the rect origin, then draw at 0,0. 

--Graham


_______________________________________________

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

Reply via email to