当前位置: 首页>>代码示例>>C#>>正文


C# Paint.Ascent方法代码示例

本文整理汇总了C#中Android.Graphics.Paint.Ascent方法的典型用法代码示例。如果您正苦于以下问题:C# Paint.Ascent方法的具体用法?C# Paint.Ascent怎么用?C# Paint.Ascent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Graphics.Paint的用法示例。


在下文中一共展示了Paint.Ascent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AndroidFontMetrics

 public AndroidFontMetrics(Paint paint)
 {
     _widths = new float[NumWidths];
     paint.GetTextWidths (_chars, 0, NumWidths, _widths);
     Ascent = (int)(Math.Abs (paint.Ascent ()) + 0.5f);
     Descent = (int)(paint.Descent ()/2 + 0.5f);
     Height = Ascent;
 }
开发者ID:nissan,项目名称:CrossGraphics,代码行数:8,代码来源:AndroidGraphics.cs

示例2: CreateBitmapData

		void CreateBitmapData (string str, out byte[] bitmapData, out int width, out int height)
		{
			Paint paint = new Paint ();
			paint.TextSize = 128;
			paint.TextAlign = Paint.Align.Left;
			paint.SetTypeface (Typeface.Default);
			width = height = 256;
			float textWidth = paint.MeasureText (str);

			using (Bitmap bitmap = Bitmap.CreateBitmap (width, height, Bitmap.Config.Argb8888)) {
				Canvas canvas = new Canvas (bitmap);
				paint.Color = str != " " ? Color.White : Color.LightGray;
				canvas.DrawRect (new Rect (0, 0, width, height), paint);
				paint.Color = Color.Black;
				canvas.DrawText (str, (256 - textWidth) / 2f, (256 - paint.Descent () - paint.Ascent ()) / 2f, paint);
				bitmapData = new byte [width * height * 4];
				Java.Nio.ByteBuffer buffer = Java.Nio.ByteBuffer.Allocate (bitmapData.Length);
				bitmap.CopyPixelsToBuffer (buffer);
				buffer.Rewind ();
				buffer.Get (bitmapData, 0, bitmapData.Length);
			}
		}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:22,代码来源:GLView1.cs

示例3: CalcBounds

 private Rect CalcBounds(int index, Paint paint)
 {
     var bounds = new Rect();
     var title = GetTitle(index);
     bounds.Right = (int)paint.MeasureText(title);
     bounds.Bottom = (int)(paint.Descent() - paint.Ascent());
     return bounds;
 }
开发者ID:SeeD-Seifer,项目名称:ViewPagerIndicator,代码行数:8,代码来源:TitlePageIndicator.cs

示例4: CalcBounds

 /**
  * Calculate the bounds for a view's title
  *
  * @param index
  * @param paint
  * @return
  */
 private RectF CalcBounds(int index, Paint paint)
 {
     //Calculate the text bounds
     RectF bounds = new RectF();
     bounds.Right = paint.MeasureText(mTitleProvider.GetTitle(index));
     bounds.Bottom = paint.Descent() - paint.Ascent();
     return bounds;
 }
开发者ID:4ndr01d,项目名称:monodroid-samples,代码行数:15,代码来源:TitlePageIndicator.cs

示例5: calcBounds

 /**
  * Calculate the bounds for a view's title
  *
  * @param index
  * @param paint
  * @return
  */
 private Rect calcBounds(int index, Paint paint)
 {
     //Calculate the text bounds
     Rect bounds = new Rect();
     string title = getTitle(index);
     bounds.Right = (int)paint.MeasureText(title, 0, title.Length);
     bounds.Bottom = (int)(paint.Descent() - paint.Ascent());
     return bounds;
 }
开发者ID:skywolf888,项目名称:ViewPagerIndicator.Net,代码行数:16,代码来源:TitlePageIndicator.cs


注:本文中的Android.Graphics.Paint.Ascent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。