gnustep-dev
[Top][All Lists]
Advanced

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

Re: XPM support for NSImage


From: Fred Kiefer
Subject: Re: XPM support for NSImage
Date: Thu, 09 Nov 2006 00:17:30 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060911)

Richard Frith-Macdonald schrieb:
> 
> On 8 Nov 2006, at 07:31, Hubert Chan wrote:
> 
>> On Wed, 8 Nov 2006 06:30:11 +0000, Richard Frith-Macdonald
>> <address@hidden> said:
>>
>> [...]
>>
>>> I think what Fred probably intended was to have a lot of filter
>>> services available for different image file formats.  Then in the gui
>>> library have an NSImageRep subclass which would use any filter service
>>> as required.  That way, the only extra code in the gui library (and
>>> hence linked in to apps) would be the little bit letting the
>>> NSImageRep use filter services.  The gui package could install a set
>>> of image filters, but other packages/applications would also be able
>>> to supply more or better filters.  When the gui needs to convert from
>>> format A to B it would just ask the NSImageRep to do it, and that
>>> would automatically pick one of the available filters to perform the
>>> actual conversion.
>>
>> Ah, OK.  So the idea is to use the service to, say, convert an XPM to a
>> PPM, and use the PNM loading code that is already in gui.
> 
> Yes ... or PNG or TIFF etc.

I would expect that we use Tiff format here, as the library already
supports this (TIFFRepresentation).

> 
>> Sounds a bit
>> inefficient, but I guess it would allow us to reuse a lot of code from
>> netpbm (or maybe even just create a wrapper around the netpbm programs).
> 
> Yes.
> 
>> This would probably work for a simple bitmap format such as XPM, but it
>> probably wouldn't work so well for, say, SVG, where we would want to
>> keep all that vector goodness, or for PDF, where the Apple API includes
>> extra methods like -setCurrentPage:.
>>

We should not use this filter technique for formats where Apple uses
separate classes. For PDF we should create a class NSPDFImagerep and
even for SVG a separate class would be better. I was only suggesting
this idea for the bitmap formats, as we could easily end up supporting
dozens of them.

But again, for all this to work we (I ?) need to add support for image
filters to NSImageRep. The code for imageFileTypes and
imagePasteboardTypes should be fairly simple. Here we would use
[NSPastboard typesFilterableTo:]. But we also need to add filtering to
[NSBitmapImage imageRepsWithPasteboard:] and [NSBitmapImage
imageRepsWithContentsOfFile:]. And here I don't have a glue.

Cheers Fred




reply via email to

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