本文整理汇总了C#中CGBitmapContext.AddArc方法的典型用法代码示例。如果您正苦于以下问题:C# CGBitmapContext.AddArc方法的具体用法?C# CGBitmapContext.AddArc怎么用?C# CGBitmapContext.AddArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGBitmapContext
的用法示例。
在下文中一共展示了CGBitmapContext.AddArc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCell
public override UITableViewCell GetCell (UITableView tv)
{
var cell = tv.DequeueReusableCell (ikey);
if (cell == null){
cell = new UITableViewCell (UITableViewCellStyle.Default, ikey);
}
if (scaled == null)
return cell;
Section psection = Parent as Section;
bool roundTop = psection.Elements [0] == this;
bool roundBottom = psection.Elements [psection.Elements.Count-1] == this;
using (var cs = CGColorSpace.CreateDeviceRGB ()){
using (var bit = new CGBitmapContext (IntPtr.Zero, dimx, dimy, 8, 0, cs, CGImageAlphaInfo.PremultipliedFirst)){
// Clipping path for the image, different on top, middle and bottom.
if (roundBottom){
bit.AddArc (rad, rad, rad, (float) Math.PI, (float) (3*Math.PI/2), false);
} else {
bit.MoveTo (0, rad);
bit.AddLineToPoint (0, 0);
}
bit.AddLineToPoint (dimx, 0);
bit.AddLineToPoint (dimx, dimy);
if (roundTop){
bit.AddArc (rad, dimy-rad, rad, (float) (Math.PI/2), (float) Math.PI, false);
bit.AddLineToPoint (0, rad);
} else {
bit.AddLineToPoint (0, dimy);
}
bit.Clip ();
bit.DrawImage (rect, scaled.CGImage);
cell.ImageView.Image = UIImage.FromImage (bit.ToImage ());
cell.TextLabel.Text = "image profile";
}
}
return cell;
}
示例2: InitializeCell
public override void InitializeCell(UITableView tableView)
{
if (_Scaled != null)
{
bool roundTop = Section.Elements[0] == this;
bool roundBottom = Section.Elements[Section.Elements.Count - 1] == this;
using (var cs = CGColorSpace.CreateDeviceRGB())
{
using (var bit = new CGBitmapContext(IntPtr.Zero, dimx, dimy, 8, 0, cs, CGImageAlphaInfo.PremultipliedFirst))
{
// Clipping path for the image, different on top, middle and bottom.
if (roundBottom)
{
bit.AddArc(rad, rad, rad, (float)Math.PI, (float)(3 * Math.PI / 2), false);
}
else
{
bit.MoveTo(0, rad);
bit.AddLineToPoint(0, 0);
}
bit.AddLineToPoint(dimx, 0);
bit.AddLineToPoint(dimx, dimy);
if (roundTop)
{
bit.AddArc(rad, dimy - rad, rad, (float)(Math.PI / 2), (float)Math.PI, false);
bit.AddLineToPoint(0, rad);
}
else
{
bit.AddLineToPoint(0, dimy);
}
bit.Clip();
bit.DrawImage(rect, _Scaled.CGImage);
Cell.ImageView.Image = UIImage.FromImage(bit.ToImage());
}
}
}
}