public void DrawImage(Bitmap bitmap, Rectangle target, Rectangle source, GraphicsUnit gu) { this.paint.Flags = 0; using (droid.Rect sa = source.ToRect()) using (droid.Rect ta = target.ToRect()) { this.canvas.DrawBitmap(bitmap.ABitmap, sa, ta, this.paint); } }
public SizeF MeasureString(string text, Font font, int width, StringFormat format) { using (var p = new droid.Paint(this.paint)) using (var bounds = new droid.Rect()) using (var fm = p.GetFontMetrics()) { p.TextSize = font.Size; p.SetTypeface(font.FontFamily.Typeface); p.SetStyle(droid.Paint.Style.Stroke); p.GetTextBounds(text, 0, text.Length, bounds); var height = -fm.Top + fm.Bottom; return(new SizeF(width, height)); } }
public SizeF MeasureString(string text, Font font, int width, StringFormat format) { using (var p = new droid.Paint(this.paint)) using (var bounds = new droid.Rect()) using (var fm = p.GetFontMetrics()) { p.TextSize = font.Size; p.SetTypeface(font.FontFamily.Typeface); p.SetStyle(droid.Paint.Style.Stroke); p.GetTextBounds(text, 0, text.Length, bounds); var height = -fm.Top + fm.Bottom; return new SizeF(width, height); } }