Beispiel #1
0
        public override void DrawImage(GraphicsHandler graphics, RectangleF source, RectangleF destination)
        {
            var destRect = graphics.TranslateView(destination.ToSD(), false).ToEto();
            var drawRect = GetDrawRect(ref source, ref destRect, Control.Size.ToEto());

            graphics.Control.ClipToRect(destRect.ToSD());             // first apply the clip since destination is in view coordinates.
            Control.Draw(drawRect.ToSD(), CGBlendMode.Normal, 1);
        }
Beispiel #2
0
        public override void DrawImage(GraphicsHandler graphics, RectangleF source, RectangleF destination)
        {
            var    sourceRect = source.ToNS();
            var    imgsize    = Control.Size;
            CGRect destRect   = graphics.TranslateView(destination.ToNS(), false);

            if (source.TopLeft != Point.Empty || sourceRect.Size != imgsize)
            {
                graphics.Control.TranslateCTM(destRect.X - sourceRect.X, imgsize.Height - (destRect.Y - sourceRect.Y));
                graphics.Control.ScaleCTM(imgsize.Width / sourceRect.Width, -(imgsize.Height / sourceRect.Height));
                graphics.Control.DrawImage(new CGRect(CGPoint.Empty, destRect.Size), Control.CGImage);
            }
            else
            {
                Control.Draw(destRect, CGBlendMode.Normal, 1);
            }
        }