Пример #1
0
        public void SetBackground(string imagePath, ContentStretch stretch)
        {
            var imageView = ScrollView.BackgroundView as UIImageView;

            if (imageView == null)
            {
                ScrollView.BackgroundView = imageView = new UIImageView(View.Frame);
            }

            imageView.Image = new UIImage(imagePath);
            switch (stretch)
            {
            case iFactr.UI.ContentStretch.Fill:
                imageView.ContentMode = UIViewContentMode.ScaleToFill;
                break;

            case iFactr.UI.ContentStretch.None:
                imageView.ContentMode = UIViewContentMode.Center;
                break;

            case iFactr.UI.ContentStretch.Uniform:
                imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
                break;

            case iFactr.UI.ContentStretch.UniformToFill:
                imageView.ContentMode = UIViewContentMode.ScaleAspectFill;
                break;
            }
        }
Пример #2
0
        public override async void SetBackground(string imagePath, ContentStretch stretch)
        {
            System.Windows.Media.ImageBrush brush = null;
            BitmapImage bitmap = null;

            if (!string.IsNullOrWhiteSpace(imagePath))
            {
                bitmap = await WpfFactory.LoadBitmapAsync(imagePath);

                brush = new System.Windows.Media.ImageBrush(bitmap);
            }

            if (brush == null || bitmap == null)
            {
                backCanvas.Background = null;

                backCanvas.Height = double.NaN;
                backCanvas.Width  = double.NaN;
            }
            else
            {
                brush.Stretch         = (System.Windows.Media.Stretch)stretch;
                backCanvas.Background = brush;

                backCanvas.Height = bitmap.Height;
                backCanvas.Width  = bitmap.Width;
            }
        }
Пример #3
0
        public async void SetBackground(string imagePath, ContentStretch stretch)
        {
            var brush = await imagePath.GetImageBrush();

            brush.Stretch = (System.Windows.Media.Stretch)stretch;
            Background    = brush;
        }
Пример #4
0
 public virtual void SetBackground(string imagePath, ContentStretch stretch)
 {
     BackgroundHexCode = null;
     Backer            = new ImageControl {
         Size = Size.ToSize(), Stretch = stretch,
     };
     Backer.Loaded  += (o, ev) => Redraw();
     Backer.FilePath = imagePath;
 }
Пример #5
0
 public void SetBackground(string imagePath, ContentStretch stretch)
 {
     TabBar.BackgroundImage = UIImage.FromBundle(imagePath);
     if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
     {
         TabBar.BarTintColor = null;
     }
     else
     {
         TabBar.TintColor = null;
     }
 }
Пример #6
0
 public void SetBackground(string imagePath, ContentStretch stretch)
 {
     if (DroidFactory.MainActivity.ActionBar == null)
     {
         return;
     }
     ImageGetter.SetDrawable(imagePath, (bitmap, url) =>
     {
         if (url == imagePath)
         {
             DroidFactory.MainActivity.ActionBar.SetBackgroundDrawable(bitmap);
         }
     });
 }
Пример #7
0
        public async virtual void SetBackground(string imagePath, ContentStretch stretch)
        {
            var brush = await imagePath.GetImageBrush();

            if (brush == null)
            {
                Background = null;
            }
            else
            {
                brush.Stretch = (System.Windows.Media.Stretch)stretch;
                Background    = brush;
            }
        }
Пример #8
0
 public void SetBackground(string imagePath, ContentStretch stretch)
 {
     ImageGetter.SetDrawable(imagePath, (drawable, url) =>
     {
         if (url != imagePath)
         {
             return;
         }
         if (drawable is BitmapDrawable bit)
         {
             SetBackground(bit.Bitmap);
         }
         else
         {
             SetBackground(null);
             _backgroundPath = imagePath;
             Invalidate();
         }
     });
 }
Пример #9
0
        public void SetBackground(string imagePath, ContentStretch stretch)
        {
            drawingImageView.Image = new UIImage(imagePath);
            switch (stretch)
            {
            case iFactr.UI.ContentStretch.Fill:
                drawingImageView.ContentMode = UIViewContentMode.ScaleToFill;
                break;

            case iFactr.UI.ContentStretch.None:
                drawingImageView.ContentMode = UIViewContentMode.Center;
                break;

            case iFactr.UI.ContentStretch.Uniform:
                drawingImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
                break;

            case iFactr.UI.ContentStretch.UniformToFill:
                drawingImageView.ContentMode = UIViewContentMode.ScaleAspectFill;
                break;
            }
        }
Пример #10
0
        public void SetBackground(string imagePath, ContentStretch stretch)
        {
            var imageView = View as UIImageView;

            imageView.Image = UIImage.FromBundle(imagePath);
            switch (stretch)
            {
            case iFactr.UI.ContentStretch.Fill:
                imageView.ContentMode = UIViewContentMode.ScaleToFill;
                break;

            case iFactr.UI.ContentStretch.None:
                imageView.ContentMode = UIViewContentMode.Center;
                break;

            case iFactr.UI.ContentStretch.Uniform:
                imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
                break;

            case iFactr.UI.ContentStretch.UniformToFill:
                imageView.ContentMode = UIViewContentMode.ScaleAspectFill;
                break;
            }
        }
Пример #11
0
 public override void SetBackground(string imagePath, ContentStretch stretch)
 {
     _canvas.BackColor = System.Drawing.Color.Transparent;
     base.SetBackground(imagePath, stretch);
 }
Пример #12
0
 public void SetBackground(string imagePath, ContentStretch stretch)
 {
 }
Пример #13
0
 public void SetBackground(string imagePath, ContentStretch stretch)
 {
     _stretch    = stretch;
     _background = imagePath;
     UpdateBackground();
 }
Пример #14
0
 void IView.SetBackground(string imagePath, ContentStretch stretch)
 {
     _canvas.SetBackground(imagePath, stretch);
 }