本文整理汇总了C#中Android.Graphics.Canvas.DrawPicture方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawPicture方法的具体用法?C# Canvas.DrawPicture怎么用?C# Canvas.DrawPicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Graphics.Canvas
的用法示例。
在下文中一共展示了Canvas.DrawPicture方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeBitmapFromPicture
internal static Bitmap MakeBitmapFromPicture (Picture pic, int width, int height)
{
using (var bmp = Bitmap.CreateBitmap (width, height, Bitmap.Config.Argb8888)) {
using (var c = new Canvas (bmp)) {
var dst = new RectF (0, 0, width, height);
c.DrawPicture (pic, dst);
}
// Returns an immutable copy
return Bitmap.CreateBitmap (bmp);
}
}
示例2: GetBitmapFromSvgString
public static Bitmap GetBitmapFromSvgString(string svgString, int width, int height)
{
var svg = SVGParser.ParseSVGFromString (svgString);
var bmp = Bitmap.CreateBitmap (width, height, Bitmap.Config.Argb8888);
using (var c = new Canvas (bmp)) {
var dst = new RectF (0, 0, width, height);
c.DrawPicture (svg.Picture, dst);
}
// Returns an immutable copy
return Bitmap.CreateBitmap (bmp);
}
示例3: GetBitmapFromSvgRes
public static Bitmap GetBitmapFromSvgRes(Android.Content.Res.Resources resources, int resID,
int width, int height)
{
var svg = SVGParser.ParseSVGFromResource (resources,
resID);
var bmp = Bitmap.CreateBitmap (width, height, Bitmap.Config.Argb8888);
using (var c = new Canvas (bmp)) {
var dst = new RectF (0, 0, width, height);
c.DrawPicture (svg.Picture, dst);
}
// Returns an immutable copy
return Bitmap.CreateBitmap (bmp);
}
示例4: GetPin
public Bitmap GetPin(float ratio, int number, int width, int height, float alpha = 1)
{
int key = number + ((int)(ratio * 10000)) << 6;
Bitmap bmp;
if (pinCache.TryGetValue (key, out bmp))
return bmp;
var svg = SVGParser.ParseSVGFromResource (context.Resources,
Resource.Raw.pin,
SvgColorMapperFactory.FromFunc (c => ColorReplacer (c, ratio, alpha)));
bmp = Bitmap.CreateBitmap (width, height, Bitmap.Config.Argb8888);
using (var c = new Canvas (bmp)) {
var dst = new RectF (0, 0, width, height);
c.DrawPicture (svg.Picture, dst);
c.DrawText (number.ToString (), width / 2 - 1, 16.ToPixels (), textPaint);
}
pinCache [key] = bmp;
return bmp;
}
示例5: DispatchDraw
protected override void DispatchDraw(Canvas canvas)
{
base.DispatchDraw (mPicture.BeginRecording (Width, Height));
mPicture.EndRecording ();
int x = Width / 2;
int y = Height / 2;
if (false)
canvas.DrawPicture (mPicture);
else {
DrawPict (canvas, 0, 0, x, y, 1, 1);
DrawPict (canvas, x, 0, x, y, -1, 1);
DrawPict (canvas, 0, y, x, y, 1, -1);
DrawPict (canvas, x, y, x, y, -1, -1);
}
}
示例6: DrawPict
private void DrawPict(Canvas canvas, int x, int y, int w, int h, float sx, float sy)
{
canvas.Save ();
canvas.Translate (x, y);
canvas.ClipRect (0, 0, w, h);
canvas.Scale (0.5f, 0.5f);
canvas.Scale (sx, sy, w, h);
canvas.DrawPicture (mPicture);
canvas.Restore ();
}