Ask a Question related to Mac Programming, Design and Development.
-
Just #1
Drawing in an NSImage: how maintain resolution independence?
Here's what I'm trying to do:
- create an NSImage
- draw in it using NSBezierPaths
- draw it into a custom NSView
- then later I want to save the existing NSImage to a PDF file
I currently do the latter by sending dataWithPDFInsideRect: to the view.
But: I keep getting a bitmapped PDF, whereas I want a vector PDF. I've
been fiddling with representations and various image options
(setUsesEPSOnResolutionMismatch:, setPrefersColorMatch: and
setCacheMode:) to no avail. If I send bestRepresentationForDevice: nil
to the image I always get a chached bitmap representation and never an
NSPDFImageRep.
I've been trying to add an (empty) NSPDFImageRep to the image manually
and that doesn't help either. Then I googled and googled, but still
found nothing. Now, I've learned that if something seems hard with
Cocoa, I'm probably doing things the wrong way... Is there something I
overlooked? I'd really like to avoid creating the image twice, I want to
draw once, and use the image both on screen and in a resolution independ
way. Is that possible at all?
Feeling rather clueless today...
Just
Just Guest
-
Create PDF and maintain JPEG Resolution
I save JPEGs out of Photoshop CS2 at 17x11_150 dpi. When creating a PDF, Acrobat 7 converts these images to 35.42x22.92_72 dpi. Before upgrading to... -
Drawing in Flex? Drawing and AS for custom compon
Hey Peter, I just went to your site to check out your flex prototypes. They're pretty nice. I'm currently looking into developing something... -
What is the best way to maintain synchrony?
I am building an ASP.NET application. Everything is working, but I am not sure if I am doing things correctly. I have a datagrid bound to a... -
File independence and A whole website?
Thank you for your reply! What about the problem that if I want to add new pages, how exactly will this work?? do I just edit the library item and... -
How to reduce an image size and still maintain high resolution clarity?
Can you tell me how to reduce an image size and still maintain high resolution clarity? I have a small logo in one layer of a multiple layers... -
Per Bull Holmen #2
Re: Drawing in an NSImage: how maintain resolution independence?
Just <just@xs4all.nl> wrote:
Did you try...> I've been trying to add an (empty) NSPDFImageRep to the image manually
> and that doesn't help either.
- (void) lockFocusOnRepresentation: (NSImageRep *) imageRepresentation
....rather than just lockFocus? Just checking to make sure, but
unfortunately I think it will still create an NSCachedImageRep and draw
it into a bitmap. Also you may try an NSEPSImageRep, but I don't think
it will actually help. Sorry.... :(
Per
Per Bull Holmen Guest
-
Just #3
Re: Drawing in an NSImage: how maintain resolution independence?
In article <1g1ubir.1kmk9nt10ibj6iN%pbh_news@yahoo.com>,
[email]pbh_news@yahoo.com[/email] (Per Bull Holmen) wrote:
Thanks for the suggestion. It indeed doesn't seem to have any effect...> Just <just@xs4all.nl> wrote:
>>> > I've been trying to add an (empty) NSPDFImageRep to the image manually
> > and that doesn't help either.
> Did you try...
>
> - (void) lockFocusOnRepresentation: (NSImageRep *) imageRepresentation
>
> ...rather than just lockFocus? Just checking to make sure, but
> unfortunately I think it will still create an NSCachedImageRep and draw
> it into a bitmap. Also you may try an NSEPSImageRep, but I don't think
> it will actually help. Sorry.... :(
I'm creating an empty NSPDFImageRep with a new NSMutableData instance,
but that doesn't seem to be the right way to do it: the data remains
empty. It seems NSPDFImageRep is not meant to _create_ PDF data.
I've also been fighting with NSGraphicsContext, creating a PDF-based
context, but I haven't been able to invoke the right magic incantations
to get it to do what I want.
I guess the core question is: how do I make a vector-based PDF in Cocoa
from scratch?
Just
Just Guest
-
Per Bull Holmen #4
Re: Drawing in an NSImage: how maintain resolution independence?
Just <just@xs4all.nl> wrote:
I think you'll have to use CoreGraphics. Check out the documentation on> I guess the core question is: how do I make a vector-based PDF in Cocoa
> from scratch?
your HD (CoreTechnologies -> Quartz2D).
That is if you need to do it that way. Otherwise, make sure to draw with
the bezierpath inside drawRect.
Per
Per Bull Holmen Guest
-
Just #5
Re: Drawing in an NSImage: how maintain resolution independence?
In article <1g1uxcy.cp06fcxltwz8N%pbh_news@yahoo.com>,
[email]pbh_news@yahoo.com[/email] (Per Bull Holmen) wrote:
Yeah, that's what I'm doing now. Having worked with QD PICTs in the past>> > I guess the core question is: how do I make a vector-based PDF in Cocoa
> > from scratch?
> I think you'll have to use CoreGraphics. Check out the documentation on
> your HD (CoreTechnologies -> Quartz2D).
>
> That is if you need to do it that way. Otherwise, make sure to draw with
> the bezierpath inside drawRect.
(yuck!) I (probably mistakenly) thought/hoped NSImage could do vector
based image recording. I gave up on that, so I wrote my own recorder.
Luckily, no need to use CoreGraphics directly... Thanks for your help.
Just
Just Guest
-
Per Bull Holmen #6
Re: Drawing in an NSImage: how maintain resolution independence?
Just <just@xs4all.nl> wrote:
You're welcome.> In article <1g1uxcy.cp06fcxltwz8N%pbh_news@yahoo.com>,
> [email]pbh_news@yahoo.com[/email] (Per Bull Holmen) wrote:
>>> >> > > I guess the core question is: how do I make a vector-based PDF in Cocoa
> > > from scratch?
> > I think you'll have to use CoreGraphics. Check out the documentation on
> > your HD (CoreTechnologies -> Quartz2D).
> >
> > That is if you need to do it that way. Otherwise, make sure to draw with
> > the bezierpath inside drawRect.
> Yeah, that's what I'm doing now. Having worked with QD PICTs in the past
> (yuck!) I (probably mistakenly) thought/hoped NSImage could do vector
> based image recording. I gave up on that, so I wrote my own recorder.
> Luckily, no need to use CoreGraphics directly... Thanks for your help.
Too bad NSImage can't fix it, cause it's already implemented in
CoreGraphics. All it lacks is the object oriented wrapping in an
NSImage/NSPDFImageRep.
Per
Per Bull Holmen Guest



Reply With Quote

