本文整理汇总了C#中Android.Graphics.RectF.CenterY方法的典型用法代码示例。如果您正苦于以下问题:C# RectF.CenterY方法的具体用法?C# RectF.CenterY怎么用?C# RectF.CenterY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Graphics.RectF
的用法示例。
在下文中一共展示了RectF.CenterY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transition
public Transition(RectF srcRect, RectF dstRect, long duration, IInterpolator interpolator) {
if (!MathUtils.HaveSameAspectRatio(srcRect, dstRect)) {
throw new IncompatibleRatioException();
}
_mSrcRect = srcRect;
_mDstRect = dstRect;
_mDuration = duration;
_mInterpolator = interpolator;
// Precomputes a few variables to avoid doing it in onDraw().
_mWidthDiff = dstRect.Width() - srcRect.Width();
_mHeightDiff = dstRect.Height() - srcRect.Height();
_mCenterXDiff = dstRect.CenterX() - srcRect.CenterX();
_mCenterYDiff = dstRect.CenterY() - srcRect.CenterY();
}
示例2: configureTransform
//Configures the neccesary matrix transformation to apply to the textureView
public void configureTransform(int viewWidth, int viewHeight)
{
if (null == Activity || null == previewSize || null == textureView)
return;
int rotation = (int)Activity.WindowManager.DefaultDisplay.Rotation;
var matrix = new Matrix ();
var viewRect = new RectF (0, 0, viewWidth, viewHeight);
var bufferRect = new RectF (0, 0, previewSize.Height, previewSize.Width);
float centerX = viewRect.CenterX();
float centerY = viewRect.CenterY();
if ((int)SurfaceOrientation.Rotation90 == rotation || (int)SurfaceOrientation.Rotation270 == rotation) {
bufferRect.Offset ((centerX - bufferRect.CenterX()), (centerY - bufferRect.CenterY()));
matrix.SetRectToRect (viewRect, bufferRect, Matrix.ScaleToFit.Fill);
float scale = System.Math.Max (
(float)viewHeight / previewSize.Height,
(float)viewHeight / previewSize.Width);
matrix.PostScale (scale, scale, centerX, centerY);
matrix.PostRotate (90 * (rotation - 2), centerX, centerY);
}
textureView.SetTransform (matrix);
}
示例3: ConfigureTransform
/// <summary>
/// Configures the necessary transformation to mTextureView.
/// This method should be called after the camera preciew size is determined in openCamera, and also the size of mTextureView is fixed
/// </summary>
/// <param name="viewWidth">The width of mTextureView</param>
/// <param name="viewHeight">VThe height of mTextureView</param>
private void ConfigureTransform(int viewWidth, int viewHeight)
{
Activity activity = Activity;
if (mTextureView == null || mPreviewSize == null || activity == null) {
return;
}
SurfaceOrientation rotation = activity.WindowManager.DefaultDisplay.Rotation;
Matrix matrix = new Matrix ();
RectF viewRect = new RectF (0, 0, viewWidth, viewHeight);
RectF bufferRect = new RectF (0, 0, mPreviewSize.Width, mPreviewSize.Height);
float centerX = viewRect.CenterX();
float centerY = viewRect.CenterY();
if (rotation == SurfaceOrientation.Rotation90 || rotation == SurfaceOrientation.Rotation270) {
bufferRect.Offset (centerX - bufferRect.CenterX(), centerY - bufferRect.CenterY());
matrix.SetRectToRect (viewRect, bufferRect, Matrix.ScaleToFit.Fill);
float scale = Math.Max ((float)viewHeight / mPreviewSize.Height, (float)viewWidth / mPreviewSize.Width);
matrix.PostScale (scale, scale, centerX, centerY);
matrix.PostRotate (90 * ((int)rotation - 2), centerX, centerY);
}
mTextureView.SetTransform (matrix);
}
示例4: OnDraw
public override void OnDraw(Canvas canvas, RectF bounds, float degreeSelected)
{
canvas.DrawRect(bounds,BackgroundPaint);
canvas.DrawText(Text, bounds.CenterX(), bounds.CenterY() - (TextPaint.Descent() + TextPaint.Ascent()) / 2, TextPaint);
}
示例5: OnSizeChanged
protected override void OnSizeChanged (int w, int h, int oldW, int oldH)
{
HEIGHT = h;
WIDTH = w;
HALF_WIDTH = (int)Math.Round ((Double)w / 2);
HALF_HEIGHT = (int)(Math.Round ((Double)h / 2));
//int OFFSET = mCenterOval.Width () / 3.0f;
mCenterOval = new RectF ();
//float OFFSET = 140f;
//Change the OFFSET to relative value according to the screen width
float OFFSET = WIDTH / 5;
//mCenterOval.Set (OFFSET, OFFSET, WIDTH - OFFSET, WIDTH - OFFSET);
//move the mCenterOval a little bit up
mCenterOval.Set (OFFSET, OFFSET * (float)0.5, WIDTH - OFFSET, WIDTH - (float)1.5 * OFFSET);
mCx = (int)Math.Round (mCenterOval.CenterX ());
mCy = (int)Math.Round (mCenterOval.CenterY ());
mRadius = (int)Math.Round (mCenterOval.Width () / 2.0f);
mInnerCircleRadius = mRadius - (mPaint.StrokeWidth * 0.9f);
updateCircleCoordinate (mCx, 0);
}