public CalloutAnnotation(int count, CGRect rect, nfloat lineWidth, UIColor color)
        {
            Path = UIBezierPath.FromOval(rect);
            Path.LineWidth = lineWidth;

            var center = new CGPoint (rect.GetMidX(), rect.GetMidY());

            Center = center;

            nfloat startAngle = (nfloat)(Math.PI * 0.75);
            nfloat endAngle = (nfloat)(Math.PI * 0.60);

            Clip = UIBezierPath.FromArc(center, center.X + lineWidth, startAngle, endAngle, true);
            Clip.AddLineTo(center);
            Clip.ClosePath();
            Clip.LineWidth = lineWidth;

            Tail = new UIBezierPath ();
            Tail.MoveTo(new CGPoint (center.X - 11, center.Y + 9));
            Tail.AddLineTo(new CGPoint (center.X - 11, center.Y + 18));
            Tail.AddLineTo(new CGPoint (center.X - 3, center.Y + 13));
            Tail.LineWidth = lineWidth;

            Rect = rect;
            Color = color;
            Count = count;
        }
Beispiel #2
0
 public TabControl(CGRect frame, UIColor selectedTabColor, UIColor unselectedTabColor)
 {
     this.unselectedTabColor = unselectedTabColor;
     this.selectedTabColor = selectedTabColor;
     this.items = new List<TabControlItem>();
     this.Frame = frame;
 }
Beispiel #3
0
		public static UIColor ToUIColor(this Color color, UIColor defaultColor)
		{
			if (color.IsDefault)
				return defaultColor;

			return color.ToUIColor();
		}
		public void Live(string timeRemaining, UIColor timeRemainingColor)
		{
			BackgroundColor = UIColor.Clear;

			SetTitle(timeRemaining);
			SetTitleColor(timeRemainingColor);
		}
Beispiel #5
0
		void CreateRadialGauge()
		{
			this.radialGauge.Delegate = new GaugeDelegate ();
			this.View.AddSubview (this.radialGauge);

			TKGaugeRadialScale scale = new TKGaugeRadialScale (new NSNumber (0), new NSNumber (6));
			this.radialGauge.AddScale (scale);
			scale.AddIndicator(new TKGaugeNeedle(2.3f, 0.6f));

			UIColor[] colors = new UIColor[] { 
				new UIColor (0.871f, 0.871f, 0.871f, 1.00f),
				new UIColor (0.533f, 0.796f, 0.290f, 1.00f),
				new UIColor (1.000f, 0.773f, 0.247f, 1.00f),
				new UIColor (1.000f, 0.467f, 0.161f, 1.00f),
				new UIColor (0.769f, 0.000f, 0.043f, 1.00f)
			};
				
			nfloat max = ((NSNumber)scale.Range.Maximum).FloatValue;
			nfloat rangeWidth = max / colors.Length;
			nfloat start = 0;
			foreach (UIColor color in colors)
			{
				TKGaugeSegment segment = new TKGaugeSegment (new NSNumber(start), new NSNumber(start + rangeWidth));
				segment.Fill = new TKSolidFill (color);
				scale.AddSegment(segment);
				start += rangeWidth;
			}
		}
        /// <summary>
        /// Converts the UIColor to a Xamarin Color object.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="defaultColor">The default color.</param>
        /// <returns>UIColor.</returns>
        public static UIColor ToUIColorOrDefault(this Xamarin.Forms.Color color, UIColor defaultColor)
        {
            if (color == Xamarin.Forms.Color.Default)
                return defaultColor;

            return color.ToUIColor();
        }
