Re: Help with pixellated NSTIFFRepresentation issues much appreciated
Re: Help with pixellated NSTIFFRepresentation issues much appreciated
- Subject: Re: Help with pixellated NSTIFFRepresentation issues much appreciated
- From: Aaron Fothergill <email@hidden>
- Date: Tue, 12 Oct 2004 20:46:28 +0100
Are you using NSImage setScalesWhenResized by any chance ? If so, you
probably don't need to (drawInRect: fromRect: etc. does a non permanent
resize of the graphic when it's used without scalesWhenResized). If
setScalesWhenResized is on, whenever your graphic is redrawn at any
size, the graphical data for it is resampled at that size. So if you
draw it small at any point, you end up with a lower resolution image as
your source.
Aaron
_____________________________
Aaron Fothergill : MD / Lead Coder
Strange Flavour Ltd
email@hidden
http://www.strangeflavour.com
On 12 Oct 2004, at 20:39, Keith Blount wrote:
Many thanks again for the reply and help.
Unfortunately, I tried this and it didn't work either
- there was no change.
I tried a different tack which had some minor success.
Everytime I zoomed the image, I created an
NSBitmapImageRep of the correct proportions (using
setPixelsWide and setPixelsHigh), and then created an
NSImage containing only this image rep (using
addRepresentation:). This was then the image that I
added to the pasteboard using TIFFRepresentation. This
method worked, but only properly with the original
image. That is to say, after starting the program with
an image in the image view, I could zoom the image to
the largest possible, then drag and drop it into the
text view correctly. I could then drag the image back
from the text view into the image view and zoom it
with no loss of quality. However, it would then only
zoom up so far before the image snapped back to the
size it was when originally dropped. So ultimately,
this method doesn't help much either...
I have thus decided to give up on this for now, as
this was only supposed to be a minor part of my
program (which is mainly a writing and outlining
program) and I have been bogged down with this problem
for nearly two weeks, and this idea was in itself a
compromise anyway. What I initially wanted was for the
user to be able to resize a picture within a textview
itself just as you can in Word or Nisus Writer Express
(click and drag on the image to resize), but had no
idea of how to go about this. So as I already had a
zooming image view, I thought I would be able to drag
and drop zoomed images between this and the text view
as an easier alternative. As it turns out that this is
actually no easier at all, I think I will just have to
put the whole resizing-of-images-for-text-views thing
on hold and come back to it later (though of course,
if anybody knows where I can find any examples/clues
on how to do this, it would be *hugely* appreciated).
Many thanks for all the help trying to get this idea
to work, though, I really do appreciate it. If I ever
figure it out, I will be sure to post the solution.
Keith
--- Robert Clair <email@hidden> wrote:
Sorry for my lack of clarity. Basically, if I just
use
[self image] to create the TIFFRepresentation, the
results seem random in that - for any image I
place
into the image view - when dragged to the text
view
the image may be completely unscaled, or it may be
scaled correctly, or it may be scaled but at a
previous scale (eg. not at the original size but
not
at the size the image is in the view, either).
Very
strange.
Let's try this from the top. I don't know what
NSImageView is doing,
I don't use them. But try this first - whenever you
create an image -
loading it from the file or from a pasteboard,
immediately do:
[whateverImage setScalesWhenResizes: YES];
[whateverImage setDataRetained: YES];
the setDataRetained: YES will keep NSImage from
replacing your
NSBitmapImageRep with a lower res NSCachedImageRep
then your original easy
[[self image] TIFFRepresentation];
should work.
......Bob Clair
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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
_______________________________________________
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