本文整理汇总了C#中Android.Graphics.Rect.ExactCenterY方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.ExactCenterY方法的具体用法?C# Rect.ExactCenterY怎么用?C# Rect.ExactCenterY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Graphics.Rect
的用法示例。
在下文中一共展示了Rect.ExactCenterY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(Canvas c, Rect bounds)
{
RectF arcBounds = mTempBounds;
arcBounds.Set(bounds);
arcBounds.Inset(mStrokeInset, mStrokeInset);
float startAngle = (mStartTrim + mRotation) * 360;
float endAngle = (mEndTrim + mRotation) * 360;
float sweepAngle = endAngle - startAngle;
mPaint.Color = mColors[mColorIndex];
c.DrawArc(arcBounds, startAngle, sweepAngle, false, mPaint);
DrawTriangle(c, startAngle, sweepAngle, bounds);
if (Alpha < 255)
{
mCirclePaint.Color = BackgrounColor;
mCirclePaint.Alpha = 255 - Alpha;
c.DrawCircle(bounds.ExactCenterX(), bounds.ExactCenterY(), bounds.Width() / 2, mCirclePaint);
}
}
示例2: DrawTriangle
private void DrawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds)
{
if (mShowArrow)
{
if (mArrow == null)
{
mArrow = new Path();
mArrow.SetFillType(Path.FillType.EvenOdd);
}
else
{
mArrow.Reset();
}
float x = (float)(RingCenterRadius * Math.Cos(0) + bounds.ExactCenterX());
float y = (float)(RingCenterRadius * Math.Sin(0) + bounds.ExactCenterY());
mArrow.MoveTo(0, 0);
mArrow.LineTo((mArrowWidth) * mArrowScale, 0);
mArrow.LineTo(((mArrowWidth) * mArrowScale / 2), (mArrowHeight * mArrowScale));
mArrow.Offset(x - ((mArrowWidth) * mArrowScale / 2), y);
mArrow.Close();
mArrowPaint.Color = mColors[mColorIndex];
c.Rotate(startAngle + (sweepAngle < 0 ? 0 : sweepAngle) - ARROW_OFFSET_ANGLE, bounds.ExactCenterX(), bounds.ExactCenterY());
c.DrawPath(mArrow, mArrowPaint);
}
}
示例3: IsWithinCircularBounds
static bool IsWithinCircularBounds(Rect hit, Rect bounds)
{
if (!bounds.Contains(hit)) return false;
// Forumula for a circle: (x-a)2 + (y-b)2 = r2
var centerX = bounds.ExactCenterX() - bounds.Left;
var centerY = bounds.ExactCenterY() - bounds.Top;
var radius = centerX;
double x = hit.Left - bounds.Left,
y = hit.Top - bounds.Top,
r2 = radius * radius,
xx = (x - centerX);
var yy = Math.Sqrt(r2 - xx*xx) + 0.5;
var upperBound = centerY - yy;
var lowerBound = centerY + yy;
var result = !Double.IsNaN (y) && y > upperBound && y < lowerBound;
return result;
}