Define a meter to be used as a "container" for the "contents" of this meter.
The intent of this is two-fold:
- A meter that has a Container option will in effect be put "inside" the container meter. It will be positioned relative to the container, and will be visibly constrained by it. Only the part of the content that is "inside" the container will be drawn.
Think sliding content, a menu or launcher for instance, into view without needing to start outside the entire skin.
- The content will be "masked" into any solid pixels in the container meter. So only the part of the content that is masked into a solid pixel in the container will be drawn.
Think masking an image into a String meter, or an image into a Shape meter.
Any "content" meter(s) will be positioned relative to the "container", and the content will only be drawn on solid pixels of the container. Any content that is positioned outside the container, or that is on a transparent pixel in the container, will not be drawn. Content outside the container is truncated, and in effect doesn't exist. It will not impact the size of the skin.
Any meter type can be a "container" and any meter type can be "content".
Any meter name
Name of a meter, of any type, to be used as a container for the content of this meter
- Meters that are "content" meters, that have the
Containeroption on them, are positioned relative to the starting X and Y of the meter being used as a "container". Any X and Y on the first content meter in a container will in effect use the "r" relative positioning option, relative to their container. No actual "r" option is needed.
- Meters that are "content" meters, and follow other content meters in a container, will be relative to each other. In this case, use the "r" and "R" options to position them relative to each other, as you normally would.
- Meters that follow "content" meters, but are NOT content themselves, that have no Container option on them, will be relative to the last preceding meter that is not "content".
- A meter being used as a "container" will NOT be drawn itself. In a sense, it is just the "shape" of its solid pixels that is being used. If you want the container meter itself to be visible, you will need to create a copy of the meter, not used as a container.
- Any transparency on both the "container" and "content" meters will be taken into account. In effect they will both be "subtracted" from the opacity of the final result.
Although container meters are not drawn, everything else about them plays a role. The position, size, and opacity of the container are all factors in how the "content" is treated when placed in the container. If a pixel in the container is fully transparent, any pixel from the "content" placed there will also be fully transparent. That is the key to how the "masking" is done.
- A "content" meter may NOT also be a "container" meter. In other words, you cannot "nest" containers inside of containers.
While the example code here is for two simple skins that demonstrate using
Container, you can download a suite of skins demonstrating several ways to use the funtionality.
Sliding a "content" meter in and out of a "container" meter.
Masking an image "content" meter into a string "container" meter.