本文整理汇总了C#中UIKit.UIImage类的典型用法代码示例。如果您正苦于以下问题:C# UIImage类的具体用法?C# UIImage怎么用?C# UIImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIImage类属于UIKit命名空间,在下文中一共展示了UIImage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SavePictureToDisk
public async void SavePictureToDisk(string photoPath)
{
var someImage = new UIImage(photoPath);
someImage.SaveToPhotosAlbum((image, error) => {
var o = image;
});
}
开发者ID:dimgrek,项目名称:PrivatePhotoStorageXamarin,代码行数:7,代码来源:AppDelegate.cs
示例17: Header
public Header()
{
ClipsToBounds = true;
_label = this.Add<UILabel>();
_imageCollapsed = UIImage.FromBundle("collapsed-left");
_imageExpanded = UIImage.FromBundle("expanded-down");
_imageView = new UIImageView(_imageCollapsed);
Add(_imageView);
const int margin = 10;
_imageView
.Anchor(NSLayoutAttribute.Top, this, NSLayoutAttribute.Top, margin)
.Anchor(NSLayoutAttribute.Right, this, NSLayoutAttribute.Right, -margin)
.Anchor(NSLayoutAttribute.Bottom, this, NSLayoutAttribute.Bottom, -margin)
.Layout(NSLayoutAttribute.Height, _imageView.Image.Size.Height)
.Layout(NSLayoutAttribute.Width, _imageView.Image.Size.Width);
_label
.Anchor(NSLayoutAttribute.Left, this, NSLayoutAttribute.Left, margin)
.Anchor(NSLayoutAttribute.CenterY, this, NSLayoutAttribute.CenterY)
.Anchor(NSLayoutAttribute.Right, _imageView, NSLayoutAttribute.Left, -margin);
}
开发者ID:sebbarg,项目名称:yagnix,代码行数:26,代码来源:Header.cs
示例18: Transform
protected override UIImage Transform(UIImage source)
{
using (var colorSpace = CGColorSpace.CreateDeviceGray())
{
return ColorSpaceTransformation.ToColorSpace(source, colorSpace);
}
}
开发者ID:Sohojoe,项目名称:ImagePickerCropAndResize,代码行数:7,代码来源:GrayscaleTransformation.cs
示例19: MenuElement
public MenuElement(string title, UIImage image, Action tapped)
: base(string.Empty)
{
_title = title;
_image = image;
_tappedAction = tapped;
}
开发者ID:GSerjo,项目名称:ImagePocket,代码行数:7,代码来源:MenuElement.cs
示例20: Add
public void Add(string key, UIImage value)
{
if (string.IsNullOrWhiteSpace(key) || value == null)
return;
_cache.SetCost(value, new NSString(key), value.GetMemorySize());
}
开发者ID:jv9,项目名称:FFImageLoading,代码行数:7,代码来源:ImageCache.cs
注:本文中的UIKit.UIImage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论