Beispiel #7
0
        public TouchDrawView(CGRect rect)
            : base(rect)
        {
            linesInProcess = new Dictionary<string, Line>();
            this.BackgroundColor = UIColor.White;
            this.MultipleTouchEnabled = true;

            UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer(tap);
            this.AddGestureRecognizer(tapRecognizer);

            UITapGestureRecognizer dbltapRecognizer = new UITapGestureRecognizer(dblTap);
            dbltapRecognizer.NumberOfTapsRequired = 2;
            this.AddGestureRecognizer(dbltapRecognizer);

            UILongPressGestureRecognizer pressRecognizer = new UILongPressGestureRecognizer(longPress);
            this.AddGestureRecognizer(pressRecognizer);

            moveRecognizer = new UIPanGestureRecognizer(moveLine);
            moveRecognizer.WeakDelegate = this;
            moveRecognizer.CancelsTouchesInView = false;
            this.AddGestureRecognizer(moveRecognizer);

            UISwipeGestureRecognizer swipeRecognizer = new UISwipeGestureRecognizer(swipe);
            swipeRecognizer.Direction = UISwipeGestureRecognizerDirection.Up;
            swipeRecognizer.NumberOfTouchesRequired = 3;
            this.AddGestureRecognizer(swipeRecognizer);

            selectedColor = UIColor.Red;
        }
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            if (BorderWidthAll > 0)
            {
                BorderWidth = new UIEdgeInsets(BorderWidthAll, BorderWidthAll, BorderWidthAll, BorderWidthAll);
            }

            if (BorderColorAll != null)
            {
                BorderColorTop = BorderColorBottom = BorderColorLeft = BorderColorRight = BorderColorAll;
            }

            var xMin = rect.GetMinX();
            var xMax = rect.GetMaxX();

            var yMin = rect.GetMinY();
            var yMax = rect.GetMaxY();

            var fWidth = this.Frame.Size.Width;
            var fHeight = this.Frame.Size.Height;

            var context = UIGraphics.GetCurrentContext();

            if (context != null)
                DrawBorders(context, xMin, xMax, yMin, yMax, fWidth, fHeight);
        }
        public FABarButtonItem(FA icon, string title, UIColor fontColor, EventHandler handler)
            : base()
        {
            UIView view = new UIView (new CGRect (0, 0, 32, 32));

            _iconButton = new UIButton (new CGRect (0, 0, 32, 21)) {
                Font = icon.Font (20),
            };
            _iconButton.SetTitleColor (fontColor, UIControlState.Normal);
            _iconButton.TouchUpInside += handler;

            _titleLabel = new UILabel (new CGRect (0, 18, 32, 10)) {
                TextColor = fontColor,
                Font = UIFont.SystemFontOfSize(10f),
                TextAlignment = UITextAlignment.Center
            };

            this.Title = title;
            this.Icon = icon.String();

            view.Add (_iconButton);
            view.Add (_titleLabel);

            CustomView = view;
        }
 internal CropperResizerView(UIColor color = null, nfloat transparancy = default(nfloat), nfloat lineWidth = default(nfloat))
 {
     this.BackgroundColor = UIColor.Clear;
     _color = color ?? UIColor.Red;
     _transparancy = transparancy == 0 ? 0.8f : transparancy;
     _lineWidth = lineWidth == 0 ? 3f : lineWidth;
 }
 static MessageView()
 {
     TitleFont = UIFont.BoldSystemFontOfSize(16.0f);
     DescriptionFont = UIFont.SystemFontOfSize(14.0f);
     TitleColor = UIColor.FromWhiteAlpha(1.0f, 1.0f);
     DescriptionColor = UIColor.FromWhiteAlpha(1.0f, 1.0f);
 }
        public static UIImage ImageFromFont(string text, UIColor iconColor, CGSize iconSize, string fontName)
        {
            UIGraphics.BeginImageContextWithOptions(iconSize, false, 0);

              var textRect = new CGRect(CGPoint.Empty, iconSize);
              var path = UIBezierPath.FromRect(textRect);
              UIColor.Clear.SetFill();
              path.Fill();

              var font = UIFont.FromName(fontName, iconSize.Width);
              using (var label = new UILabel() { Text = text, Font = font })
              {
            GetFontSize(label, iconSize, 500, 5);
            font = label.Font;
              }
              iconColor.SetFill();
              using (var nativeString = new NSString(text))
              {
            nativeString.DrawString(textRect, new UIStringAttributes
              {
            Font = font,
            ForegroundColor = iconColor,
            BackgroundColor = UIColor.Clear,
            ParagraphStyle = new NSMutableParagraphStyle
            {
              Alignment = UITextAlignment.Center
            }
              });
              }
              var image = UIGraphics.GetImageFromCurrentImageContext();
              UIGraphics.EndImageContext();
              image = image.ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
              return image;
        }
 public CellDisclosureAccessory(CGRect frame)
     : base(frame)
 {
     this.BackgroundColor = UIColor.Clear;
     this.color = App.ForegroundColor.ToUIColor();
     this.highlightedColor = App.NavigationColor.ToUIColor();
 }
