private void ApplyOpacity(LayerPropertiesModel properties, float percentage)
{
properties.Opacity = percentage*(float) properties.Opacity;
if (properties.Opacity < 0.0)
properties.Opacity = 0.0;
if (properties.Opacity > 1.0)
properties.Opacity = 1.0;
// Apply the inverse/decrease option
if (LayerPropertyOptions == LayerPropertyOptions.Decrease)
properties.Opacity = 1.0 - properties.Opacity;
var brush = properties.Brush.Clone();
brush.Opacity = properties.Opacity;
properties.Brush = brush;
}