Drawing a view inside an image
Drawing a view inside an image
- Subject: Drawing a view inside an image
- From: Simone Manganelli <email@hidden>
- Date: Mon, 9 Dec 2002 13:12:23 -0800
How would one go about drawing the image of an NSView into an NSImage?
Specifically, I want to draw what a specific NSProgressIndicator looks
like into a specific NSImage, which I then want to use in my program.
How would one go about doing that? I've tried it using this code:
NSProgressIndicator *theProgressIndicator;
NSImage *theProgBarImage = [[NSImage alloc]
initWithSize:NSMakeSize(60,12)];
NSRect theRect = NSMakeRect(0,0,60,12);
[theProgBarImage lockFocus];
theProgressIndicator = [[NSProgressIndicator alloc] init];
[theProgressIndicator setFrame:theRect];
[theProgressIndicator setMaxValue:50];
[theProgressIndicator setDoubleValue:25];
[theProgressIndicator stopAnimation:nil];
[theProgressIndicator drawRect:theRect];
[theProgBarImage unlockFocus];
[theProgressIndicator release];
However, it doesn't seem to work. What am I doing wrong? This is my
first time using progress indicators and images in a programmatic way,
as opposed to laying out the progress indicators in Interface Builder
and simply manipulating their contents, so I'm not exactly sure how to
go about doing things.
-- Simone Manganelli
_______________________________________________
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.