All Manuals > CAPI User Guide > 13 Graphics Ports > 13.9 Working with images

NextPrevUpTopContentsIndex

13.9.5 Loading images

To create an image object suitable for drawing on a given pane, use one of convert-external-image , read-and-convert-external-image , load-image , make-image-from-port , make-sub-image or (on Microsoft Windows) load-icon-image .

Images need to be freed after use. When the pane that an image was created for is destroyed, the image is freed automatically. However if you want to remove the image before the pane is destroyed, you must make an explicit call free-image . If the image is not freed, then a memory leak will occur.

Another way to create an image object is to supply a registered image identifier in a CAPI class that suports images. For example you can specify an image in a capi:image-pinboard-object . Then, an image object is created implicitly when the pinboard object is displayed and freed implicitly when the pinboard object is destroyed.

In all cases, the functions that create the image object require the pane to be already created. So if you are displaying the image when first displaying your window, take care to create the image object late enough, for example in the :create-callback of the interface or in the first :display-callback of the pane.


CAPI User Guide (Windows version) - 30 Aug 2011

NextPrevUpTopContentsIndex