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


C# UIImage类代码示例

本文整理汇总了C#中UIImage的典型用法代码示例。如果您正苦于以下问题:C# UIImage类的具体用法?C# UIImage怎么用?C# UIImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: UpdateCell

 public void UpdateCell(string name, string text, UIImage image, DateTime created)
 {
     imageView.Image = image;
     _headingLabel.Text = name;
     _subheadingLabel.Text = text;
     _createdLable.Text = ParseDate (created);
 }
开发者ID:RomanYemelyanenko,项目名称:hashbot,代码行数:7,代码来源:TweetsTableCell.cs

示例2: StringElement

		public StringElement (string caption, string value, UIImage image, Action tapped) : base(caption)
		{
			Tapped += tapped;
			this.Value = value;
			this.Image = image;
		
		}
开发者ID:goneflyin,项目名称:MonoMobile.Forms,代码行数:7,代码来源:StringElement.cs

示例3: HandleImagePick

		private void HandleImagePick(UIImage image, int maxPixelDimension, int percentQuality, 
                                         Action<Stream> pictureAvailable, Action assumeCancelled)
		{
			if (image != null)
			{
				// resize the image
				image = image.ImageToFitSize (new SizeF (maxPixelDimension, maxPixelDimension));
				
				using (NSData data = image.AsJPEG ((float)((float)percentQuality/100.0)))
				{
					var byteArray = new byte [data.Length];
					Marshal.Copy (data.Bytes, byteArray, 0, Convert.ToInt32 (data.Length));
					
					var imageStream = new MemoryStream ();
					imageStream.Write (byteArray, 0, Convert.ToInt32 (data.Length));
					imageStream.Seek (0, SeekOrigin.Begin);
					
					pictureAvailable (imageStream);
				}
			}
			else
			{
				assumeCancelled ();
			}
			
			_picker.DismissModalViewControllerAnimated(true);
			_presenter.NativeModalViewControllerDisappearedOnItsOwn();
				
		}
开发者ID:Gert-Cominotto,项目名称:MvvmCross,代码行数:29,代码来源:MvxImagePickerTask.cs

示例4: GetDefaultImage

		/// <summary>
		/// Gets the default image.
		/// </summary>
		/// <returns>The default image.</returns>
		private static UIImage GetDefaultImage() 
		{
			if (_defaultImage == null) {
				_defaultImage = UIImage.FromFile ("Images/marker-and-shadow.png");
			}
			return _defaultImage;
		}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:11,代码来源:MapMarker.cs

示例5: AwakeFromNib

		public override void AwakeFromNib ()
		{
			playBtnBg = UIImage.FromFile ("images/play.png").StretchableImage (12, 0);
			pauseBtnBg = UIImage.FromFile ("images/pause.png").StretchableImage (12, 0);
			_playButton.SetImage (playBtnBg, UIControlState.Normal);
			
			_duration.AdjustsFontSizeToFitWidth = true;
			_currentTime.AdjustsFontSizeToFitWidth = true;
			_progressBar.MinValue = 0;
			
			var fileUrl = NSBundle.MainBundle.PathForResource ("sample", "m4a");
			player = AVAudioPlayer.FromUrl (new NSUrl (fileUrl, false));
			
			player.FinishedPlaying += delegate(object sender, AVStatusEventArgs e) {
				if (!e.Status)
					Console.WriteLine ("Did not complete successfully");
				    
				player.CurrentTime = 0;
				UpdateViewForPlayerState ();
			};
			player.DecoderError += delegate(object sender, AVErrorEventArgs e) {
				Console.WriteLine ("Decoder error: {0}", e.Error.LocalizedDescription);
			};
			player.BeginInterruption += delegate {
				UpdateViewForPlayerState ();
			};
			player.EndInterruption += delegate {
				StartPlayback ();
			};
			_fileName.Text = String.Format ("Mono {0} ({1} ch)", Path.GetFileName (player.Url.RelativePath), player.NumberOfChannels);
			UpdateViewForPlayerInfo ();
			UpdateViewForPlayerState ();
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:33,代码来源:avTouchViewController.cs

示例6: ADVPopoverProgressBar

		public ADVPopoverProgressBar(RectangleF frame, ADVProgressBarColor barColor): base(frame)
		{
			bgImageView = new UIImageView(new RectangleF(0, 0, frame.Width, 24));
			
			bgImageView.Image = UIImage.FromFile("progress-track.png");
			this.AddSubview(bgImageView);
			
			progressFillImage = UIImage.FromFile("progress-fill.png").CreateResizableImage(new UIEdgeInsets(0, 20, 0, 40));
			progressImageView = new UIImageView(new RectangleF(-2, 0, 0, 32));
			this.AddSubview(progressImageView);
			
			percentView = new UIView(new RectangleF(5, 4, PERCENT_VIEW_WIDTH, 15));
			percentView.Hidden = true;
			
			UILabel percentLabel = new UILabel(new RectangleF(0, 0, PERCENT_VIEW_WIDTH, 14));
			percentLabel.Tag = 1;
			percentLabel.Text = "0%";
			percentLabel.BackgroundColor = UIColor.Clear;
			percentLabel.TextColor = UIColor.Black;
			percentLabel.Font = UIFont.BoldSystemFontOfSize(11);
			percentLabel.TextAlignment = UITextAlignment.Center;
			percentLabel.AdjustsFontSizeToFitWidth = true;
			percentView.AddSubview(percentLabel);
			
			this.AddSubview(percentView);
		}
开发者ID:MbProg,项目名称:MasterDetailTestProject-IOS-64,代码行数:26,代码来源:ADVPopoverProgressBar.cs

示例7: MenuItem

 public MenuItem(UIImage image, UIImage highlightImage)
     : base()
 {
     this.Image = image;
     this.HighlightedImage = highlightImage;
     this.UserInteractionEnabled = true;
 }
开发者ID:sgmunn,项目名称:MonoKit.Controls,代码行数:7,代码来源:MenuItem.cs

示例8: GetCell

        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            DBError err;
            PhotoCell cell = (PhotoCell)collectionView.DequeueReusableCell(PhotoCell.Key, indexPath);

            DBPath path = Photos [Photos.Length - indexPath.Row - 1].Path;
            DBFile file = DBFilesystem.SharedFilesystem.OpenFile (path, out err);
            UIImage image = null;

            // This means the file doesn't exist, or it is open with asynchronous operation.
            if (file == null) {
                cell.Content = null;
                return cell;
            }

            if (file.Status.Cached) {
                image = new UIImage (file.ReadData (out err));
                file.Close ();
            } else {
                file.AddObserver (this, () => {
                    DBFileStatus newStatus = file.NewerStatus;

                    if ((newStatus == null && file.Status.Cached) ||
                        (newStatus != null && newStatus.Cached)) {
                        image = new UIImage (file.ReadData (out err));
                        cell.Content = image;
                        file.RemoveObserver(this);
                        file.Close ();
                    }
                });
            }
            cell.Content = image;

            return cell;
        }
