discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GWorkspace.app Feature Request-- Tabbed Shelf


From: Enrico Sersale
Subject: Re: GWorkspace.app Feature Request-- Tabbed Shelf
Date: Wed, 25 Jun 2003 13:12:21 +0300

On 2003-06-25 09:10:51 +0300 Nicolas Roard <nicolas@roard.com> wrote:

On 2003-06-24 22:55:28 +0000 Fred Kiefer <fredkiefer@gmx.de> wrote:

Hi Nicolas,

this doesn't sound like an evil hack, rather like a very nice idea that should 
make it into NSWorkspace. Please clean up that code and commit it.

Fred

Hm I just looked back on my hard disk but I think I don't have it anymore
(I changed of computer since I wrote that).
It was really a matter of a few lines, as it only looked if a file existed, and
tried to create a NSImage with it in order to return it (else the default 
NSImage
was returned).
The idea was simply to construct a file's path by adding a .tiff extension on 
it, and
modify the provided path (iconForFile:) to add a .thumbnail/ before it.   
NSWorkspace didn't had the responsability of creating the thumbnails, as I 
thought
it wasn't its duty at all (*bloat*). It should just return them if they exist.
So for my test I created "by hand" the thumbnails.
Ideally GWorkspace or other software could create automatically thoses 
thumbnails.
It should be good to use the freedesktop specs about thumbnails if possible.

Well, I'm writing the part that should create the thumbnails.
There are some problems:
We have two images, img1 read from the disk and img2 created with 
-initWithSize:.
To have a thumbnail sized image I do something like this (pratically it is a 
little more complex):

 [img1 setSize: newSize];
 [img2 lockFocus];
 [[NSColor clearColor] set];
 NSRectFill(NSMakeRect(0, 0, 48,48);
 [img1 drawInRect: targetRect];
 [img2 unlockFocus];

now img2 is a 48x48 copy of img1.
The problem is that this new image can be displayed but can't be saved, it has 
only a NSCacheImageRep, not a NSBitmapImageRep, and I've not access to its data 
(with -TIFFRepresentation, for example).
Theorically there is a NSBitmapImageRep method, -initWithFocusedViewRect:, that 
should let me do something like this:

 NSBitmapImageRep *rep;
 NSData *data;

 [img2 lockFocus];
 rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect: NSMakeRect(0, 0, 48, 
48)];
 [img2 unlockFocus];
  data = [rep TIFFRepresentation];
 etc., etc., etc.

But -initWithFocusedViewRect: is not implemented in GNUstep.
Somebody can suggest an alternative?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]