Artemis.Profiles.Layers.Models.DynamicPropertiesModel.ApplyOpacity C# (CSharp) Method

ApplyOpacity() private method

private ApplyOpacity ( LayerPropertiesModel properties, float percentage ) : void
properties LayerPropertiesModel
percentage float
return void
        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;
        }