开发者ID:WaDAMake,项目名称:CloudPrint,代码行数:35,代码来源:CameraSyncViewController.cs

示例9: FinishedPickingImage

		public override void FinishedPickingImage (UIImagePickerController picker, UIImage image, NSDictionary editingInfo)
		{	
			UIApplication.SharedApplication.SetStatusBarHidden(false, false);
			
			var imagePicker = (VCViewController)_navigationController;
			if (imagePicker.IsCameraAvailable)
				imagePicker.btnBib.Hidden = true;
						
			imagePicker.DismissModalViewControllerAnimated(true);
			
			if (imagePicker.IsCameraAvailable)
			{
				image.SaveToPhotosAlbum (delegate {
					// ignore errors
					});
			}
			
			UIViewController nextScreen = null;
			
			if (tweet != null)
			{
				nextScreen = new PhotoPostViewController(_shareNavCont, image, tweet);
			}
			else
			{
				nextScreen = new PhotoLocationViewController(_shareNavCont, image);				
			}
			
			_shareNavCont.PushViewController(nextScreen, true);
		}	
开发者ID:21Off,项目名称:21Off,代码行数:30,代码来源:pickerDelegate.cs

示例10: UpdateWithData

        public void UpdateWithData(Employee employee, UIImage imgDefaultAvatar, UIImage imgPhone, UIImage imgSMS, UIImage imgEmail)
        {
            avatar.Image = employee.getAvatar ();

            if (avatar.Image == null) {
                avatar.Image = imgDefaultAvatar;
            }

            name.Text = employee.getName ();
            title.Text = employee.title;

            szPhoneNo = employee.getPhoneNo ();

            if (szPhoneNo.Length > 0) {
                phoneImg.Image = imgPhone;
                smsImg.Image = imgSMS;
            } else {
            }

            szEmailAddress = employee.getEmailAddr ();

            if (szEmailAddress.Length > 0) {
                emailImg.Image = imgEmail;
            } else {
            }
        }
开发者ID:vikewoods,项目名称:KMSDirectoryMono,代码行数:26,代码来源:EmployeeTableViewCell.cs

示例11: AddCustomAnnotation

		void AddCustomAnnotation (ShinobiChart chart)
		{
			// Create an annotation
			SChartAnnotationZooming an = new SChartAnnotationZooming {
				XAxis = chart.XAxis,
				YAxis = chart.YAxis,

				// Set its location - using the data coordinate system
				XValue = dateFormatter.Parse ("01-01-2009"),
				YValue = new NSNumber(250),

				// Pin all four corners of the annotation so that it stretches
				XValueMax = dateFormatter.Parse ("01-01-2011"),
				YValueMax = new NSNumber(550),

				// Set bounds
				Bounds = new RectangleF (0, 0, 50, 50),
				Position = SChartAnnotationPosition.BelowData
			};

			// Add some custom content to the annotation
			UIImage image = new UIImage ("Apple.png");
			UIImageView imageView = new UIImageView (image) { Alpha = 0.1f };
			an.AddSubview (imageView);

			// Add to the chart
			chart.AddAnnotation (an);
		}
