Chapter Contents

Previous

Next
Image Data Model: _setTransparentColor

Image Data Model: _setTransparentColor



Sets a transparent color for an image object


Syntax
Details
Example

Syntax

CALL SEND (object-id, '_setTransparentColor'<, index>|<, red, green, blue>);

Argument Type Description
index N a value in the range 0...255 that is the index of the color that is being set to transparent; used only with an image of type CMAP
red, green, blue N the red, green, and blue values of the color that is being set to transparent; each value must be in the range 0...255; used only with an image of type RGBA


Details

If no arguments are passed to the _setTransparentColor method, transparency is turned off. Turning off transparency does not clear the transparency color settings and the values can still be obtained using _getTransparentColor. Writing out the image does not save the transparency values.

The _setTransparentColor method supports only RGBA and CMAP images. To determine if a color map index or a red-green-blue color value should be set, use the _getAttributes method to ascertain whether the TYPE value is RGBA or CMAP.

Only one transparent color can be set per image and the selected color must be a valid color in the image. If the color map index or red-green-blue color value set by the method is not used in the image, no error is returned and the image displays as if no transparent color had been set. Results are unpredictable if the image is scaled or color corrected.

Setting a transparent color also turns on the transparency for an image.

Note:   GIF images may have a transparency setting by default but this setting is not active until _setTransparentCOLOR is called using the the index value returned from _getTransparentCOLOR. (See the example for _getTransparentCOLOR.)  [cautionend]


Example

This example sets the transparent color based on the upper left corner of a color map image.

   /* Get the pixel value of the upper left
      corner of */
   /* the image and set it as the transparent
      color   */
call send (image_obj,  '_getPixel', 0, 0,
           index);
call send (image_obj,
         '_setTransparentColor', index);

   /* Display the image with the transparent
      color by    */
   /* attaching the image data model to the
      image object */
call notify('imageview1', '_attach',
             image_obj);


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.