Beispiel #14
0
		/// <summary>
		/// Initializes a new instance of the <see cref="FontAwesomeXamarin.FAButton"/> class.
		/// This class extends UIButton. It does set set a default Frame. You must do this yourself
		/// </summary>
		/// <param name="icon">Icon.</param>
		/// <param name="fontColor">Font color.</param>
		/// <param name="iconSize">Icon size.</param>
		public FAButton (string icon, UIColor fontColor, float iconSize = 20) : base(UIButtonType.System)
		{
			Icon = icon;
			IconSize = iconSize;
			this.SetTitleColor (fontColor, UIControlState.Normal);
			this.SetTitleColor (fontColor.ColorWithAlpha(100), UIControlState.Highlighted);
		}
Beispiel #15
0
        private static Tuple<NSMutableAttributedString,List<NewsCellView.Link>> CreateAttributedStringFromBlocks(UIFont font, UIColor primaryColor, IEnumerable<TextBlock> blocks)
        {
            var attributedString = new NSMutableAttributedString();
            var links = new List<NewsCellView.Link>();

            nint lengthCounter = 0;
            int i = 0;

            foreach (var b in blocks)
            {
                UIColor color = null;
                if (b.Tapped != null)
                    color = LinkColor;

                color = color ?? primaryColor; 

                var ctFont = new CoreText.CTFont(font.Name, font.PointSize);
                var str = new NSAttributedString(b.Value, new CoreText.CTStringAttributes() { ForegroundColor = color.CGColor, Font = ctFont });
                attributedString.Append(str);
                var strLength = str.Length;

                if (b.Tapped != null)
                {
                    var weakTapped = new WeakReference<Action>(b.Tapped);
                    links.Add(new NewsCellView.Link { Range = new NSRange(lengthCounter, strLength), Callback = () => weakTapped.Get()?.Invoke(), Id = i++ });
                }

                lengthCounter += strLength;
            }

            return new Tuple<NSMutableAttributedString, List<NewsCellView.Link>>(attributedString, links);
        }
        public static BaseItemView Create (CGRect frame, NodeViewController nodeViewController, TreeNode node, string filePath, UIColor kleur)
        {
            var view = BaseItemView.Create(frame, nodeViewController, node, kleur);
            UIWebView webView = new UIWebView();

			string extension = Path.GetExtension (filePath);
			if (extension == ".odt") {
				string viewerPath = NSBundle.MainBundle.PathForResource ("over/viewer/index", "html");

				Uri fromUri = new Uri(viewerPath);
				Uri toUri = new Uri(filePath);
				Uri relativeUri = fromUri.MakeRelativeUri(toUri);
				String relativePath = Uri.UnescapeDataString(relativeUri.ToString());

				NSUrl finalUrl = new NSUrl ("#" + relativePath.Replace(" ", "%20"), new NSUrl(viewerPath, false));
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			} else {
				NSUrl finalUrl = new NSUrl (filePath, false);
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			}
		
        }
		public RefreshTableHeaderView (CGRect rect) : base (rect)
		{
			this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			
			BackgroundColor = new UIColor (0.88f, 0.9f, 0.92f, 1);
			CreateViews ();
		}
        public static BaseItemView Create (CGRect frame, NodeViewController nodeViewController, TreeNode node, UIColor kleur)
        {
            var view = (BaseItemView)Nib.Instantiate (null, null) [0];
            view.Frame = frame;
            view.Node = node;
            view.NodePath = node.Path;
            view.SetShadow();

            view.TerugButton.TouchUpInside += delegate
            {
                nodeViewController.PopView();
            };

            view.TitelLabel.Text = node.Name;
            view.TitelLabel.SetFont();
            view.FullScreenButton.TouchUpInside += delegate {
                nodeViewController.ToggleFullScreen();
            };

            if (kleur != null)
            {
                view.kleurenBalk.BackgroundColor = kleur;
            }
            view.HideBackButton();
            return view;
        }
		/// <summary>
		/// Adds the text.
		/// </summary>
		/// <param name="image">The image.</param>
		/// <param name="text">The text.</param>
		/// <param name="point">The point.</param>
		/// <param name="font">The font.</param>
		/// <param name="color">The color.</param>
		/// <param name="alignment">The alignment.</param>
		/// <returns>UIImage.</returns>
		public static UIImage AddText(
			this UIImage image,
			string text,
			CGPoint point,
			UIFont font,
			UIColor color,
			UITextAlignment alignment = UITextAlignment.Left)
		{
			//var labelRect = new RectangleF(point, new SizeF(image.Size.Width - point.X, image.Size.Height - point.Y));
			var h = text.StringHeight(font, image.Size.Width);
			var labelRect = new CGRect(point, new CGSize(image.Size.Width - point.X, h));

			var label = new UILabel(labelRect)
				            {
					            Font = font,
					            Text = text,
					            TextColor = color,
					            TextAlignment = alignment,
					            BackgroundColor = UIColor.Clear
				            };

			var labelImage = label.ToNativeImage();

			using (var context = image.Size.ToBitmapContext())
			{
				var rect = new CGRect(new CGPoint(0, 0), image.Size);
				context.DrawImage(rect, image.CGImage);
				context.DrawImage(labelRect, labelImage.CGImage);
				context.StrokePath();
				return UIImage.FromImage(context.ToImage());
			}
		}
		/// <summary>
		/// Initializes a new instance of UITableView.
		/// </summary>
		/// <param name="data">Source Data.</param>
		/// <param name="cellHeight">cellHeight, use 0 for default.</param>
		/// <param name="fSize">Cell Font size.</param>
		/// <param name="cellSelectedBackgroundColor">Cell selected background color, Use Clear for default</param>
		/// <param name="cellSelectedTextColor">Cell selected text color, Use Clear for default</param>
		public DropDownTable(IList<string> data, nfloat cellHeight,
			nfloat fSize, UIColor cellSelectedBackgroundColor, UIColor cellSelectedTextColor,
			string selectedText = "") : base()
		{
			CellLayoutMarginsFollowReadableWidth = false;
			this.MultipleTouchEnabled = true;
			this._FontSize = fSize;
			this._CellHeight = cellHeight;
			this._CellSBackgroundColor = cellSelectedBackgroundColor;
			this._CellSTextColor = cellSelectedTextColor;

			Source = new DropDownSource (data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, 
				this._CellSTextColor, selectedText);

			//ContentInset =  new UIEdgeInsets(0, -10, 0, 0);
			LayoutMargins = UIEdgeInsets.Zero;
			SeparatorInset = UIEdgeInsets.Zero;

			// select default row
			var idx = data.ToList().FindIndex(x => x == selectedText);
			System.Diagnostics.Debug.WriteLine (idx);
			if (idx >= 0) {
				this.SelectRow (Foundation.NSIndexPath.FromItemSection (idx, 0), false, UITableViewScrollPosition.Top);
			}

			(Source as DropDownSource).OnSelected += RowSelected;
		}
Beispiel #21
0
 public int Add(string title, UIColor color, Action action)
 {
     var index = (int)AddButton (title);
     dict.Add (index, action);
     colors.Add(index,color);
     return index;
 }
        public static FavoriteNodeView Create (CGRect frame, NodeViewController nodeViewController, UIColor kleur)
        {
            var view = (FavoriteNodeView)Nib.Instantiate (null, null) [0];
            view.Frame = frame;
            view.SetShadow();
            view._nodeViewController = nodeViewController;
            view.NodeItemTableController.RefreshControl = new UIRefreshControl()
            {
                TintColor = UIColor.FromRGB(143, 202, 232),
                AttributedTitle = new NSAttributedString("Map aan het verversen")
            };

            view.NodeItemTableController.RefreshControl.ValueChanged += delegate
            {
                view.Refresh();
            };

            view.SyncButton.TouchUpInside += delegate
            {;
                view.Refresh(scrollToTop: true);
            };

            if (kleur != null)
            {
                view.KleurenBalk.BackgroundColor = kleur;
            }
                
            view.Refresh(scrollToTop: true);
            return view;
        }
 private AutoLayoutContentView(string name, UIColor color, string font)
 {
     OurConstraints = new AutoLayoutConstraints ();
     base.BackgroundColor = color;
     Font = font;
     Name = name;
 }
		public static void AddBorder(this UIView view, UIRectEdge edge, UIColor color, nfloat thickness) {

			var border = new CALayer ();
			var f = view.Frame;
			switch(edge)
			{
			case UIRectEdge.Top:
				border.Frame = new CGRect(0, 0, f.Width, thickness);
				break;
			case UIRectEdge.Bottom:
				border.Frame = new CGRect (0, f.Height - thickness, f.Width, thickness);
				break;
			case UIRectEdge.Left:
				border.Frame = new CGRect(0, 0, thickness, f.Height);
				break;
			case UIRectEdge.Right:
				border.Frame = new CGRect(f.Width - thickness, 0, thickness, f.Height);
				break;
			default:
				break;
			}

			border.BackgroundColor = color.CGColor;
			view.Layer.AddSublayer (border);
		}
Beispiel #25
0
 private void SetBackgroundColor(SKColor color)
 {
     if (this.background != null)
     {
         background.Color = color;
     }
 }
 /// <summary>
 /// Creates a new instance of the GlassButton using the specified dimensions
 /// </summary>
 public GlassButton(CGRect frame)
     : base(frame)
 {
     NormalColor = new UIColor(0.55f, 0.04f, 0.02f, 1);
     HighlightedColor = UIColor.Black;
     DisabledColor = UIColor.Gray;
 }
Beispiel #27
0
		void CreateRadialGauge()
		{
			this.radialGauge = new TKRadialGauge ();
			this.View.AddSubview (this.radialGauge);

			TKGaugeRadialScale scale = new TKGaugeRadialScale ();
			this.radialGauge.AddScale (scale);
			scale.StartAngle = 0;
			scale.EndAngle = (nfloat)Math.PI*2.0f;
			scale.Stroke = new TKStroke (UIColor.Clear);
			scale.Ticks.Hidden = true;
			scale.Labels.Hidden = true;

			for (int i=0; i < 3; i++) {
				TKGaugeSegment segment = new TKGaugeSegment (new NSNumber (0), new NSNumber (100));
				segment.Fill = new TKSolidFill(this.colors[i].ColorWithAlpha(0.4f));
				segment.Width = 0.2f;
				segment.Location = 0.5f + i * 0.25f;
				segment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment(segment);

				TKGaugeSegment gradientSegment = new TKGaugeSegment ();
				UIColor[] colors = new UIColor[] { this.colors[i], this.colors [i + 3] };
				gradientSegment.Fill = new TKLinearGradientFill (colors, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
				gradientSegment.Width = 0.2f;
				gradientSegment.Location = 0.5f + i * 0.25f;
				gradientSegment.Cap = TKGaugeSegmentCap.Round;
				scale.AddSegment (gradientSegment);
				gradientSegment.SetRange(new TKRange(new NSNumber(0), new NSNumber(20+ this.r.Next(50)) ), 0.5f, CAMediaTimingFunction.EaseInEaseOut);
			}
		}
Beispiel #28
0
		void CreateLinearGauge()
		{
			this.linearGauge = new TKLinearGauge();
			this.linearGauge.WeakDelegate = this.gaugeDelegate;
			this.linearGauge.Orientation = TKLinearGaugeOrientation.Vertical;
			this.View.AddSubview(this.linearGauge);

			TKGaugeLinearScale scale = new TKGaugeLinearScale (new NSNumber(-10), new NSNumber(40));	
			this.linearGauge.AddScale (scale);

			TKGaugeSegment segment = new TKGaugeSegment (new NSNumber(-10), new NSNumber(18));
			segment.Location = 0.56f;
			segment.Width = 0.05f;
			segment.Width2 = 0.05f;
			segment.Cap = TKGaugeSegmentCap.Round;

			scale.AddSegment (segment);

			UIColor[] colors = new UIColor[] { 
				new UIColor (0.149f, 0.580f, 0.776f, 1.00f),
				new UIColor (0.537f, 0.796f, 0.290f, 1.00f),
				new UIColor (1.000f, 0.773f, 0.247f, 1.00f),
				new UIColor (1.000f, 0.463f, 0.157f, 1.00f),
				new UIColor (0.769f, 0.000f, 0.047f, 1.00f)
			};
			this.AddSegments(scale, colors, 0.5f, 0.05f);
		}
Beispiel #29
0
 public void SetCornerBackgroundColor(UIColor color)
 {
     if (color != CornerBackgroundColor) {
         CornerBackgroundColor = color;
         SetNeedsDisplay();
     }
 }
Beispiel #30
0
        public static Color ToColor(this UIColor color)
        {
            nfloat red;
            nfloat green;
            nfloat blue;
            nfloat alpha;

            if (color == null)
            {
                return(Color.Default);
            }
#if __IOS__
            color.GetRGBA(out red, out green, out blue, out alpha);
#else
            if (color.Type == NSColorType.Catalog)
            {
                color = UIColor.Black.UsingColorSpace(NSColorSpace.DeviceRGB);
            }
            // TODO:
            //throw new InvalidOperationException("Cannot convert a NSColorType.Catalog color without specifying the color space, use the overload to specify an NSColorSpace");

            color.GetRgba(out red, out green, out blue, out alpha);
#endif
            return(new Color(red, green, blue, alpha));
        }
Beispiel #31
0
        NSDictionary MakeAttrs(NativeColor color, NativeColor darkColor) => new NativeStringAttributes
        {
            Font            = codeFont,
            ForegroundColor = IsDark ? darkColor : color,
            ParagraphStyle  = defaultParagraph,
        }

        .Dictionary;
Beispiel #32
0
 public AppleMathView(TypesettingContext <TFont, TGlyph> typesettingContext, float fontSize)
 {
     Layer.GeometryFlipped = true;
     BackgroundColor       = NColor.FromRGB(0.9f, 0.9f, 0.9f);
     TextColor             = NColor.Black;
     FontSize            = fontSize;
     _typesettingContext = typesettingContext;
 }
Beispiel #33
0
 public StringElement()
 {
     Font = DefaultTitleFont.WithSize(DefaultTitleFont.PointSize);
     SubtitleFont = DefaultDetailFont.WithSize(DefaultDetailFont.PointSize);
     BackgroundColor = BgColor;
     TextColor = DefaultTitleColor;
     DetailColor = DefaultDetailColor;
 }
Beispiel #34
0
		public void ResetStyle(bool isiOS7, UIColor colorToUse)
		{
			Color = colorToUse;
			BackgroundColor = isiOS7 ? UIColor.White : UIColor.DarkGray;
			ProgressUpdateInterval = 300;


		}
Beispiel #35
0
        public static UIColor ToNative(this Color color, UIColor defaultColor)
        {
            if (color.IsDefault)
            {
                return(defaultColor);
            }

            return(color.ToNative());
        }
        public static UIColor FromXamarinColor(Color xfColor)
        {
            UIKit.UIColor uiColor = UIColor.FromRGBA(
                (byte)(xfColor.R * 255),
                (byte)(xfColor.G * 255),
                (byte)(xfColor.B * 255),
                (byte)(xfColor.A * 255));

            return(uiColor);
        }
Beispiel #37
0
        public static UIColor FromPatternImageFromBundle(string bgImage)
        {
            var image = UIImage.FromBundle(bgImage);

            if (image == null)
            {
                return(UIColor.White);
            }

            return(UIColor.FromPatternImage(image));
        }
Beispiel #38
0
        public static Color?ToColor(this UIColor color)
        {
            if (color == null)
            {
                return(null);
            }

            color.GetRGBA(out nfloat red, out nfloat green, out nfloat blue, out nfloat alpha);

            return(new Color((float)red, (float)green, (float)blue, (float)alpha));
        }
Beispiel #39
0
        public MyScene(CGSize size) : base(size)
        {
            BackgroundColor = new UIKit.UIColor(.15f, .15f, .3f, 1);

            AddChild(new SKLabelNode("Chalkduster")
            {
                Text     = "Hello World",
                FontSize = 30,
                Position = new CGPoint(Frame.GetMidX(), Frame.GetMidY()),
            });
        }
Beispiel #40
0
        public override void DidMoveToView(SKView view)
        {
            // Setup your scene here
            BackgroundColor = new UIKit.UIColor(.15f, .15f, .3f, 1);
            var myLabel = new SKLabelNode("Chalkduster")
            {
                FontSize = 30,
                Text     = "Hello, World!",
                Position = new CGPoint(Frame.GetMidX(), Frame.GetMidY())
            };

            AddChild(myLabel);
        }
Beispiel #41
0
        public Button(string text) : base()
        {
            // create a label
            var fontName = "Optima-ExtraBlack";

            this.label           = SKLabelNode.FromFont(fontName);
            this.label.Text      = text;
            this.label.FontSize  = 18;
            this.label.FontColor = SKColor.White;
            this.label.Position  = new CGPoint(0f, -8f);

            // create the background
            this.size       = new CGSize(this.label.Frame.Size.Width + 10f, 30f);
            this.background = new SKSpriteNode(SKColor.FromCIColor(new CoreImage.CIColor(0f, 0f, 0f, 0.75f)), size);

            // add to the root node
            this.AddChild(this.background);
            this.AddChild(this.label);

            // Track mouse event
            base.UserInteractionEnabled = true;
        }
 public static void AddBorder(this _View thisButton, float borderThickness = 1, _Color borderColor = null)
 {
     if (borderColor != null)
     {
         thisButton.Layer.BorderColor = borderColor.CGColor;
     }
     if (borderThickness > 0)
     {
         if (Math.Abs(borderThickness - 1f) < float.Epsilon && ViewHelper.IsRetinaDisplay)
         {
             borderThickness = (float)ViewHelper.OnePixel;
         }
         thisButton.Layer.BorderWidth = borderThickness;
     }
 }
 public static void RoundCorners(this _View thisButton, float radius = 2, float borderThickness = 0, _Color borderColor = null)
 {
     thisButton.AddBorder(borderThickness, borderColor);
     thisButton.Layer.CornerRadius = radius;
 }
Beispiel #44
0
 /// <remarks>
 /// This method is required for performance. Creating a native Color
 /// requires a round-trip with Objective-C, so updating this value only when opacity
 /// and color changes is more efficient.
 /// </remarks>
 private void UpdateColorWithOpacity(Color newColor)
 {
     ColorWithOpacity = GetColorWithOpacity(newColor);
 }
Beispiel #45
0
 public SolidColorBrush(Color color) : this()
 {
     Color = color;
     UpdateColorWithOpacity(color);
 }
Beispiel #46
0
 public SolidColorBrush(Color color) : this()
 {
     Color = color;
 }
Beispiel #47
0
 partial void UpdateColorWithOpacity(Color newColor, double opacity);
Beispiel #48
0
 partial void OnColorChanged(Color oldValue, Color newValue);
 public static UIColor ToNative(this Color?color, UIColor defaultColor)
 => color?.ToNative() ?? defaultColor;
Beispiel #50
0
        public static Color ToColor(this UIColor color, NSColorSpace colorSpace)
        {
            var convertedColor = color.UsingColorSpace(colorSpace);

            return(convertedColor.ToColor());
        }
Beispiel #51
0
        /// <remarks>
        /// This method is required for performance. Creating a native Color
        /// requires a round-trip with Objective-C, so updating this value only when opacity
        /// and color changes is more efficient.
        /// </remarks>
        partial void UpdateColorWithOpacity(Color newColor, double opacity)
        {
            newColor.A = (byte)(newColor.A * opacity);

            ColorWithOpacity = newColor;
        }
Beispiel #52
0
 public static NativeColor ColorWithAlphaComponent(this NativeColor color, nfloat alpha) => color.ColorWithAlpha(alpha);
Beispiel #53
0
 public static void Set(this NativeColor color) => color.SetColor();
Beispiel #54
0
 public static NativeColor Gray(int g) => NativeColor.FromWhite(g / ((nfloat)255), 1);
Beispiel #55
0
 /// <remarks>
 /// This method is required for performance. Creating a native Color
 /// requires a round-trip with Objective-C, so updating this value only when opacity
 /// and color changes is more efficient.
 /// </remarks>
 partial void UpdateColorWithOpacity(Color newColor, double opacity)
 {
     ColorWithOpacity = GetColorWithOpacity(newColor);
 }
Beispiel #56
0
 partial void OnColorChanged(Color oldValue, Color newValue)
 {
     UpdateColorWithOpacity(newValue, Opacity);
 }
Beispiel #57
0
 public static NativeColor Rgb(int r, int g, int b) => NativeColor.FromRgb(r, g, b);
Beispiel #58
0
 public static UIColor ToPlatform(this Color?color, UIColor defaultColor)
 => color?.ToPlatform() ?? defaultColor;