Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImmutableImageBrush"/> class.
 /// </summary>
 /// <param name="source">The image to draw.</param>
 /// <param name="alignmentX">The horizontal alignment of a tile in the destination.</param>
 /// <param name="alignmentY">The vertical alignment of a tile in the destination.</param>
 /// <param name="destinationRect">The rectangle on the destination in which to paint a tile.</param>
 /// <param name="opacity">The opacity of the brush.</param>
 /// <param name="transform">The transform of the brush.</param>
 /// <param name="transformOrigin">The transform origin of the brush</param>
 /// <param name="sourceRect">The rectangle of the source image that will be displayed.</param>
 /// <param name="stretch">
 /// How the source rectangle will be stretched to fill the destination rect.
 /// </param>
 /// <param name="tileMode">The tile mode.</param>
 /// <param name="bitmapInterpolationMode">The bitmap interpolation mode.</param>
 public ImmutableImageBrush(
     IBitmap source,
     AlignmentX alignmentX        = AlignmentX.Center,
     AlignmentY alignmentY        = AlignmentY.Center,
     RelativeRect?destinationRect = null,
     double opacity = 1,
     ImmutableTransform?transform  = null,
     RelativePoint transformOrigin = new RelativePoint(),
     RelativeRect?sourceRect       = null,
     Stretch stretch   = Stretch.Uniform,
     TileMode tileMode = TileMode.None,
     BitmapInterpolationMode bitmapInterpolationMode = BitmapInterpolationMode.Default)
     : base(
         alignmentX,
         alignmentY,
         destinationRect ?? RelativeRect.Fill,
         opacity,
         transform,
         transformOrigin,
         sourceRect ?? RelativeRect.Fill,
         stretch,
         tileMode,
         bitmapInterpolationMode)
 {
     Source = source;
 }
Example #2
0
        /// <summary>
        /// Draws the given bitmap.
        /// </summary>
        /// <param name="bitmap">The bitmap.</param>
        /// <param name="destinationRectangle">The target rectangle where to draw the bitmap.</param>
        /// <param name="opacity">The opacity.</param>
        /// <param name="interpolationMode">The interpolation mode.</param>
        /// <param name="frameIndex">The frame of the bitmap to be rendered.</param>
        public void DrawBitmap(
            BitmapResource bitmap,
            RectangleF destinationRectangle,
            float opacity = 1f,
            BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.NearestNeighbor,
            int frameIndex = 0)
        {
            if (_renderTarget == null)
            {
                return;
            }

            bitmap.EnsureNotNull(nameof(bitmap));
            destinationRectangle.EnsureNotEmpty(nameof(destinationRectangle));
            opacity.EnsureInRange(0f, 1f, nameof(opacity));

            var bitmapFrameCount = bitmap.TotalFrameCount;

            frameIndex.EnsureInRange(0, bitmapFrameCount - 1, nameof(frameIndex));

            // Render the bitmap
            if (bitmapFrameCount > 1)
            {
                // Get the native bitmap object first
                // (if not, we may not have loaded it already and therefore
                //  missing size information)
                var nativeBitmap = bitmap.GetBitmap(this.Device);

                // Calculate source rectangle
                var framesX           = bitmap.FrameCountX;
                var xFrameIndex       = frameIndex % framesX;
                var yFrameIndex       = (frameIndex - xFrameIndex) / framesX;
                var singleFrameWidth  = bitmap.SingleFramePixelWidth;
                var singleFrameHeight = bitmap.SingleFramePixelHeight;
                var sourceRectangle   = new RectangleF(
                    xFrameIndex * singleFrameWidth,
                    yFrameIndex * singleFrameHeight,
                    singleFrameWidth, singleFrameHeight);

                // Render tiled bitmap
                _renderTarget.DrawBitmap(
                    nativeBitmap,
                    destinationRectangle,
                    opacity,
                    (D2D.BitmapInterpolationMode)interpolationMode,
                    sourceRectangle);
            }
            else
            {
                // Render non-tiled bitmap
                _renderTarget.DrawBitmap(
                    bitmap.GetBitmap(this.Device),
                    destinationRectangle,
                    opacity,
                    (D2D.BitmapInterpolationMode)interpolationMode,
                    null);
            }
        }
