Example #1
0
 public void DrawImage(Image image, int x, int y, Rectangle source, GraphicsUnit gu)
 {
     Flush();
     APaint.Flags = (Android.Graphics.PaintFlags)0;
     var sa = source.ToA();
     var da = new Android.Graphics.Rect(x,y, x+source.Width, y+source.Height);
     ACanvas.DrawBitmap((image as Bitmap).ABitmap, sa, da, APaint);
     da.Dispose();
     sa.Dispose();
 }
Example #2
0
        public void DrawImage(Image image, Rectangle to, int fromx, int fromy, int fromw, int fromh, GraphicsUnit gu, ImageAttributes ia)
        {
            Flush();

            APaint.Flags = (Android.Graphics.PaintFlags)0;
            var sa = new Android.Graphics.Rect(fromx, fromy, fromx+fromw, fromy+fromh);
            var da = to.ToA();

            Android.Graphics.Paint p = null;
            Android.Graphics.ColorMatrixColorFilter cmf = null;
            if (ia != null && ia.GetColorMatrix() != null){
                p = new Android.Graphics.Paint(APaint);
                var values = ia.GetColorMatrix().Matrix;
                float[] v2 = values[0].Concat(values[1]).Concat(values[2]).Concat(values[3]).ToArray();
                cmf = new Android.Graphics.ColorMatrixColorFilter(v2);
                p.SetColorFilter(cmf);
            }
            ACanvas.DrawBitmap((image as Bitmap).ABitmap, sa, da, p == null ? APaint : p);
            if (p != null) p.Dispose();
            if (cmf != null) cmf.Dispose();
            da.Dispose();
            sa.Dispose();
        }
Example #3
0
 public void DrawImage(Image image, Rectangle target, Rectangle source, GraphicsUnit gu)
 {
     Flush();
     APaint.Flags = (Android.Graphics.PaintFlags)0;
     var sa = source.ToA();
     var ta = target.ToA();
     ACanvas.DrawBitmap((image as Bitmap).ABitmap, sa, ta, APaint);
     sa.Dispose();
     ta.Dispose();
 }