• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Having problems drawing NSImage...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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] initWithData:[[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.

  • Prev by Date: Re: creating folders inside the main bundle
  • Next by Date: Re: Expand/Collapse Button in IB?
  • Previous by thread: Re: Expand/Collapse Button in IB?
  • Next by thread: Very odd program hang??
  • Index(es):
    • Date
    • Thread