Having problems drawing NSImage...
Having problems drawing NSImage...
- Subject: Having problems drawing NSImage...
- From: Jiva DeVoe <email@hidden>
- Date: Sun, 21 Jul 2002 15:09:09 -0700
So I'm still having trouble drawing an NSImage into a view... Here's some
code:
NSRect srcRect;
NSRect picRect;
NSImage *pic = [[NSImage alloc] initWith
Data:[[person
getPicList] objectAtIndex:[person primaryPicIndex]]];
[pic setScalesWhenResized:YES];
picRect = [self rectForPicture:pic personIndex:n];
[pic setSize:picRect.size];
srcRect.origin.x = 0.0;
srcRect.origin.y = 0.0;
srcRect.size = [pic size];
[pic drawInRect:picRect fromRect:srcRect operation:nil
fraction:0];
[[NSColor greenColor] set];
[NSBezierPath fillRect:picRect];
So what this should do is draw the picture, then put a green square on top
of it right? Well here's the weird part... The green square gets drawn
exactly where I expect it to, but the pictures get drawn at the bottom of
the page! What gives? I am using the exact same rect for both the square
and the picture, yet they don't get drawn in the same place! Someone help
please! I've been staring at this code for 2 days without getting anywhere!
BTW, I am drawing the green square really just to show the rect and where it
is. Once I figure out why the pics aren't drawing in the right place, I'll
take that out, cuz ultimately, I just want the pics there.
_______________________________________________
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.