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

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


  • Subject: Trying to print an nsimage... What am I doing wrong?
  • From: Jiva DeVoe <email@hidden>
  • Date: Sat, 20 Jul 2002 21:18:29 -0700

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.

  • Follow-Ups:
    • Re: Trying to print an nsimage... What am I doing wrong?
      • From: Scott Anguish <email@hidden>
  • Prev by Date: Re: [Q] How do I find out where a variable's type is getting changed?
  • Next by Date: Re: reading a plist
  • Previous by thread: Re: reading a plist
  • Next by thread: Re: Trying to print an nsimage... What am I doing wrong?
  • Index(es):
    • Date
    • Thread