本文整理汇总了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));
}
}
示例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);
}
示例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);
}
示例4: Scale
UIImage Scale (UIImage source)
{
return source.Scale(new SizeF (dimx, dimy));
}
示例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]{"",""};
}
示例6: Picked
void Picked (UIImage image)
{
Value = image;
scaled = image.Scale(new SizeF(dimx, dimy));
//scaled = GraphicsUtil.PrepareForProfileView(image, dimx, dimy);
currentController.DismissModalViewControllerAnimated (true);
}
示例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]{ "", "" };
}
示例8: MySavePicture
private void MySavePicture(UIImage image)
{
image = image.Scale (image.Size);
string[] output = SaveImage (RandomGeneratedName (), image);
RaiseSavedImageEvent (output [0], output [1]);
}
示例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);
}
示例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;
}