Ejemplo n.º 1
0
        private Layer GetActiveBackgroundLayer(MaybeTask <IImageProvider> backgroundImage, Size backgroundImageSize)
        {
            var backgroundLayer = this[0];

            // Replace BG layer?
            if (!backgroundImage.IsEmpty)
            {
                if (backgroundLayer != EmptyLayer)
                {
                    throw new ArgumentException("LayerList was constructed with a background image, do not pass one into ToImageProvider.", "backgroundImage");
                }

                backgroundLayer = new Layer(LayerStyle.Normal(), backgroundImage, backgroundImageSize);
            }

            return(backgroundLayer);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a LayerList with a specified background image.
 /// </summary>
 /// <param name="backgroundImage">The image to use for the background layer.</param>
 /// <param name="backgroundImageSize">Optionally, the size of the background image. If omitted, the natural size of the source will be used, but the size will not available in the LayerLinkingContext for lazy resolvers.</param>
 /// <param name="layers">A list of layers to add following the background layer.</param>
 public LayerList(IImageProvider backgroundImage, Size backgroundImageSize, params Layer[] layers)
 {
     Add(new Layer(LayerStyle.Normal(), new MaybeTask <IImageProvider>(backgroundImage), backgroundImageSize));
     AddRange(layers);
 }