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


C# UIImage.Scale方法代码示例

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


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

示例1: ImageElement

		public ImageElement (UIImage image) : base ("")
		{
			if (image == null){
				Value = MakeEmpty ();
				scaled = Value;
			} else {
				Value = image;			
				scaled = Value.Scale(new SizeF(dimx, dimy));
			}
		}
开发者ID:21Off,项目名称:21Off,代码行数:10,代码来源:ImageElement.cs

示例2: ResizeImage

		public static UIImage ResizeImage (SizeF size, UIImage image, bool KeepRatio)
		{
			var curSize = image.Size;
			SizeF newSize;
			if (KeepRatio) {
				var ratio = Math.Min (size.Width / curSize.Width, size.Height / curSize.Height);
				newSize = new SizeF (curSize.Width * ratio, curSize.Height * ratio);
			
			} else {
				newSize = size;
			}
			
			return image.Scale (newSize);		
		}
开发者ID:21Off,项目名称:21Off,代码行数:14,代码来源:GraphicsII.cs

示例3: ShowImage

			private void ShowImage(UIImage image, UIImagePickerController picker)
			{
				if (this.HasHighResScreen())
					image = image.Scale(new SizeF(new PointF(640, 640)));
				
				_controller.imageView.Image = image;
				picker.DismissModalViewControllerAnimated(true);
			}	
开发者ID:darkwood,项目名称:Jaktloggen,代码行数:8,代码来源:FieldImagePickerScreen.xib.cs

示例4: Scale

		UIImage Scale (UIImage source)
		{
			return source.Scale(new SizeF (dimx, dimy));
		}
开发者ID:21Off,项目名称:21Off,代码行数:4,代码来源:PhotoElement.cs

示例5: SaveCutout

        public static string[] SaveCutout(string name, UIImage ourpic)
        {
            if(ourpic == null)
                return new string[2]{"",""};
            Console.WriteLine ("Save");
            SizeF newSize = new SizeF (50, 50);
            UIImage thumbPic = ourpic.Scale (newSize); //measurements taken from CustomCell, alternatly 33x33
            UIImage resImage = ourpic.Scale (new SizeF (ourpic.Size.Width, ourpic.Size.Height));

            if (ourpic != null) {
                var documentsDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
                var picname = name + ".png";
                var thumbpicname = name + "_thumb.png";
                string pngfileName = System.IO.Path.Combine (documentsDirectory, picname);
                string thumbpngfileName = System.IO.Path.Combine (documentsDirectory, thumbpicname);
                NSData imgData = resImage.AsPNG ();
                NSData img2Data = thumbPic.AsPNG();

                NSError err = null;
                if (imgData.Save (pngfileName, false, out err)) {
                    Console.WriteLine ("saved as " + pngfileName);
                } else {
                    Console.WriteLine ("NOT saved as " + pngfileName + " because" + err.LocalizedDescription);
                }

                err = null;
                if (img2Data.Save (thumbpngfileName, false, out err)) {
                    Console.WriteLine ("saved as " + thumbpngfileName);
                    string[] result = new string[2] {picname,thumbpicname};
                    return result;

                } else {
                    Console.WriteLine ("NOT saved as " + thumbpngfileName + " because" + err.LocalizedDescription);
                    return null;
                }
            }
            return new string[2]{"",""};
        }
开发者ID:Skalar,项目名称:Indexer,代码行数:38,代码来源:TagDetailScreen.cs

示例6: Picked

		void Picked (UIImage image)
		{
			Value = image;
			scaled = image.Scale(new SizeF(dimx, dimy));

			//scaled = GraphicsUtil.PrepareForProfileView(image, dimx, dimy);
			currentController.DismissModalViewControllerAnimated (true);
			
		}
开发者ID:21Off,项目名称:21Off,代码行数:9,代码来源:ImageElement.cs

示例7: SaveGalleryImage

        public static string[] SaveGalleryImage(string name, UIImage ourpic)
        {
            if (ourpic == null)
                return new string[2]{ "", "" };
            Console.WriteLine ("Save");
            float aspectRatio = ourpic.Size.Width / ourpic.Size.Height;
            Console.WriteLine ("ratio:" + aspectRatio);

            float sc = 200;
            if (!UserInterfaceIdiomIsPhone) {
                sc = 450;
            }
            SizeF newSize = new SizeF (sc, sc / aspectRatio);
            UIImage thumbPic = ourpic.Scale (newSize); //measurements taken from CustomCell, alternatly 33x33
            UIImage resImage = ourpic.Scale (new SizeF (ourpic.Size.Width, ourpic.Size.Height));

            if (ourpic != null) {
                var documentsDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
                var gallerydirectory = Path.Combine (documentsDirectory, "gallery");

                if (!Directory.Exists (gallerydirectory)) {
                    Directory.CreateDirectory (gallerydirectory);
                }

                var picname = name + ".png";
                var thumbpicname = name + "_thumb.png";
                string pngfileName = System.IO.Path.Combine (gallerydirectory, picname);
                string thumbpngfileName = System.IO.Path.Combine (gallerydirectory, thumbpicname);
                NSData imgData = resImage.AsPNG ();
                NSData img2Data = thumbPic.AsPNG ();

                NSError err = null;
                if (imgData.Save (pngfileName, false, out err)) {
                    Console.WriteLine ("saved as " + pngfileName);
                } else {
                    Console.WriteLine ("NOT saved as " + pngfileName + " because" + err.LocalizedDescription);
                }

                err = null;
                if (img2Data.Save (thumbpngfileName, false, out err)) {
                    Console.WriteLine ("saved as " + thumbpngfileName);
                    string[] result = new string[2] { picname, thumbpicname };
                    return result;

                } else {
                    Console.WriteLine ("NOT saved as " + thumbpngfileName + " because" + err.LocalizedDescription);
                    return null;
                }
            }
            return new string[2]{ "", "" };
        }
开发者ID:Skalar,项目名称:Indexer,代码行数:51,代码来源:GalleryViewController.cs

示例8: MySavePicture

 private void MySavePicture(UIImage image)
 {
     image = image.Scale (image.Size);
     string[] output = SaveImage (RandomGeneratedName (), image);
     RaiseSavedImageEvent (output [0], output [1]);
 }
开发者ID:Skalar,项目名称:Indexer,代码行数:6,代码来源:ImagePanel.cs

示例9: LoadImage

        public void LoadImage(UIImage image)
        {
            image = image.Scale(GetScaledSize(image.Size));

            scrollView.ZoomScale = 1.0f;

            profilePicture = image;
            float zoomScale = CropHelpers.GetZoomScale(profilePicture.Size, scrollView.Frame.Size);
            var frame = new RectangleF(0f, 0f, image.Size.Width * zoomScale, image.Size.Height * zoomScale);
            var size = scrollView.Frame.Size;

            profilePictureView.Frame = frame;
            profilePictureView.Image = image;
            scrollView.ContentSize = frame.Size;
            scrollView.ContentInset = new UIEdgeInsets(size.Height * 0.8f, size.Width * 0.8f, size.Height * 0.8f, size.Width * 0.8f);
            scrollView.ContentOffset = new PointF(0, 0);
        }
开发者ID:follesoe,项目名称:FacebookBigProfile,代码行数:17,代码来源:MainView.xib.cs

示例10: ResizedImageIcon

		public static UIImage ResizedImageIcon(UIImage image)
		{
			SizeF size = new SizeF (25.0f, 25.0f);	
			UIImage newImage = image.Scale (size, 2.0f);
			return newImage;
		}
开发者ID:305088020,项目名称:ChART,代码行数:6,代码来源:MainViewController.cs


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