NSImage drawing woes
NSImage drawing woes
- Subject: NSImage drawing woes
- From: "cocoa dev" <email@hidden>
- Date: Sat, 03 Jan 2004 20:34:44 -0800
List,
Although I have searched the documentation, and archives, a point in the
right direction (RTFM, so long as it is a specific section) would be
considered a valuable response :-)
The real pain here is that I at one point had this working, but scrapped
that project as it got too cluttered / obscure.
I'm simply trying to draw an NSImage at an arbitrary point, using
drawAtPoint: or compositeToPoint:
Conceptually, it seems fairly straight forward : I create an NSImageView
(have also tried an NSView) in Interface Builder and add it as an outlet to
my controller. I then create an NSImage, and herein lies the even more
baffling part to me. Upon debugging, the image has NO size, and yet
[myImageView setImage:theImage] works perfectly. however, drawAtPoint and
compositeToPoint have absolutely no effect.
If I am missing something conceptually, show me the error of my ways. If I
am just doing something wrong, please help me to understand why AND how to
fix it :-)) Relevant code follows;
NSString *theStr = @"users/me/test.jpg";
NSImage *theImage = [[NSImage alloc] initWithContentsOfFile:theStr];
/*************
Image has NO size here
**************/
[myImageView setImage:theImage]; //Works, but I would like to draw at a
point I decide
/******** Following has No Effect *******/
[myImageView lockFocus];
[theImage drawAtPoint: NSZeroPoint
fromRect:NSMakeRect(0,0,50,50) // hard coded values here because
theImage has no size
operation:NSCompositeSourceOver
fraction: 1.0];
[myImageView unlockFocus];
Please guide me to see where I went astray. What was it I was doing before
that worked?
Note: I do not know the relevance, but xCode has required a lot more
"Clean"ing lately to resolve very odd errors...
Many Thanks
ACS
_________________________________________________________________
Take advantage of our limited-time introductory offer for dial-up Internet
access.
http://join.msn.com/?page=dept/dialup
_______________________________________________
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.