示例#1
0
 public NativeGraphicsView(Context context, IDrawable drawable = null) : base(context)
 {
     _scale         = Resources.DisplayMetrics.Density;
     _canvas        = new NativeCanvas(context);
     _scalingCanvas = new ScalingCanvas(_canvas);
     Drawable       = drawable;
 }
示例#2
0
        public NativeBitmapExportContext(int width, int height, float displayScale = 1, int dpi = 72, bool disposeBitmap = true, bool transparent = true) : base(width, height, dpi)
        {
            _bitmap = Bitmap.CreateBitmap(
                width,
                height,
                transparent
                    ? Bitmap.Config.Argb8888
                    : Bitmap.Config.Rgb565);

            _androidCanvas = new Canvas(_bitmap);
            var nativeCanvas = new NativeCanvas(null)
            {
                Canvas = _androidCanvas,
            };

            _canvas = new ScalingCanvas(nativeCanvas)
            {
                DisplayScale = displayScale
            };
            _disposeBitmap = disposeBitmap;
        }