Trying to print an nsimage... What am I doing wrong?
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] initWith
Data:[[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.