Re: Extracting a (smooth) rect from an NSImageView displaying PDF?
Re: Extracting a (smooth) rect from an NSImageView displaying PDF?
- Subject: Re: Extracting a (smooth) rect from an NSImageView displaying PDF?
- From: Marco Binder <email@hidden>
- Date: Tue, 13 May 2003 20:37:07 +0200
Actually, the image displayed in the imageview IS a bitmap (chached
version of the PDF). I am afraid you have to draw the whole PDF at 10x
the size of MyImageView into an image and then clip the rect from
there. This way, you force the (new) NSImage to fetch the PDF data
again and render it at the enlarged size.
Greetings,
marco
Am Dienstag, 13.05.03 um 17:07 Uhr schrieb J. Mckenzie Alexander:
Hello,
In my app I have an NSImageView displaying a PDF file. I'd like the
user to
be able to extract a rectangular region from the displayed PDF and
view it
at 10x normal size.
MyImageView is a subclass of NSImageView, defined below (zoomImageView
is an
outlet to an NSImageView contained in a panel.)
The problem is that, although this *does* extract the rectangular
region
between mouseDown (the upper-left corner) and mouseUp (the lower-right
corner) and displays it in the zoomImageView, it's extremely jagged...
Almost as if the PDF data is merely a PDF wrapper containing the screen
bitmap. What do I need to do in order to get the "real" PDF data so
that I
can scale the region smoothly?
Thanks,
Jason
@implementation MyImageView
-(void)mouseDown:(NSEvent *)theEvent
{
downPoint = [self convertPoint: [theEvent locationInWindow]
fromView:
nil];
}
-(void) mouseUp: (NSEvent *)theEvent
{
upPoint = [self convertPoint: [theEvent locationInWindow] fromView:
nil];
NSImage *img =
[[NSImage alloc] initWithData:
[self dataWithPDFInsideRect: NSMakeRect( downPoint.x,
upPoint.y,
upPoint.x -
downPoint.x,
downPoint.y -
upPoint.y)]];
[zoomImageView setImage: img];
[img release];
[zoomPanel makeKeyAndOrderFront: self];
[zoomImageView setNeedsDisplay: YES];
}
@end
_______________________________________________
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.
--
|\ /| email@hidden
http://www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
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.