Re: Copy Icon Data to clipboard
Re: Copy Icon Data to clipboard
- Subject: Re: Copy Icon Data to clipboard
- From: David Remahl <email@hidden>
- Date: Tue, 11 Feb 2003 17:14:55 +0100
Florian,
Icon data on the clipboard is not stored as TIFF. It is stored as
actual icns data.
The Cocoa wrapper for Icon Services, IconFamily has some functionality
to support putting and getting icons to/from the clipboard.
<
http://homepage.mac.com/troy_stephens/software/objects/IconFamily/
content.html>
@interface IconFamily (ScrapAdditions)
+ (BOOL) canInitWithScrap;
+ (IconFamily*) iconFamilyWithScrap;
- initWithScrap;
- (BOOL) putOnScrap;
@end
Oh, and please avoid cross-posting :-).
/ Regards, David Remahl
>
Hello,
>
>
i'm stuck with the following:
>
>
I have an NSImage of 128x128 pixels.
>
I would like to copy the image to the clipboard, so users can paste it
>
in the finder's info panel for a specific file.
>
I tried the following:
>
>
//Suppose i have an image ready, called image, with alpha information.
>
>
- (IBAction)putImageOnClipBoardAction:(id)sender
>
{
>
NSPasteboard *thePasteboard = [NSPasteboard generalPasteboard];
>
NSData *tiffData;
>
>
tiffData = [image TIFFRepresentation];
>
>
[thePasteboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType]
>
owner:nil];
>
[thePasteboard setData:tiffData forType:NSTIFFPboardType];
>
}
>
>
This works, except when the icon gets pasted onto a file, it has no
>
transparency.
>
The tiff data however, does contains alpha info.
>
>
I think i need NSPICTPboardType, but can't figure on how to obtain
>
this PICT data from my image.
>
>
Thanks in advance,
>
Flor.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.