![]() |
|
Another newbie request. - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Game Programming Fundamentals (/forum-7.html) +--- Thread: Another newbie request. (/thread-3255.html) |
Another newbie request. - hypnotx - Jun 8, 2007 08:57 PM Can anyone point me to some sample code that illustrates: 1.) Drawing a partial segment of a source image (png) to an NSImageView 2.) Drawing a partial segment of a source image (png) to a Custom View Here is a little of what I am trying to get to work (using the NSImageView approach): Code: - (NSImage *)drawCardI am calling it with: Code: [nextCardImage setImage:[deck drawCard]];nextCardImage is an NSImageView Outlet. Thanks for any help. Another newbie request. - Taxxodium - Jun 9, 2007 01:13 AM You are leaking memory badly. Before returning, release cardSheet and at the end do return [card autorelease] Maybe it's better to use drawAtPoint or one of the composite methods. drawInRect is good, but you'll need to: a) read what the docs say b) experiment to get it right Another newbie request. - hypnotx - Jun 10, 2007 02:03 AM Still playing around with it but now using a Custom View. Came up with this after looking at the Quartz tutorials on Dev Central but it is still a work in progress. I most certainly need to reread the sections on memory management. I'm guessing that I can define an NSRect for the portion of the source image and pass that as the fromRect variable to drawInRect instead of NSZeroRect. I think I am almost there. Code: - (void)drawRect:(NSRect)rect |