Generic assets

You should consider using generic variants in an image policy when you have a large number of variants to identify for particular devices, and the cost of doing so at design time is high.

You should consider using generic variants in an image policy when you have a large number of variants to identify for particular devices, and the cost of doing so at design time is high.

MCS searches for a variant with properties that make it suitable. For image variants, the decision is based on encoding, pixel depth, rendering and image size.

Image variants

When processing an image policy, MCS searches the repository for a variant which is targeted at the device currently in use. If there is no match, MCS searches for variants targeted at categories, and then for variants that match the parent of the current device in the device tree. This search continues up the hierarchy until either a variant is found, or MCS reaches the root of the device tree. If no match is found, then the default variant is used. If the default variant is not specified, then MCS searches generic variants. The following rules apply:

  1. Encoding must be supported by the device

  2. Width in Pixels, or Width Hint percent in pixels, must be no wider than device width

  3. Pixel Depth should be less than or equal to that of the device unless
    • Encoding is BMP, GIF, JPEG or PNG

    • No other variant has a pixel depth within the device capability

    • The only other image variant has a depth of 1, and the device has a depth greater than 1. This rule favors color and grayscale images where the only alternative is monochrome.

  4. The rendering field of the image variant should match that of the device unless
    • Encoding is one of BMP, GIF, JPEG or PNG

    • There is no other variant with a Rendering that matches the device color capability

  5. When multiple variants are equally applicable the choice is made based on the pixel depth

    • If it is <= 8, the preference order is PNG, GIF, JPEG

    • If it is > 8, the order is JPEG, PNG, GIF

    Please note that the assets with alpha channel transparency are preferred over the assets without alpha channel transparency.

Related topics