• 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
Extracting a (smooth) rect from an NSImageView displaying PDF?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extracting a (smooth) rect from an NSImageView displaying PDF?


  • Subject: Extracting a (smooth) rect from an NSImageView displaying PDF?
  • From: "J. Mckenzie Alexander" <email@hidden>
  • Date: Tue, 13 May 2003 16:07:09 +0100

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.

  • Follow-Ups:
    • Re: Extracting a (smooth) rect from an NSImageView displaying PDF?
      • From: Marco Binder <email@hidden>
  • Prev by Date: iTangram
  • Next by Date: Re: NSTableView, file promises, and the message queue
  • Previous by thread: iTangram
  • Next by thread: Re: Extracting a (smooth) rect from an NSImageView displaying PDF?
  • Index(es):
    • Date
    • Thread