Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Moderate update since 9.0 release. 8.2 version

## load-pixmap

Arguments: pathname &key name pixmap-to-return (icon-index 0) make-unique-name

Reads a pixmap from any device-independent bitmap file. These are typically .bmp files. You can also load .ico (icon) files on Windows, or X bitmap files on GTK (but see note about GTK on the Mac below).

The arguments are:

- pathname: a pathname or path namestring naming the file from which to load the pixmap. The file should be either a .bmp (Windows bitmap), .ico (icon) or .cur (mouse cursor) file. An error is signaled if this file does not exist or if its contents are not in the standard format of one of the valid types of files.
- name: a symbol that will be used for the name of the pixmap. This symbol may be used in later calls to find-pixmap (if the pixmap is first cached by calling cache-pixmap), and appears in the print name of the pixmap. If `nil`, a unique symbol based on the name of the file from which the pixmap was loaded is created and used for the name.
- pixmap-to-return: either `nil` or an existing pixmap object to re-use. If `nil`, a new pixmap object is created and returned. If a pixmap, the pixmap is "filled in" with the information read from the file and then returned. This argument may be useful for updating a pixmap object from an edited (or alternate) file while keeping the pixmap eq to the former version of it.
- icon-index: a non-negative integer indicating which icon to read from a .ico icon file, where zero indicates the first icon. The default is zero. This argument applies only if pathname names a .ico icon file, and will be ignored if pathname names a .bmp pixmap file.
- make-unique-name: if true, ensures that the name for the pixmap (typically taken from the filename) is not already in use as the name of a cached pixmap.

This function returns the loaded pixmap.

See also save-pixmap (which creates .bmp files) and load-lisp-pixmap (which loads a Lisp file which will recreate a pixmap). cg-pixmaps.htm discusses pixmaps in general.

### Issue with locad-pixmap and GTM on Macs

There is a known but unsolved problem with load-pixmap on the Mac. On the GTK platforms (Linux and Mac), load-pixmap simply passes the pixmap file path to a single GTK function, and GTK does all the work. But it seems to fail on the Mac even for pixmaps where it works on Linux. We suspect that something in the substrate of GTK on the Mac is not supporting this GTK function properly.

One possible workaround is to create pixmaps from Lisp arrays of pixel values, as described in cg-pixmaps.htm. But note if you're starting with BMP files, the only way to use that approach would be to use the function import-pixmaps on a Linux or Windows machine that is able to load the BMP files, and then take the file of Lisp source code that it writes over to your application on the Mac and load the Lisp file there. When building a standalone application, if you load the Lisp file at build time then the pixmaps will be built into the image file and so will not need to be loaded from separate files at run time.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Moderate update since 9.0 release. 8.2 version