Example #3
0
 /// <summary>
 /// <p>Renders part or all of the given sprite batch to the device context using the specified drawing options.</p>
 /// </summary>
 /// <param name="spriteBatch"><dd>  <p>The sprite batch to draw.</p> </dd></param>
 /// <param name="startIndex"><dd>  <p>The index of the first sprite in the sprite batch to draw.</p> </dd></param>
 /// <param name="spriteCount"><dd>  <p>The number of sprites to draw.</p> </dd></param>
 /// <param name="bitmap"><dd>  <p>The bitmap from which the sprites are to be sourced. Each sprite?s source rectangle refers to a portion of this bitmap.</p> </dd></param>
 /// <param name="interpolationMode"><dd>  <p>The interpolation mode to use when drawing this sprite batch. This determines how Direct2D interpolates pixels within the drawn sprites if scaling is performed.</p> </dd></param>
 /// <param name="spriteOptions"><dd>  <p>The additional drawing options, if any, to be used for this sprite batch.</p> </dd></param>
 /// <returns><p>If this method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>
 /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='ID2D1CommandSink3::DrawSpriteBatch']/*"/>
 /// <msdn-id>mt619823</msdn-id>
 /// <unmanaged>HRESULT ID2D1CommandSink3::DrawSpriteBatch([In] ID2D1SpriteBatch* spriteBatch,[In] unsigned int startIndex,[In] unsigned int spriteCount,[In] ID2D1Bitmap* bitmap,[In] D2D1_BITMAP_INTERPOLATION_MODE interpolationMode,[In] D2D1_SPRITE_OPTIONS spriteOptions)</unmanaged>
 /// <unmanaged-short>ID2D1CommandSink3::DrawSpriteBatch</unmanaged-short>
 public void DrawSpriteBatch(SpriteBatch spriteBatch,
                             int startIndex,
                             int spriteCount,
                             Bitmap bitmap,
                             BitmapInterpolationMode interpolationMode,
                             SpriteOptions spriteOptions)
 {
     DrawSpriteBatch_(spriteBatch, startIndex, spriteCount, bitmap, interpolationMode, spriteOptions);
 }
 /// <summary>	
 /// <p>Renders part or all of the given sprite batch to the device context using the specified drawing options.</p>	
 /// </summary>	
 /// <param name="spriteBatch"><dd>  <p>The sprite batch to draw.</p> </dd></param>	
 /// <param name="startIndex"><dd>  <p>The index of the first sprite in the sprite batch to draw.</p> </dd></param>	
 /// <param name="spriteCount"><dd>  <p>The number of sprites to draw.</p> </dd></param>	
 /// <param name="bitmap"><dd>  <p>The bitmap from which the sprites are to be sourced. Each sprite?s source rectangle refers to a portion of this bitmap.</p> </dd></param>	
 /// <param name="interpolationMode"><dd>  <p>The interpolation mode to use when drawing this sprite batch. This determines how Direct2D interpolates pixels within the drawn sprites if scaling is performed.</p> </dd></param>	
 /// <param name="spriteOptions"><dd>  <p>The additional drawing options, if any, to be used for this sprite batch.</p> </dd></param>	
 /// <returns><p>If this method succeeds, it returns <strong><see cref="SharpDX.Result.Ok"/></strong>. Otherwise, it returns an <strong><see cref="SharpDX.Result"/></strong> error code.</p></returns>	
 /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='ID2D1CommandSink3::DrawSpriteBatch']/*"/>	
 /// <msdn-id>mt619823</msdn-id>	
 /// <unmanaged>HRESULT ID2D1CommandSink3::DrawSpriteBatch([In] ID2D1SpriteBatch* spriteBatch,[In] unsigned int startIndex,[In] unsigned int spriteCount,[In] ID2D1Bitmap* bitmap,[In] D2D1_BITMAP_INTERPOLATION_MODE interpolationMode,[In] D2D1_SPRITE_OPTIONS spriteOptions)</unmanaged>	
 /// <unmanaged-short>ID2D1CommandSink3::DrawSpriteBatch</unmanaged-short>	
 public void DrawSpriteBatch(SpriteBatch spriteBatch,
     int startIndex,
     int spriteCount,
     Bitmap bitmap,
     BitmapInterpolationMode interpolationMode,
     SpriteOptions spriteOptions)
 {
     DrawSpriteBatch_(spriteBatch, startIndex, spriteCount, bitmap, interpolationMode, spriteOptions);
 }
 public BitmapBrushProperties(
     ExtendMode extendModeX = ExtendMode.Clamp,
     ExtendMode extendModeY = ExtendMode.Clamp,
     BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.Linear)
 {
     ExtendModeX       = extendModeX;
     ExtendModeY       = extendModeY;
     InterpolationMode = interpolationMode;
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageNode"/> class.
 /// </summary>
 /// <param name="transform">The transform.</param>
 /// <param name="source">The image to draw.</param>
 /// <param name="opacity">The draw opacity.</param>
 /// <param name="sourceRect">The source rect.</param>
 /// <param name="destRect">The destination rect.</param>
 /// <param name="bitmapInterpolationMode">The bitmap interpolation mode.</param>
 public ImageNode(Matrix transform, IRef <IBitmapImpl> source, double opacity, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode)
     : base(destRect, transform, null)
 {
     Transform  = transform;
     Source     = source.Clone();
     Opacity    = opacity;
     SourceRect = sourceRect;
     DestRect   = destRect;
     BitmapInterpolationMode = bitmapInterpolationMode;
 }
Example #7
0
        public ImmutableBitmap(Stream stream, int decodeSize, bool horizontal, BitmapInterpolationMode interpolationMode)
        {
            using (var skStream = new SKManagedStream(stream))
                using (var codec = SKCodec.Create(skStream))
                {
                    var info = codec.Info;

                    // get the scale that is nearest to what we want (eg: jpg returned 512)
                    var supportedScale = codec.GetScaledDimensions(horizontal ? ((float)decodeSize / info.Width) : ((float)decodeSize / info.Height));

                    // decode the bitmap at the nearest size
                    var nearest = new SKImageInfo(supportedScale.Width, supportedScale.Height);
                    var bmp     = SKBitmap.Decode(codec, nearest);

                    // now scale that to the size that we want
                    var realScale = horizontal ? ((double)info.Height / info.Width) : ((double)info.Width / info.Height);

                    SKImageInfo desired;


                    if (horizontal)
                    {
                        desired = new SKImageInfo(decodeSize, (int)(realScale * decodeSize));
                    }
                    else
                    {
                        desired = new SKImageInfo((int)(realScale * decodeSize), decodeSize);
                    }

                    if (bmp.Width != desired.Width || bmp.Height != desired.Height)
                    {
                        if (bmp.Height != bmp.Width)
                        {
                        }
                        var scaledBmp = bmp.Resize(desired, interpolationMode.ToSKFilterQuality());
                        bmp.Dispose();
                        bmp = scaledBmp;
                    }

                    _image = SKImage.FromBitmap(bmp);
                    bmp.Dispose();

                    if (_image == null)
                    {
                        throw new ArgumentException("Unable to load bitmap from provided data");
                    }

                    PixelSize = new PixelSize(_image.Width, _image.Height);

                    // TODO: Skia doesn't have an API for DPI.
                    Dpi = new Vector(96, 96);
                }
        }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageRenderUnit" /> class.
 /// </summary>
 /// <param name="bitmap">The bitmap.</param>
 /// <param name="src">The source rectangle.</param>
 /// <param name="dest">The destination rectangle.</param>
 /// <param name="opacity">The opacity.</param>
 /// <param name="mode">The interpolation mode.</param>
 public ImageRenderUnit(
     Bitmap bitmap,
     RectangleF src,
     RectangleF dest,
     float opacity,
     BitmapInterpolationMode mode)
 {
     this.bitmap  = bitmap;
     this.src     = src;
     this.dest    = dest;
     this.opacity = opacity;
     this.mode    = mode;
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageRenderUnit" /> class.
 /// </summary>
 /// <param name="bitmap">The bitmap.</param>
 /// <param name="src">The source rectangle.</param>
 /// <param name="dest">The destination rectangle.</param>
 /// <param name="opacity">The opacity.</param>
 /// <param name="mode">The interpolation mode.</param>
 public ImageRenderUnit(
     Bitmap bitmap,
     RectangleF src,
     RectangleF dest,
     float opacity,
     BitmapInterpolationMode mode)
 {
     this.bitmap = bitmap;
     this.src = src;
     this.dest = dest;
     this.opacity = opacity;
     this.mode = mode;
 }
Example #10
0
 public void DrawBitmap(
     float x,
     float y,
     Bitmap bitmap,
     float opacity = 1f,
     BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.Linear)
 {
     this.device.DrawBitmap(
         bitmap,
         new RawRectangleF(x, y, x + bitmap.PixelSize.Width, y + bitmap.PixelSize.Height),
         opacity,
         interpolationMode);
 }
Example #11
0
 /// <inheritdoc/>
 void IImage.Draw(
     DrawingContext context,
     Rect sourceRect,
     Rect destRect,
     BitmapInterpolationMode bitmapInterpolationMode)
 {
     context.PlatformImpl.DrawBitmap(
         PlatformImpl,
         1,
         sourceRect,
         destRect,
         bitmapInterpolationMode);
 }
Example #12
0
        public ImmutableBitmap(ImmutableBitmap src, PixelSize destinationSize, BitmapInterpolationMode interpolationMode)
        {
            SKImageInfo info   = new SKImageInfo(destinationSize.Width, destinationSize.Height, SKColorType.Bgra8888);
            SKImage     output = SKImage.Create(info);

            src._image.ScalePixels(output.PeekPixels(), interpolationMode.ToSKFilterQuality());

            _image = output;

            PixelSize = new PixelSize(_image.Width, _image.Height);

            // TODO: Skia doesn't have an API for DPI.
            Dpi = new Vector(96, 96);
        }
        public void Render(IDrawingContext dc, RectFloat clipRect, float opacity, BitmapInterpolationMode interpolationMode)
        {
            if (!this.beforeRenderCalled || this.afterRenderCalled)
            {
                throw new PaintDotNet.InternalErrorException();
            }
            this.renderCalled = true;
            if (this.isRendering)
            {
                throw new InvalidOperationException("Render() is not reentrant");
            }
            RectInt32 sourceRect = RectInt32.Intersect(clipRect.Int32Bound, this.owner.Document.Bounds());

            if (sourceRect.HasPositiveArea)
            {
                this.isRendering = true;
                try
                {
                    bool flag = dc.IsSupported(RenderTargetType.Software, null, null, null);
                    foreach (PointInt32 num3 in this.tileMathHelper.EnumerateTileOffsets(sourceRect))
                    {
                        if (flag)
                        {
                            IBitmap <ColorPbgra32> bitmap2 = this.tileBuffers[num3.Y][num3.X];
                            if ((bitmap2 != null) && bitmap2.IsDisposed)
                            {
                                continue;
                            }
                        }
                        IDeviceBitmap bitmap = this.deviceBitmaps[num3.Y][num3.X];
                        if (bitmap != null)
                        {
                            RectInt32 tileSourceRect = this.tileMathHelper.GetTileSourceRect(num3.X, num3.Y);
                            RectFloat?srcRect        = null;
                            dc.DrawBitmap(bitmap, new RectFloat?(tileSourceRect), opacity, interpolationMode, srcRect);
                        }
                    }
                }
                finally
                {
                    this.isRendering = false;
                }
            }
        }
        public WriteableBitmapImpl(Stream stream, int decodeSize, bool horizontal, BitmapInterpolationMode interpolationMode)
        {
            using (var skStream = new SKManagedStream(stream))
                using (var skData = SKData.Create(skStream))
                    using (var codec = SKCodec.Create(skData))
                    {
                        var info = codec.Info;

                        // get the scale that is nearest to what we want (eg: jpg returned 512)
                        var supportedScale = codec.GetScaledDimensions(horizontal ? ((float)decodeSize / info.Width) : ((float)decodeSize / info.Height));

                        // decode the bitmap at the nearest size
                        var nearest = new SKImageInfo(supportedScale.Width, supportedScale.Height);
                        var bmp     = SKBitmap.Decode(codec, nearest);

                        // now scale that to the size that we want
                        var realScale = horizontal ? ((double)info.Height / info.Width) : ((double)info.Width / info.Height);

                        SKImageInfo desired;


                        if (horizontal)
                        {
                            desired = new SKImageInfo(decodeSize, (int)(realScale * decodeSize));
                        }
                        else
                        {
                            desired = new SKImageInfo((int)(realScale * decodeSize), decodeSize);
                        }

                        if (bmp.Width != desired.Width || bmp.Height != desired.Height)
                        {
                            var scaledBmp = bmp.Resize(desired, interpolationMode.ToSKFilterQuality());
                            bmp.Dispose();
                            bmp = scaledBmp;
                        }

                        _bitmap = bmp;

                        PixelSize = new PixelSize(bmp.Width, bmp.Height);
                        Dpi       = SkiaPlatform.DefaultDpi;
                    }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageBrush"/> class.
 /// </summary>
 /// <param name="alignmentX">The horizontal alignment of a tile in the destination.</param>
 /// <param name="alignmentY">The vertical alignment of a tile in the destination.</param>
 /// <param name="destinationRect">The rectangle on the destination in which to paint a tile.</param>
 /// <param name="opacity">The opacity of the brush.</param>
 /// <param name="sourceRect">The rectangle of the source image that will be displayed.</param>
 /// <param name="stretch">
 /// How the source rectangle will be stretched to fill the destination rect.
 /// </param>
 /// <param name="tileMode">The tile mode.</param>
 /// <param name="bitmapInterpolationMode">The bitmap interpolation mode.</param>
 protected ImmutableTileBrush(
     AlignmentX alignmentX,
     AlignmentY alignmentY,
     RelativeRect destinationRect,
     double opacity,
     RelativeRect sourceRect,
     Stretch stretch,
     TileMode tileMode,
     BitmapInterpolationMode bitmapInterpolationMode)
 {
     AlignmentX              = alignmentX;
     AlignmentY              = alignmentY;
     DestinationRect         = destinationRect;
     Opacity                 = opacity;
     SourceRect              = sourceRect;
     Stretch                 = stretch;
     TileMode                = tileMode;
     BitmapInterpolationMode = bitmapInterpolationMode;
 }
Example #16
0
        private static SKFilterQuality GetInterpolationMode(BitmapInterpolationMode interpolationMode)
        {
            switch (interpolationMode)
            {
            case BitmapInterpolationMode.LowQuality:
                return(SKFilterQuality.Low);

            case BitmapInterpolationMode.MediumQuality:
                return(SKFilterQuality.Medium);

            case BitmapInterpolationMode.HighQuality:
                return(SKFilterQuality.High);

            case BitmapInterpolationMode.Default:
                return(SKFilterQuality.None);

            default:
                throw new ArgumentOutOfRangeException(nameof(interpolationMode), interpolationMode, null);
            }
        }
Example #17
0
        private BitmapBrush RandomBitmapBrush()
        {
#if _D2DTRACE
            Trace.WriteLine("SolidBrush:");
#endif
            BitmapInterpolationMode interpolationMode = Random.NextDouble() < 0.25 ? BitmapInterpolationMode.Linear : BitmapInterpolationMode.NearestNeighbor;
#if _D2DTRACE
            Trace.WriteLine("BitmapInterpolationMode: " + interpolationMode);
#endif
            BitmapBrush ret = RenderTarget.CreateBitmapBrush(
                Bitmap,
                new BitmapBrushProperties(
                    RandomExtendMode(),
                    RandomExtendMode(),
                    interpolationMode),
                new BrushProperties(
                    RandomOpacity(),
                    RandomMatrix3x2()));
            return(ret);
        }
Example #18
0
        private void ScaleMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            switch (ScaleMode.SelectedItem.ToString())
            {
            case "Fant":
                InterpolationMode = BitmapInterpolationMode.Fant;
                break;

            case "Cubic":
                InterpolationMode = BitmapInterpolationMode.Cubic;
                break;

            case "Linear":
                InterpolationMode = BitmapInterpolationMode.Linear;
                break;

            case "NearestNeighbor":
                InterpolationMode = BitmapInterpolationMode.NearestNeighbor;
                break;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImmutableImageBrush"/> class.
 /// </summary>
 /// <param name="visual">The visual to draw.</param>
 /// <param name="alignmentX">The horizontal alignment of a tile in the destination.</param>
 /// <param name="alignmentY">The vertical alignment of a tile in the destination.</param>
 /// <param name="destinationRect">The rectangle on the destination in which to paint a tile.</param>
 /// <param name="opacity">The opacity of the brush.</param>
 /// <param name="sourceRect">The rectangle of the source image that will be displayed.</param>
 /// <param name="stretch">
 /// How the source rectangle will be stretched to fill the destination rect.
 /// </param>
 /// <param name="tileMode">The tile mode.</param>
 /// <param name="bitmapInterpolationMode">Controls the quality of interpolation.</param>
 public ImmutableVisualBrush(
     IVisual visual,
     AlignmentX alignmentX        = AlignmentX.Center,
     AlignmentY alignmentY        = AlignmentY.Center,
     RelativeRect?destinationRect = null,
     double opacity          = 1,
     RelativeRect?sourceRect = null,
     Stretch stretch         = Stretch.Uniform,
     TileMode tileMode       = TileMode.None,
     BitmapInterpolationMode bitmapInterpolationMode = BitmapInterpolationMode.Default)
     : base(
         alignmentX,
         alignmentY,
         destinationRect ?? RelativeRect.Fill,
         opacity,
         sourceRect ?? RelativeRect.Fill,
         stretch,
         tileMode,
         bitmapInterpolationMode)
 {
     Visual = visual;
 }
Example #20
0
 public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height,
                                                         BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     throw new NotImplementedException();
 }
Example #21
0
 public IBitmapImpl ResizeBitmap(IBitmapImpl bitmapImpl, PixelSize destinationSize, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     throw new NotImplementedException();
 }
Example #22
0
 public IBitmapImpl LoadBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     throw new NotImplementedException();
 }
Example #23
0
 /// <summary>
 /// Determines if this draw operation equals another.
 /// </summary>
 /// <param name="transform">The transform of the other draw operation.</param>
 /// <param name="source">The image of the other draw operation.</param>
 /// <param name="opacity">The opacity of the other draw operation.</param>
 /// <param name="sourceRect">The source rect of the other draw operation.</param>
 /// <param name="destRect">The dest rect of the other draw operation.</param>
 /// <param name="bitmapInterpolationMode">The bitmap interpolation mode.</param>
 /// <returns>True if the draw operations are the same, otherwise false.</returns>
 /// <remarks>
 /// The properties of the other draw operation are passed in as arguments to prevent
 /// allocation of a not-yet-constructed draw operation object.
 /// </remarks>
 public bool Equals(Matrix transform, IRef <IBitmapImpl> source, double opacity, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode)
 {
     return(transform == Transform &&
            Equals(source.Item, Source.Item) &&
            source.Item.Version == SourceVersion &&
            opacity == Opacity &&
            sourceRect == SourceRect &&
            destRect == DestRect &&
            bitmapInterpolationMode == BitmapInterpolationMode);
 }
Example #24
0
 /// <summary>	
 /// Draws the specified bitmap after scaling it to the size of the specified rectangle. 	
 /// </summary>	
 /// <remarks>	
 /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the <see cref="EndDraw()" /> or <see cref="M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@)" /> methods.  	
 /// </remarks>	
 /// <param name="bitmap">The bitmap to render. </param>
 /// <param name="opacity">A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied against the alpha values of the bitmap's contents.  The default value is 1.0f. </param>
 /// <param name="interpolationMode">The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. The default value is <see cref="F:SharpDX.Direct2D1.BitmapInterpolationMode.Linear" />.  </param>
 /// <param name="sourceRectangle">The size and position, in device-independent pixels in the bitmap's coordinate space, of the area within the bitmap to be drawn; NULL to draw the entire bitmap.  </param>
 /// <unmanaged>void ID2D1RenderTarget::DrawBitmap([In] ID2D1Bitmap* bitmap,[In, Optional] const D2D1_RECT_F* destinationRectangle,[None] float opacity,[None] D2D1_BITMAP_INTERPOLATION_MODE interpolationMode,[In, Optional] const D2D1_RECT_F* sourceRectangle)</unmanaged>
 public void DrawBitmap(Bitmap bitmap, float opacity, BitmapInterpolationMode interpolationMode, RawRectangleF sourceRectangle)
 {
     DrawBitmap(bitmap, null, opacity, interpolationMode, sourceRectangle);
 }
 public void DrawBitmap(IRef <IBitmapImpl> source, double opacity, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode = BitmapInterpolationMode.Default)
 {
 }
Example #26
0
 /// <inheritdoc />
 public IBitmapImpl LoadBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     return(new WicBitmapImpl(stream, width, true, interpolationMode));
 }
 public IBitmapImpl ResizeBitmap(IBitmapImpl bitmapImpl, PixelSize destinationSize, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     return(Mock.Of <IBitmapImpl>());
 }
 public IBitmapImpl LoadBitmapToHeight(Stream stream, int height, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     return(Mock.Of <IBitmapImpl>());
 }
 public IBitmapImpl LoadBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     return(new HeadlessBitmapStub(new Size(width, width), new Vector(96, 96)));
 }
Example #30
0
 /// <inheritdoc />
 public IBitmapImpl LoadBitmapToHeight(Stream stream, int height, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     return(new WicBitmapImpl(stream, height, false, interpolationMode));
 }
 public IBitmapImpl ResizeBitmap(IBitmapImpl bitmapImpl, PixelSize destinationSize, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     return(new HeadlessBitmapStub(destinationSize, new Vector(96, 96)));
 }
Example #32
0
 /// <inheritdoc />
 public IBitmapImpl ResizeBitmap(IBitmapImpl bitmapImpl, PixelSize destinationSize, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     // https://github.com/sharpdx/SharpDX/issues/959 blocks implementation.
     throw new NotImplementedException();
 }
 public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height,
                                                         BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
 {
     return(new HeadlessBitmapStub(new Size(1, 1), new Vector(96, 96)));
 }
Example #34
0
 /// <summary>	
 /// Draws the specified bitmap after scaling it to the size of the specified rectangle. 	
 /// </summary>	
 /// <remarks>	
 /// This method doesn't return an error code if it fails. To determine whether a drawing operation (such as {{DrawBitmap}}) failed, check the result returned by the <see cref="M:SharpDX.Direct2D1.RenderTarget.EndDraw(System.Int64@,System.Int64@)" /> or <see cref="M:SharpDX.Direct2D1.RenderTarget.Flush(System.Int64@,System.Int64@)" /> methods.  	
 /// </remarks>	
 /// <param name="bitmap">The bitmap to render. </param>
 /// <param name="opacity">A value between 0.0f and 1.0f, inclusive, that specifies an opacity value to apply to the bitmap; this value is multiplied against the alpha values of the bitmap's contents.  The default value is 1.0f. </param>
 /// <param name="interpolationMode">The interpolation mode to use if the bitmap is scaled or rotated by the drawing operation. The default value is <see cref="F:SharpDX.Direct2D1.BitmapInterpolationMode.Linear" />.  </param>
 /// <unmanaged>void ID2D1RenderTarget::DrawBitmap([In] ID2D1Bitmap* bitmap,[In, Optional] const D2D1_RECT_F* destinationRectangle,[None] float opacity,[None] D2D1_BITMAP_INTERPOLATION_MODE interpolationMode,[In, Optional] const D2D1_RECT_F* sourceRectangle)</unmanaged>
 public void DrawBitmap(Bitmap bitmap, float opacity, BitmapInterpolationMode interpolationMode)
 {
     DrawBitmap(bitmap, null, opacity, interpolationMode, null);
 }