开发者ID:MbProg,项目名称:MasterDetailTestProject-IOS-64,代码行数:28,代码来源:AddingAnnotationsDelegate.cs

示例12: Scale

		public static UIImage Scale(UIImage image, float maxWidthAndHeight)
		{
			//Perform Image manipulation, make the image fit into a 48x48 tile without clipping.  
			
			UIImage scaledImage = image;
			
			image.InvokeOnMainThread(() => {
				float fWidth = image.Size.Width;
				float fHeight = image.Size.Height;
				float fTotal = fWidth>=fHeight?fWidth:fHeight;
				float fDifPercent = maxWidthAndHeight / fTotal;
				float fNewWidth = fWidth*fDifPercent;
				float fNewHeight = fHeight*fDifPercent;
				
				SizeF newSize = new SizeF(fNewWidth,fNewHeight);
				
				UIGraphics.BeginImageContext (newSize);
		        var context = UIGraphics.GetCurrentContext ();
		        context.TranslateCTM (0, newSize.Height);
		        context.ScaleCTM (1f, -1f);
		
		        context.DrawImage (new RectangleF (0, 0, newSize.Width, newSize.Height), image.CGImage);
		
		        scaledImage = UIGraphics.GetImageFromCurrentImageContext();
		        UIGraphics.EndImageContext();
			});
			
			return scaledImage;
		}
开发者ID:Redth,项目名称:MonoTouch.UrlImageStore,代码行数:29,代码来源:Graphics.cs

示例13: RoundCorners

        public static UIImage RoundCorners (UIImage image, int radius)
        {
			if (image == null)
				throw new ArgumentNullException ("image");
			
			UIImage converted = image;
			
			image.InvokeOnMainThread(() => {
	            UIGraphics.BeginImageContext (image.Size);
				float imgWidth = image.Size.Width;
				float imgHeight = image.Size.Height;
	
	            var c = UIGraphics.GetCurrentContext ();
	
	            c.BeginPath ();
	            c.MoveTo (imgWidth, imgHeight/2);
	            c.AddArcToPoint (imgWidth, imgHeight, imgWidth/2, imgHeight, radius);
	            c.AddArcToPoint (0, imgHeight, 0, imgHeight/2, radius);
	            c.AddArcToPoint (0, 0, imgWidth/2, 0, radius);
	            c.AddArcToPoint (imgWidth, 0, imgWidth, imgHeight/2, radius);
	            c.ClosePath ();
	            c.Clip ();
	
	            image.Draw (new PointF (0, 0));
	            converted = UIGraphics.GetImageFromCurrentImageContext ();
	            UIGraphics.EndImageContext ();
			});
			
            return converted;
        }
开发者ID:Redth,项目名称:MonoTouch.UrlImageStore,代码行数:30,代码来源:Graphics.cs

示例14: FinishedLaunching

		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching(UIApplication app, NSDictionary options)
		{
			MonoMobileApplication.NavigationController = new UINavigationController();
			
			_Window = new UIWindow(UIScreen.MainScreen.Bounds);

			if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
				_DefaultImage = UIImage.FromBundle("DefaultiPad.png");
			else
				_DefaultImage = UIImage.FromBundle("Default.png");
			
			if (_DefaultImage != null)
			{
				var imageView = new UIImageView(_Window.Bounds);
				imageView.Image = _DefaultImage;
				_Window.Add(imageView);
				_Window.BackgroundColor = UIColor.Clear;
			}

			MonoMobileApplication.NavigationController.View.Alpha = 0.0f;

			_Window.AddSubview(MonoMobileApplication.NavigationController.View);
			_Window.MakeKeyAndVisible();
			
			MonoMobileApplication.Window = _Window;
			
			BeginInvokeOnMainThread(()=> { Startup(); });
			
			return true;
		}
开发者ID:vknair74,项目名称:MonoMobile.Views,代码行数:31,代码来源:MonoMobileAppDelegate.cs

示例15: CalculateLuminance

      private void CalculateLuminance(UIImage d)
      {
         var imageRef = d.CGImage;
         var width = imageRef.Width;
         var height = imageRef.Height;
         var colorSpace = CGColorSpace.CreateDeviceRGB();

         var rawData = Marshal.AllocHGlobal(height * width * 4);

         try
         {
			var flags = CGBitmapFlags.PremultipliedFirst | CGBitmapFlags.ByteOrder32Little; 
            var context = new CGBitmapContext(rawData, width, height, 8, 4 * width,
            colorSpace, (CGImageAlphaInfo)flags);

            context.DrawImage(new RectangleF(0.0f, 0.0f, (float)width, (float)height), imageRef);
            var pixelData = new byte[height * width * 4];
            Marshal.Copy(rawData, pixelData, 0, pixelData.Length);

            CalculateLuminance(pixelData, BitmapFormat.BGRA32);
         }
         finally
         {
            Marshal.FreeHGlobal(rawData);
         }
      }
开发者ID:Woo-Long,项目名称:ZXing.Net.Mobile,代码行数:26,代码来源:RGBLuminanceSource.monotouch.cs


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