예제 #1
0
파일: IconHandler.cs 프로젝트: pcdummy/Eto
        public override void DrawImage(GraphicsHandler graphics, RectangleF source, RectangleF destination)
        {
            var sourceRect = graphics.Translate(source.ToSD(), Control.Size.Height);
            var destRect   = graphics.TranslateView(destination.ToSD(), true, true);

            graphics.Control.ConcatCTM(new CGAffineTransform(1, 0, 0, -1, 0, graphics.ViewHeight));
            destRect.Y = graphics.ViewHeight - destRect.Y - destRect.Height;
            Control.Draw(destRect, sourceRect, NSCompositingOperation.SourceOver, 1);
        }
예제 #2
0
        /*
         * public override void DrawImage (GraphicsHandler graphics, int x, int y)
         * {
         *      var nsimage = this.Control;
         *      var sourceRect = graphics.Translate(new SD.RectangleF(0, 0, nsimage.Size.Width, nsimage.Size.Height), nsimage.Size.Height);
         *      var destRect = graphics.TranslateView(new SD.RectangleF(x, y, nsimage.Size.Width, nsimage.Size.Height), false);
         *      nsimage.Draw(destRect, sourceRect, NSCompositingOperation.SourceOver, 1);
         * }
         *
         * public override void DrawImage (GraphicsHandler graphics, int x, int y, int width, int height)
         * {
         *      var nsimage = this.Control;
         *      var sourceRect = graphics.Translate(new SD.RectangleF(0, 0, nsimage.Size.Width, nsimage.Size.Height), nsimage.Size.Height);
         *      var destRect = graphics.TranslateView(new SD.RectangleF(x, y, width, height), false);
         *      nsimage.Draw(destRect, sourceRect, NSCompositingOperation.SourceOver, 1);
         * }
         */

        public override void DrawImage(GraphicsHandler graphics, Rectangle source, Rectangle destination)
        {
            var nsimage    = this.Control;
            var sourceRect = graphics.Translate(Generator.ConvertF(source), nsimage.Size.Height);
            var destRect   = graphics.TranslateView(Generator.ConvertF(destination), false);

            if (alpha)
            {
                nsimage.Draw(destRect, sourceRect, NSCompositingOperation.SourceOver, 1);
            }
            else
            {
                nsimage.Draw(destRect, sourceRect, NSCompositingOperation.Copy, 1);
            }
        }
예제 #3
0
        public override void DrawImage(GraphicsHandler graphics, RectangleF source, RectangleF destination)
        {
            var sourceRect = graphics.Translate(source.ToSD(), Control.Size.Height);
            var destRect   = graphics.TranslateView(destination.ToSD(), true, true);

            graphics.FlipDrawing();
            destRect.Y = graphics.ViewHeight - destRect.Y - destRect.Height;
            if (alpha)
            {
                Control.Draw(destRect, sourceRect, NSCompositingOperation.SourceOver, 1);
            }
            else
            {
                Control.Draw(destRect, sourceRect, NSCompositingOperation.Copy, 1);
            }
        }