當前位置: 首頁>>代碼示例>>C#>>正文


C# UIKit.UIImage類代碼示例

本文整理匯總了C#中UIKit.UIImage的典型用法代碼示例。如果您正苦於以下問題:C# UIImage類的具體用法?C# UIImage怎麽用?C# UIImage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UIImage類屬於UIKit命名空間,在下文中一共展示了UIImage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RaffleDetailScreenController

 public RaffleDetailScreenController(Tap5050Event raffle,UIImage raffleImage)
 {
     //objects
     this.raffle = raffle;
     this.raffleImage = raffleImage;
     this.selectedGoalView = SelectedGoalView.Detail;
 }
開發者ID:MADMUC,項目名稱:TAP5050,代碼行數:7,代碼來源:RaffleDetailScreenController.cs

示例2: Handle_FinishedPickingMedia

		protected void Handle_FinishedPickingMedia (object sender, UIImagePickerMediaPickedEventArgs e)
		{
			// determine what was selected, video or image
			bool isImage = false;

			if (e.Info [UIImagePickerController.MediaType].ToString () == "public.image") {
				isImage = true;
			}

//			// get common info (shared between images and video)
//			NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl;
//			if (referenceURL != null)
//				Console.WriteLine("Url:"+referenceURL.ToString ());

			// if it was an image, get the other image info
			if(isImage) {
				// get the original image
				originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage;
				if(originalImage != null) {
					// do something with the image
					imgProfilePic.Image = originalImage; // display
				}
			} else { // if it's a video
				UIAlertView alert = new UIAlertView ("Invalid Format", "Looks like you selected a video", null, "OK", null);
				alert.Show ();
			}
			// dismiss the picker
			imagePicker.DismissViewController (true, null);
		}
開發者ID:joeshepherdmba,項目名稱:SpotVox,代碼行數:29,代碼來源:EditProfileViewController.cs

示例3: Set

        public void Set(Uri imgUrl, string time, UIImage actionImage, 
            NSMutableAttributedString header, NSMutableAttributedString body, 
            List<Link> headerLinks, List<Link> bodyLinks, Action<NSUrl> webLinkClicked, bool multilined)
        {
            if (imgUrl == null)
                Image.Image = Images.Avatar;
            else
                Image.SetImage(new NSUrl(imgUrl.AbsoluteUri), Images.Avatar);
            
            Time.Text = time;
            ActionImage.Image = actionImage;

            if (header == null)
                header = new NSMutableAttributedString();
            if (body == null)
                body = new NSMutableAttributedString();

            Header.AttributedText = header;
            Header.Delegate = new LabelDelegate(headerLinks, webLinkClicked);

            Body.AttributedText = body;
            Body.Hidden = body.Length == 0;
            Body.Lines = multilined ? 0 : 4;
            Body.Delegate = new LabelDelegate(bodyLinks, webLinkClicked);

            foreach (var b in headerLinks)
                Header.AddLinkToURL(new NSUrl(b.Id.ToString()), b.Range);

            foreach (var b in bodyLinks)
                Body.AddLinkToURL(new NSUrl(b.Id.ToString()), b.Range);

            AdjustableConstraint.Constant = Body.Hidden ? 0f : 6f;
        }
開發者ID:GitWatcher,項目名稱:CodeHub,代碼行數:33,代碼來源:NewsCellView.cs

示例4: ViewDidLoad

        public override void ViewDidLoad()
        {
            AddOption ("TKChart", useChart);
            AddOption ("TKCalendar", useCalendar);
            AddOption ("UITableView", useTableView);
            AddOption ("UICollectionView", useCollectionView);
            AddOption ("TKListView", useListView);

            base.ViewDidLoad ();

            string[] imageNames = new string[] {"CENTCM.jpg", "FAMIAF.jpg", "CHOPSF.jpg", "DUMONF.jpg", "ERNSHM.jpg", "FOLIGF.jpg"};
            string[] names = new string[] { "John", "Abby", "Phill", "Saly", "Robert", "Donna" };
            NSMutableArray array = new NSMutableArray ();
            Random r = new Random ();
            for (int i = 0; i < imageNames.Length; i++) {
                UIImage image = new UIImage (imageNames [i]);
                this.AddItem (array, names [i], r.Next (100), r.Next (100) > 50 ? "two" : "one", r.Next (10), image);
            }

            this.dataSource.DisplayKey = "Name";
            this.dataSource.ValueKey = "Value";
            this.dataSource.ItemSource = array;

            this.useChart (this, EventArgs.Empty);
        }
