RasterStyle

Description

A RasterStyle element defines a style for a raster image.

Context

Table 1 lists the elements that can contain, or be contained by, a RasterStyle element.

Table 1. Context
Contained by Element Contains

NamedStyle or CompositeStyle

RasterStyle

(empty)

Attributes

Table 2 lists the attributes of a RasterStyle element.

Table 2. Attributes
Attribute Description

id

A unique identifier for the element.

name

A descriptive name for the element.

contrast

A floating-point value from 0 to 1 specifying the contrast of the image.

A value of 0 means that the image has minimum contrast. A value of 1 means that the image has maximum contrast. A value of 0.5 means that the image has 50% contrast.

The contrast attribute is optional. The default value is 0.5.

brightness

A floating-point value from 0 to 1 specifying the brightness of the image.

Brightness is a measure of the lightness or darkness of the image. A value of 0 means that the image has minimum brightness. A value of 1 means that the image has maximum brightness. A value of 0.5 means that the image has 50% brightness.

The brightness attribute is optional. The default value is 0.5.

opacity

A floating-point value from 0 to 1 specifying the opacity of the image.

A value of 0 means that the image is totally transparent. A value of 1 means that the image is totally opaque. A value of 0.5 means that the image is 50% translucent.

The opacity attribute is optional. The default value is 1.

grayscale

A boolean value (true or false) specifying whether the image should be displayed using only shades of gray, ranging from white to black.

The grayscale attribute is optional. The default value is false.

transparent

A boolean value (true or false) specifying whether the color identified by transparent-color should be displayed with an opacity of 0 (transparent).

The transparent attribute is optional. The default value is false.

transparent-color

A string value specifying the color to be displayed with an opacity of 0 if transparent is set to true.

The value can be any valid CSS color. (See http://www.w3.org/TR/REC-CSS1#color-units.) The default color is black.

Example

This example specifies a raster image style that sets any red areas to transparent.

<?xml version="1.0" encoding="UTF-8"?>
<NamedStyle
    version="MXP_WorkSpace_1_5"
    xmlns="http://www.mapinfo.com/mxp">
    <RasterStyle
        id="mirasterstyle"
        name="mirasterstyle"
        contrast="0.5"
        brightness="0.5"
        opacity="1"
        grayscale="false"
        transparent="true"
        transparent-color="red"/>
</NamedStyle>