Re: NSBezierPath
Re: NSBezierPath
- Subject: Re: NSBezierPath
- From: James Chen <email@hidden>
- Date: Mon, 1 Dec 2003 16:17:50 +0800
Hi,
try to send gaugeView the message lockFocus/lockFocusIfCanDraw before
your drawing code
and don't forget to send unlockFocus after your drawing code
if ([gaugeView lockFocusIfCanDraw]) {
// drawing code here
[gaugeView unlockFocus];
}
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On Dec 1, 2003, at 1:42 PM, Daniel Todd Currie wrote:
I'm trying to draw an NSBezierPath; I've looked over and borrowed code
from the Clock Control.app example, but I can find no other examples,
and the Clock Control example covers everything that I would like to
do.
Anyway, the following code isn't working (at all). This is currently
just a test method that should simply draw a line from the bottom left
corner to the top right corner. gaugeView is declared in my .h file
and is linked to an NSQuickDrawView in IB. I have verified that the
output of the NSLog is appropriate. Any help would be appreciated;
TIA!
- (void)drawNeedleForError:(NSNumber *)percentError
{
if(!percentError) { return; }
NSPoint needleBase, needleTip;
NSRect gaugeRect;
gaugeRect = [gaugeView frame];
NSLog(@"gaugeRect: %f, %f, %f, %f", gaugeRect.origin.x,
gaugeRect.origin.y, gaugeRect.size.width, gaugeRect.size.height);
needleBase = NSMakePoint(gaugeRect.origin.x, gaugeRect.origin.y);
needleTip = NSMakePoint(gaugeRect.origin.x + gaugeRect.size.width,
gaugeRect.origin.y + gaugeRect.size.height);
[[NSColor redColor] set];
[NSBezierPath setDefaultLineWidth:2.0];
[NSBezierPath strokeLineFromPoint:needleBase toPoint:needleTip];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.