開發者ID:joelconnects,項目名稱:ios-sdk,代碼行數:25,代碼來源:DataSourceUIBindings.cs

示例5: Recognise

        public async Task<bool> Recognise (CIImage image)
        {
            if (image == null)
                throw new ArgumentNullException ("image");
            if (_busy)
                return false;
            _busy = true;
            try {
                return await Task.Run (() => {
                    using (var blur = new CIGaussianBlur ())
                    using (var context = CIContext.Create ()) {
                        blur.SetDefaults ();
                        blur.Image = image;
                        blur.Radius = 0;
                        using (var outputCiImage = context.CreateCGImage (blur.OutputImage, image.Extent))
                        using (var newImage = new UIImage (outputCiImage)) {
                            _api.Image = newImage;
                            _api.Recognize ();
                            return true;
                        }
                    }

                });
            } finally {
                _busy = false;
            }
        }
開發者ID:Tolulope,項目名稱:Tesseract.Xamarin,代碼行數:27,代碼來源:TesseractApi.cs

示例6: RatingConfig

 public RatingConfig(UIImage emptyImage, UIImage filledImage, UIImage chosenImage) {
     EmptyImage = emptyImage;
     FilledImage = filledImage;
     ChosenImage = chosenImage;
     ScaleSize = 5;
     ItemPadding = 0f;
 }
開發者ID:david-js,項目名稱:PDRating,代碼行數:7,代碼來源:PDRatingView.cs

