Esempio n. 1
0
 /// <summary>
 /// Draws a bitmap image.
 /// </summary>
 /// <param name="source">The bitmap image.</param>
 /// <param name="opacity">The opacity to draw with.</param>
 /// <param name="sourceRect">The rect in the image to draw.</param>
 /// <param name="destRect">The rect in the output to draw to.</param>
 public void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect)
 {
     BitmapImpl impl = (BitmapImpl)source.PlatformImpl;
     Bitmap d2d = impl.GetDirect2DBitmap(_renderTarget);
     _renderTarget.DrawBitmap(
         d2d,
         destRect.ToSharpDX(),
         (float)opacity,
         BitmapInterpolationMode.Linear,
         sourceRect.ToSharpDX());
 }
Esempio n. 2
0
        /// <summary>
        /// Draws a bitmap image.
        /// </summary>
        /// <param name="source">The bitmap image.</param>
        /// <param name="opacity">The opacity to draw with.</param>
        /// <param name="sourceRect">The rect in the image to draw.</param>
        /// <param name="destRect">The rect in the output to draw to.</param>
        public void DrawImage(IBitmap source, double opacity, Rect sourceRect, Rect destRect)
        {
            BitmapImpl impl = (BitmapImpl)source.PlatformImpl;
            Bitmap     d2d  = impl.GetDirect2DBitmap(_renderTarget);

            _renderTarget.DrawBitmap(
                d2d,
                destRect.ToSharpDX(),
                (float)opacity,
                BitmapInterpolationMode.Linear,
                sourceRect.ToSharpDX());
        }
Esempio n. 3
0
        public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
        {
            var impl   = bitmap.PlatformImpl as BitmapImpl;
            var size   = new Size(impl.PixelWidth, impl.PixelHeight);
            var scaleX = destRect.Size.Width / sourceRect.Size.Width;
            var scaleY = destRect.Size.Height / sourceRect.Size.Height;

            this.context.Save();
            this.context.Scale(scaleX, scaleY);
            this.context.SetSourceSurface(impl.Surface, (int)sourceRect.X, (int)sourceRect.Y);
            this.context.Rectangle(destRect.ToCairo());
            this.context.Fill();
            this.context.Restore();
        }
Esempio n. 4
0
        public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
        {
            var impl = bitmap.PlatformImpl as BitmapImpl;
            var size = new Size(impl.PixelWidth, impl.PixelHeight);
            var scaleX = destRect.Size.Width / sourceRect.Size.Width;
            var scaleY = destRect.Size.Height / sourceRect.Size.Height;

            this.context.Save();
            this.context.Scale(scaleX, scaleY);
            this.context.SetSourceSurface(impl.Surface, (int)sourceRect.X, (int)sourceRect.Y);
            this.context.Rectangle(sourceRect.ToCairo());
            this.context.Fill();
            this.context.Restore();
        }