Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version

mask-contents

Arguments: pixmap

Returns a value that specifies which pixels of a pixmap are transparent (if any). The value may be set either by calling (setf mask-contents) or by passing the :mask-contents initarg to make-instance when creating the pixmap.

pixmap should be a pixmap object. See cg-pixmaps.htm for an overview of pixmap functionality.

The value returned by mask-contents or passed to (setf mask-contents) is nil when the pixmap has no mask. Otherwise it is a list of lists, where each inner list represents a row of the pixmap and each member of an inner list represents a pixel in that row. Each row member should be 1 to make the pixmap transparent at that pixel, or 0 to make it opaque. In addition, each transparent pixel must have a 0 in the main texture of the pixmap.

The number of inner lists reflects the number of rows in the pixmap, and the number of members in each inner list (these should all be the same) reflect the number of columns. These sizes for the mask should match the sizes that were used to specify the main image via the contents or texture property.

The mask of a pixmap may alternately be specified either by passing a texture to (setf mask), or by calling generate-mask.

Example

Here is how Common Graphics makes the :default-leaf-with-mask pixmap, which is used by leaf nodes of outline widgets.

(cache-pixmap
 (make-instance 'pixmap
   :name :default-leaf-with-mask
   :contents
   '(( 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0)
     ( 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0)
     ( 0  0  0 15 15 15 15 15  0  0  0  0  0  0  0  0)
     ( 0  0  0 15 15 15 15 15  0 15  0  0  0  0  0  0)
     ( 0  0  0 15 15 15 15 15  0 15 15  0  0  0  0  0)
     ( 0  0  0 15 15 15 15 15  0 15 15 15  0  0  0  0)
     ( 0  0  0 15 15 15 15 15  0  0  0  0  0  0  0  0)
     ( 0  0  0 15 15 15 15 15 15 15 15 15 15  0  0  0)
     ( 0  0  0 15 15 15 15 15 15 15 15 15 15  0  0  0)
     ( 0  0  0 15 15 15 15 15 15 15 15 15 15  0  0  0)
     ( 0  0  0 15 15 15 15 15 15 15 15 15 15  0  0  0)
     ( 0  0  0 15 15 15 15 15 15 15 15 15 15  0  0  0)
     ( 0  0  0 15 15 15 15 15 15 15 15 15 15  0  0  0)
     ( 0  0  0 15 15 15 15 15 15 15 15 15 15  0  0  0)
     ( 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0)
     ( 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0))
   :mask-contents
   '((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)
     (1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1)
     (1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1)
     (1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1))))

mask-contents is a property of the pixmap and texture classes.


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

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version