Re: Resizing an image inside a text view
Re: Resizing an image inside a text view
- Subject: Re: Resizing an image inside a text view
- From: Keith Blount <email@hidden>
- Date: Mon, 29 Nov 2004 12:10:26 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Many thanks to you and Ryan for taking the time to
answer. Your help has got me most of the way - the
image is now updated properly, and I'm using the
non-destructive method you suggest - thanks!
The only part I'm struggling on is this:
> Yes, it also uses the original size when copying the
> textView.
> This is because for these operations the data from
> the
> attachments fileWrapper is used.
> And these data are still not changed. Create a new
> fileWrapper
> with the scaled imageReps (not the scaled image!)
> and replace
> the attachment.
>
No matter what I try, I cannot figure this out. I
think my problem is that I'm not sure how to scale an
imageRep, and I can't find this info in the docs. I've
been trying this:
NSSize s = [image size];
s.width *= 2;
s.height *= 2;
[image setSize:s];
NSImage *newImage = [[NSImage alloc] initWithSize:s];
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
initWithData:[image TIFFRepresentation]];
[rep setSize:s];
[newImage addRepresentation:rep];
[cell setImage:newImage];
...among many other things, but I just cannot get the
image to stay the same size after dragging and
dropping - I would have thought that this would change
the data, but it doesn't. I have tried creating a new
text attachment and putting the new image into that,
but it still doesn't work. My problem is that I don't
understand how to scale an imageRep, whether that is
destructive to an image, and how to create a new image
with that rep that also contains all the original
data, I guess. For instance, the docs say that the
TIFF fields ImageLength and ImageWidth set the size of
an imageRep, but I can't find anywhere how to
manipulate these fields...
Many thanks for the help so far, and to anybody with a
few pointers on how I could achieve this last part I
would be very grateful.
Thanks and all the best,
Keith
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.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