Reading in a Vector image (Adobe EPS), but displaying a Raster result (vs a scalable Vector Image). Why?
Reading in a Vector image (Adobe EPS), but displaying a Raster result (vs a scalable Vector Image). Why?
- Subject: Reading in a Vector image (Adobe EPS), but displaying a Raster result (vs a scalable Vector Image). Why?
- From: "Frederick C. Lee" <email@hidden>
- Date: Mon, 3 Oct 2005 12:09:36 -0700
Greetings:
First I wish to thank Shawn Erickson (Quartz-Dev) for putting me
on a productive path towards NSAffineTransform and pointing me
towards Cocoa vs Quartz Developers' forum.
I'll try to keep my problem simple and focus on one concern: I'm
reading a vector file and I'm getting a raster image.
When I attempt to re-scale via NSAffineTransform, I see raster, not a
scaled vector image I was expecting.
1) I'm trying to work with a vector image gleaned from either (Adobe
EPS/PDF) files.
My logic is as follows:
1) I'm reading EPS data into NSData via NSEPSImageRep (hoping to
preserve all the EPS - vector data that was generated from Adobe
Illustrator).
2) Adding the 'EPS data representation' to an NSImage variable.
2) Setting the NSImageView to point to NSImage containing the data.
- (void)processDataFile:(NSString *)dataFile {
NSLog(@"{processDataFile} dataFile= %@",dataFile);
NSError *epsError = nil;
NSData *epsData = [NSData dataWithContentsOfFile:dataFile
options:NSMappedRead error:&epsError];
if (epsError != nil) {
NSAlert *epsAlert = [NSAlert alertWithError:epsError];
[epsAlert runModal]; // Ignore user response
return;
}
NSEPSImageRep *epsImageRep = [NSEPSImageRep
imageRepWithData:epsData];
if (epsImageRep == nil) {
NSAlert *epsAlert = [[[NSAlert alloc] init] autorelease];
[epsAlert setMessageText:@"Sorry, Unable to glean EPS Image
from data."];
[epsAlert addButtonWithTitle:@"OK"];
[epsAlert runModal]; // Ignore user response
}
epsImage = [[NSImage alloc] init];
[epsImage addRepresentation:epsImageRep];
[epsImage setUsesEPSOnResolutionMismatch:YES];
[epsImage setScalesWhenResized: YES];
[imageView setImageScaling:NSScaleNone]; // Don't adjust the
image. Truncate if you must.
[imageView setImage:epsImage];
return;
}
Question: How can I keep my data as a vector image? Or, how do I
DISPLAY it as a vector-drawn image vs a raster?
Regards,
Ric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden