当前位置: 首页>>代码示例>>C#>>正文


C# UIColor.SetFill方法代码示例

本文整理汇总了C#中UIKit.UIColor.SetFill方法的典型用法代码示例。如果您正苦于以下问题:C# UIColor.SetFill方法的具体用法?C# UIColor.SetFill怎么用?C# UIColor.SetFill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIKit.UIColor的用法示例。


在下文中一共展示了UIColor.SetFill方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImageFromFont

        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;
        }
开发者ID:anthonylowther21,项目名称:DebtCalculator,代码行数:34,代码来源:FontAwesomeImageHelper.cs

示例2: CreateBackgroundImage

 private static UIImage CreateBackgroundImage(UIColor color)
 {
     UIGraphics.BeginImageContext(new CoreGraphics.CGSize(1, 1f));
     color.SetFill();
     UIGraphics.RectFill(new CoreGraphics.CGRect(0, 0, 1, 1));
     var img = UIGraphics.GetImageFromCurrentImageContext();
     UIGraphics.EndImageContext();
     return img;
 }
开发者ID:Mikoj,项目名称:CodeBucket,代码行数:9,代码来源:Theme.cs

示例3: RenderSolidImage

		static UIImage RenderSolidImage(UIColor color, CGSize size)
		{
			UIGraphics.BeginImageContextWithOptions (size, false, 0);
			CGContext context = UIGraphics.GetCurrentContext ();
			color.SetFill ();
			context.FillRect (new CGRect (CGPoint.Empty, size));
			UIImage result = UIGraphics.GetImageFromCurrentImageContext ();
			UIGraphics.EndImageContext ();
			return result;
		}
开发者ID:richardboegli,项目名称:KinderChat,代码行数:10,代码来源:ImageUtils.cs

示例4: ImageFromFont

        public static UIImage ImageFromFont(UIFont font, char character, UIColor fillColor)
        {
            var s = new NSString("" + character);
            var stringSize = s.StringSize(font);
            var maxSize = (nfloat)Math.Max(stringSize.Height, stringSize.Width);
            var size = new CGSize(maxSize, maxSize);

            UIGraphics.BeginImageContextWithOptions(size, false, 0f);
            fillColor.SetFill();

            var drawPoint = new CGPoint((size.Width / 2f) - (stringSize.Width / 2f),
                                (size.Height / 2f) - (stringSize.Height / 2f));
            s.DrawString(drawPoint, font);

            var img = UIGraphics.GetImageFromCurrentImageContext();
            UIGraphics.EndImageContext();
            return img;
        }
开发者ID:jianwoo,项目名称:CodeHub,代码行数:18,代码来源:Graphics.cs

示例5: Tint

        public static UIImage Tint(this UIImage img, UIColor tint, CGBlendMode blendMode) {
            UIGraphics.BeginImageContextWithOptions(img.Size, false, 0f);
            tint.SetFill();
            var bounds = new CGRect(0, 0, img.Size.Width, img.Size.Height);
            UIGraphics.RectFill(bounds);

            img.Draw(bounds, blendMode, 1f);

            if (blendMode != CGBlendMode.DestinationIn)
                img.Draw(bounds, CGBlendMode.DestinationIn, 1f);

            var tintedImage = UIGraphics.GetImageFromCurrentImageContext();
            UIGraphics.EndImageContext();

            return tintedImage;
        }
开发者ID:rmawani,项目名称:Awesomizer,代码行数:16,代码来源:UIViewExtensions.cs

示例6: CircleImageWithColor

    // private methods

    UIImage CircleImageWithColor(UIColor color, nfloat height)
    {
        UIGraphics.BeginImageContextWithOptions(new CGSize(height, height), false, 0);
        CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB();

        UIBezierPath fillPath = UIBezierPath.FromOval(new CGRect(0, 0, height, height));
        color.SetFill();
        fillPath.Fill();

        UIImage dotImage = UIGraphics.GetImageFromCurrentImageContext();
        UIGraphics.EndImageContext();

        return dotImage;
    }
开发者ID:markerpen,项目名称:PulsingAnnotationView,代码行数:16,代码来源:PulsingAnnotationView.cs


注:本文中的UIKit.UIColor.SetFill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。