[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug #4749] GWorkspace thumbnail views are not correct
From: |
Enrico Sersale |
Subject: |
Re: [bug #4749] GWorkspace thumbnail views are not correct |
Date: |
Sun, 17 Aug 2003 21:28:59 +0300 |
On 2003-08-16 13:58:43 +0300 nobody@savannah.gnu.org wrote:
=================== BUG #4749: FULL BUG SNAPSHOT ===================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=4749&group_id=99
Submitted by: None Project: GNUstep
Submitted on: Sat 08/16/2003 at 06:58
Category: Application Severity: 5 - Major Bug
Group: Bug Resolution: None
Assigned to: None Status: Open
Summary: GWorkspace thumbnail views are not correct
Original Submission: When I thumbnail an image file in GWorkspace, the
resulting thumbnail does not adequately represent the original image.
I am running a CVS version of GWorkspace from 20030813 on NetBSD/i386.
While the thumbnail image might be considered attractive in an impressionist
way, the image cannot be used to identify the contents of the file.
This is an almost old problem, so let me give a little explication.
I wrote the thumbnailer Service keeping in mind that it had to be something
capable to generate thumbnails for many file types, not only for images.
The objects that generate the thumbnails are, or bundles, as the
ImageThumbnailer, or any application, tool, what you want, that registers
itself as a thumbnailer provider using the thumbnailer's
-registerExternalProvider: method.
This part (the most important) works well and I'm very glad of this :-)
Done this, I've written the only actually available bundle, that is, the
imageThumbnailer.
Theorically, this had to be very easy, doing something like this:
{
NSImage* bigImage = [[NSImage alloc] initWithContentsOfFile: path];
NSSize size = TMBSIZE;
NSImage* thumbImage = [[NSImage alloc] initWithSize: size];
NSBitmapImageRep* rep;
[bigImage setScalesWhenResized: YES];
[bigImage setSize: size];
[thumbImage lockFocus];
[bigImage compositeToPoint: NSZeroPoint operation: NSCompositeSourceOver];
rep = [[NSBitmapImageRep alloc]
initWithFocusedViewRect: NSMakeRect(0, 0, size.width,
size.height)];
[thumbImage unlockFocus];
RELEASE (bigImage);
RELEASE (thumbImage);
return (AUTORELEASE (rep));
}
But NSBitmapImageRep doesn't implement -initWithFocusedViewRect:, so, since I've had
already written the service itself, I've had to find a provvisional solution. The
solution was to "resize" the image data itself, using some methods taken from
ToyViewer.
Here, this seems to work with almost all the tiff ang jpeg files but has
problems with many xpm, png and gif files.
Anyway, I'm not going to try to fix this part of the code anymore, because I
think that the right way is to implement -initWithFocusedViewRect: in
NSBitmapImageRep.