E.2 Support for Reading Bitmap Files

CLIM implementations may supply some functions that read standard bitmap and pixmaps files. The following is the suggested API for such functionality. [annotate]

read-bitmap-file  type pathname &key  [Generic Function]

Reads a bitmap file of type type from the file named by pathname. type is a symbol that indicates what type of bitmap file is to be read. read-bitmap-file can eql-specialize on type. [annotate]

read-bitmap-file may take keyword arguments to provide further information to the method decoding the bitmap file. [annotate]

For example, a CLIM implementation might support an :x11 type. read-bitmap-file could take a format keyword argument, whose value can be either :bitmap or :pixmap. [annotate]

read-bitmap-file will return two values. The first is a 2-dimensional array of "pixel" values. The second is a sequence of CLIM colors (or nil if the result is a monochrome image). [annotate]



This proposed API is different from what clim2 (by Franz) and McCLIM implement (www.franz.com/support/documentation/6.0/doc/clim-ug.pdf, page 98). I'd render this extension proposal obsolete in favour of the implemented thing for a pragmatic reasons.

McCLIM also has an extension for adding new types with:

define-bitmap-file-reader type (pathname) &body body

[edit]-- Daniel Kochmanski 2016-06-09 14:15Z

make-pattern-from-bitmap-file  pathname &key type designs &allow-other-keys  [Function]

Reads the contents of the bitmap file pathname and creates a CLIM pattern object that represents the file. type is as for read-bitmap-file. [annotate]

designs is a sequence of CLIM designs (typically color objects) that will be used as the second argument in a call to make-pattern. designs must be supplied if no second value will be returned from read-bitmap-file. [annotate]

make-pattern-from-bitmap-file will pass any additional keyword arguments along to read-bitmap-file. [annotate]



Similar to the note above, but this function is almost compatible with the implemented prototype:

  pathname &key designs (format :bitmap))

[edit]-- Daniel Kochmanski 2018-08-16 13:47Z