示例7: AwakeFromNib

		public override void AwakeFromNib ()
		{
			playBtnBg = UIImage.FromFile ("play.png").StretchableImage (12, 0);
			pauseBtnBg = UIImage.FromFile ("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:Rajneesh360Logica,項目名稱:monotouch-samples,代碼行數:33,代碼來源:avTouchViewController.cs

示例8: CalculateLuminance

      private void CalculateLuminance(UIImage d)
      {
         var imageRef = d.CGImage;
         var width = (int)imageRef.Width;
         var height = (int)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 CGRect(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:arumata,項目名稱:zxingnet,代碼行數:26,代碼來源:RGBLuminanceSource.monotouch.cs

示例9: 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 CGRect (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:bocoop,項目名稱:MichelinMD,代碼行數:28,代碼來源:AddingAnnotationsDelegate.cs

示例10: DownLoadImageWithURL

 void DownLoadImageWithURL(string url)
 {
     var request = NSMutableUrlRequest.FromUrl (new NSUrl(url));
     NSUrlResponse response;
     NSError error;
     NSData data = NSUrlConnection.SendSynchronousRequest (request, out response, out error);
     if (error == null) {
         image = new UIImage (data);
     } else {
         image = new UIImage ();
     }
     //			NSUrlConnection.SendAsynchronousRequest (request, NSOperationQueue.MainQueue, (NSUrlResponse response, NSData data, NSError error) => {
     //				if (error == null)
     //				{
     //					UIImage image = new UIImage(data);
     //					imageView.Image = image;
     ////					if(tableView.images.ElementAt(index) == null)
     ////					{
     ////						tableView.images[index] = image;
     ////						tableView.Parent.View.EventImages.First(ei => ei.thumbnailFile == url).ImageAsNativeControl = image;
     ////					}
     //					completionBlock(true,image);
     //				} else{
     //					completionBlock(false,null);
     //				}
     //			});
 }
開發者ID:rughvi,項目名稱:imageswipe,代碼行數:27,代碼來源:GetImageRenderer.cs

示例11: ToSepia

		public static UIImage ToSepia(UIImage source)
		{
			using (var filter =  new CISepiaTone() { Intensity = 0.8f })
			{
				return ColorSpaceTransformation.ToFilter(source, filter);
			}
		}
開發者ID:Sohojoe,項目名稱:ImagePickerCropAndResize,代碼行數:7,代碼來源:SepiaTransformation.cs

示例12: ButtonElement

 public ButtonElement (string caption, string value, UIImage image = null) 
     : base (caption, value, UITableViewCellStyle.Value1) 
 {
     Image = image;
     Accessory = UITableViewCellAccessory.DisclosureIndicator;
     SelectionStyle = UITableViewCellSelectionStyle.Blue;
 }
開發者ID:crazypebble,項目名稱:CodeHub,代碼行數:7,代碼來源:StringElement.cs

示例13: GetPixelColor

        private UIColor GetPixelColor(CGPoint point, UIImage image)
        {
            var rawData = new byte[4];
            var handle = GCHandle.Alloc(rawData);
            UIColor resultColor = null;

            try
            {
                using (var colorSpace = CGColorSpace.CreateDeviceRGB())
                {
                    using (var context = new CGBitmapContext(rawData, 1, 1, 8, 4, colorSpace, CGImageAlphaInfo.PremultipliedLast))
                    {
                        context.DrawImage(new CGRect(-point.X, point.Y - image.Size.Height, image.Size.Width, image.Size.Height), image.CGImage);

                        float red   = (rawData[0]) / 255.0f;
                        float green = (rawData[1]) / 255.0f;
                        float blue  = (rawData[2]) / 255.0f;
                        float alpha = (rawData[3]) / 255.0f;

                        resultColor = UIColor.FromRGBA(red, green, blue, alpha);
                    }
                }
            }
            finally
            {
                handle.Free();
            }

            return resultColor;
        }
開發者ID:Manne990,項目名稱:XamTest,代碼行數:30,代碼來源:HexagonButtonViewRenderer.cs

示例14: ImageLoaderStringElement

		public ImageLoaderStringElement (string caption, NSAction tapped, NSUrl imageUrl, UIImage placeholder) : base (caption, tapped)
		#endif
		{
			Placeholder = placeholder;
			ImageUrl = imageUrl;
			this.Accessory = UITableViewCellAccessory.None;
		}
開發者ID:richardkeller411,項目名稱:dev-days-labs,代碼行數:7,代碼來源:ImageLoaderElement.cs

示例15: RenderToStream

		public System.IO.Stream RenderToStream (byte[] documentData, int pageIndex)
		{
			using (MemoryStream ms = new MemoryStream (documentData))
			{
				// open document
				using (Document doc = new Document (ms)) 
				{
					// prepare for rendering
					int width = (int)doc.Pages [pageIndex].Width;
					int height = (int)doc.Pages [pageIndex].Height;
					// render the page to a raw bitmap data represented by byte array
					byte[] imageData = ConvertBGRAtoRGBA(doc.Pages [pageIndex].RenderAsBytes (width,height, new RenderingSettings (), null));

					// create CGDataProvider which will serve CGImage creation
					CGDataProvider dataProvider = new CGDataProvider (imageData, 0, imageData.Length);

					// create core graphics image using data provider created above, note that
					// we use CGImageAlphaInfo.Last(ARGB) pixel format
					CGImage cgImage = new CGImage(width,height,8,32,width*4,CGColorSpace.CreateDeviceRGB(),CGImageAlphaInfo.Last,dataProvider,null,false, CGColorRenderingIntent.Default);

					// create UIImage and save it to gallery
					UIImage finalImage = new UIImage (cgImage);
								
					return finalImage.AsPNG ().AsStream();
				}
			}						
		}
開發者ID:apitron,項目名稱:Xamarin.Forms.Samples,代碼行數:27,代碼來源:Renderer.cs


注:本文中的UIKit.UIImage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。