Example #1
0
		public static UIColor ToUIColor(this Color color, Color defaultColor)
		{
			if (color.IsDefault)
				return defaultColor.ToUIColor();

			return color.ToUIColor();
		}
        public static async Task<ImageSource> AddText(this StreamImageSource source, string text, PointF point, Font font, Color color)
        {
            var token = new CancellationTokenSource();
            var stream = await source.Stream(token.Token);
            var image = UIImage.LoadFromData(NSData.FromStream(stream));

            var bytes = image.AddText(text, point, font.ToUIFont(), color.ToUIColor()).AsPNG().ToArray();

            return ImageSource.FromStream(new Func<Stream>(() => new MemoryStream(bytes)));
        }
Example #3
0
 public void SetBackground(Color color)
 {
     BackgroundColor = color.ToUIColor ();
 }
        private void SetTintColor(Color tintColor)
        {
            if (tintColor == Color.Default)
            {
                Control.TintColor = null;

                if (Control.Image != null)
                    Control.Image = Control.Image.ImageWithRenderingMode(UIImageRenderingMode.Automatic);
            }
            else
            {
                if (Control.Image != null)
                    Control.Image = Control.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);

                Control.TintColor = tintColor.ToUIColor();
            }
        }