• 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
Re: Trying to print an nsimage... What am I doing wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to print an nsimage... What am I doing wrong?


  • Subject: Re: Trying to print an nsimage... What am I doing wrong?
  • From: Scott Anguish <email@hidden>
  • Date: Sun, 21 Jul 2002 02:39:03 -0400

the problem maybe that the image is not set to be able to scale on resize..

try inserting this after you create the image

[pic setScalesWhenResized:YES];

(hmm.. I think this might solve a problem I was having now that I've mentioned it...)

On Sunday, July 21, 2002, at 12:18 AM, Jiva DeVoe wrote:

I am trying to print an nsimage to a small rectangle on my page, but it
seems to only print it large. As I understand it, drawInRect was supposed
to scale the image for me, but it doesn9t seem to be working. Its a pdf, so
it should be scaleable... Here's my code that actually does the image
processing... What am I doing wrong?!?!?

if([picList count] > 0)
{
NSRect srcRect;
NSRect picRect;

NSSize imageSize;
NSSize scaledImageSize;
float scaleFactor;

NSImage *pic = [[NSImage alloc] initWithData:[[person
getPicList] objectAtIndex:[person primaryPicIndex]]];

picRect.origin.x = currentRect.origin.x;
picRect.size.width = currentRect.origin.x + 95.0;
imageSize = [pic size];

scaleFactor = picRect.size.width / imageSize.width;
picRect.size.height = imageSize.height * scaleFactor;
picRect.origin.y = currentRect.origin.y +
currentRect.size.height - picRect.size.height;
srcRect.size = [pic size];

[pic drawInRect:picRect fromRect:srcRect operation:nil
fraction:0];
}
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Trying to print an nsimage... What am I doing wrong? (From: Jiva DeVoe <email@hidden>)

  • Prev by Date: NSTextField with custom cell - is it even possible?
  • Next by Date: Re: Dificult question.
  • Previous by thread: Trying to print an nsimage... What am I doing wrong?
  • Next by thread: creating folders inside the main bundle
  • Index(es):
    • Date
    • Thread