RE:EPS image in NSScrollView
RE:EPS image in NSScrollView
- Subject: RE:EPS image in NSScrollView
- From: <email@hidden>
- Date: Thu, 20 May 2010 20:43:25 +0000
- Sensitivity: Normal
One other quick question. What I'm really trying to achieve is something similar to how the pdfkit works. I like how the image/text enlarges within the scrollview when the window is resized. The code is pretty simple as well:
[pdfView setDocument:[[[PDFDocument alloc] initWithData:[fileMan contentsAtPath:filePath]] autorelease]];
[theBox setContentView:pdfView];
Is it possible to take an eps image and convert it to a pdf file so I can view it through the pdfkit?
Thanks.
Jay
--- Begin Message ---
- Subject: RE:EPS image in NSScrollView
- From: <email@hidden>
- Date: Thu, 20 May 2010 15:33:22 -0500
- Sensitivity: Normal
I'm getting a little closer to figuring this out, but hope that someone can
give me a little more info. I found some Apple documentation that shows how
to programatically create an image in a scrollview. Below, I've included the
code when the app starts up. I'd like to have the imageRect the same width as
the scrollView is, but I want the image inside it to remain proportional.
The next step I'd like to do is make the image larger when I resize the
window. Below, I'm experimenting with the 'windowDidResize' which works for
making the image 1.2 bigger, but I'm not sure how to make it work when
resizing larger then back to smaller. Would appreciate any thoughts.
Thanks.
Jay
------------------
theImage = [[NSImage alloc] initWithContentsOfFile:filePath];
imageWidth = [theImage size].width; // * 1.5;
imageHeight = [theImage size].height; // * 1.5;
imageRect = NSMakeRect(0.0, 0.0, imageWidth, imageHeight);
[theImageView setBounds:imageRect];
[theImageView setImageScaling:NSScaleToFit];
[theImageView setImage:theImage];
scrollView = [[NSScrollView alloc] initWithFrame:[[theBox contentView] frame]];
[scrollView setHasVerticalScroller:YES];
[scrollView setHasHorizontalScroller:YES];
[scrollView setBorderType:NSNoBorder];
[scrollView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scrollView setDocumentView:theImageView];
[theBox setContentView:scrollView];
------------------
------------------
- (void)windowDidResize:(NSNotification *)notification {
imageRect.size.width = imageWidth * 1.2;
imageRect.size.height = imageHeight * 1.2;
[theImageView setBounds:imageRect];
[theImageView setImageScaling:NSScaleToFit];
[theImageView setImage:theImage];
[scrollView setDocumentView:theImageView];
[scrollView setFrame:imageRect];
[theBox setContentView:scrollView];
[scrollView setNeedsDisplay:YES];
}
------------------
--- End Message ---
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden