diff --git a/samples/RenderDemo/Pages/RenderTargetBitmapPage.cs b/samples/RenderDemo/Pages/RenderTargetBitmapPage.cs
index 3eb2276c48..f263786ab7 100644
--- a/samples/RenderDemo/Pages/RenderTargetBitmapPage.cs
+++ b/samples/RenderDemo/Pages/RenderTargetBitmapPage.cs
@@ -39,7 +39,7 @@ namespace RenderDemo.Pages
ctx.FillRectangle(Brushes.Fuchsia, new Rect(50, 50, 100, 100));
}
- context.DrawImage(_bitmap, 1,
+ context.DrawImage(_bitmap,
new Rect(0, 0, 200, 200),
new Rect(0, 0, 200, 200));
Dispatcher.UIThread.Post(InvalidateVisual, DispatcherPriority.Background);
diff --git a/src/Avalonia.Controls/Image.cs b/src/Avalonia.Controls/Image.cs
index 02014f4d31..41b6e5449a 100644
--- a/src/Avalonia.Controls/Image.cs
+++ b/src/Avalonia.Controls/Image.cs
@@ -86,7 +86,7 @@ namespace Avalonia.Controls
var interpolationMode = RenderOptions.GetBitmapInterpolationMode(this);
- context.DrawImage(source, 1, sourceRect, destRect, interpolationMode);
+ context.DrawImage(source, sourceRect, destRect, interpolationMode);
}
}
diff --git a/src/Avalonia.Controls/Remote/RemoteWidget.cs b/src/Avalonia.Controls/Remote/RemoteWidget.cs
index 539fe1ec4b..c7a1a24c25 100644
--- a/src/Avalonia.Controls/Remote/RemoteWidget.cs
+++ b/src/Avalonia.Controls/Remote/RemoteWidget.cs
@@ -83,7 +83,7 @@ namespace Avalonia.Controls.Remote
Marshal.Copy(_lastFrame.Data, y * _lastFrame.Stride,
new IntPtr(l.Address.ToInt64() + l.RowBytes * y), lineLen);
}
- context.DrawImage(_bitmap, 1, new Rect(0, 0, _bitmap.PixelSize.Width, _bitmap.PixelSize.Height),
+ context.DrawImage(_bitmap, new Rect(0, 0, _bitmap.PixelSize.Width, _bitmap.PixelSize.Height),
new Rect(Bounds.Size));
}
base.Render(context);
diff --git a/src/Avalonia.Visuals/Media/DrawingContext.cs b/src/Avalonia.Visuals/Media/DrawingContext.cs
index 32fdf3b69a..4045b92c0c 100644
--- a/src/Avalonia.Visuals/Media/DrawingContext.cs
+++ b/src/Avalonia.Visuals/Media/DrawingContext.cs
@@ -77,15 +77,26 @@ namespace Avalonia.Media
/// Draws an image.
///
/// The image.
- /// The opacity to draw with.
+ /// The rect in the output to draw to.
+ public void DrawImage(IImage source, Rect rect)
+ {
+ Contract.Requires(source != null);
+
+ DrawImage(source, new Rect(source.Size), rect);
+ }
+
+ ///
+ /// Draws an image.
+ ///
+ /// The image.
/// The rect in the image to draw.
/// The rect in the output to draw to.
/// The bitmap interpolation mode.
- public void DrawImage(IImage source, double opacity, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode = default)
+ public void DrawImage(IImage source, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode = default)
{
Contract.Requires(source != null);
- source.Draw(this, opacity, sourceRect, destRect, bitmapInterpolationMode);
+ source.Draw(this, sourceRect, destRect, bitmapInterpolationMode);
}
///
diff --git a/src/Avalonia.Visuals/Media/DrawingImage.cs b/src/Avalonia.Visuals/Media/DrawingImage.cs
index 9ddf88651c..9ce6ecd9e7 100644
--- a/src/Avalonia.Visuals/Media/DrawingImage.cs
+++ b/src/Avalonia.Visuals/Media/DrawingImage.cs
@@ -20,7 +20,6 @@ namespace Avalonia.Media
public void Draw(
DrawingContext context,
- double opacity,
Rect sourceRect,
Rect destRect,
BitmapInterpolationMode bitmapInterpolationMode)
diff --git a/src/Avalonia.Visuals/Media/IImage.cs b/src/Avalonia.Visuals/Media/IImage.cs
index 35ddf07f44..aff2a9ddf9 100644
--- a/src/Avalonia.Visuals/Media/IImage.cs
+++ b/src/Avalonia.Visuals/Media/IImage.cs
@@ -17,13 +17,11 @@ namespace Avalonia.Media
/// Draws the image to a .
///
/// The drawing context.
- /// The opacity to draw with.
/// The rect in the image to draw.
/// The rect in the output to draw to.
/// The bitmap interpolation mode.
void Draw(
DrawingContext context,
- double opacity,
Rect sourceRect,
Rect destRect,
BitmapInterpolationMode bitmapInterpolationMode);
diff --git a/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs b/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs
index 8f154ad8e4..14ac4261dc 100644
--- a/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs
+++ b/src/Avalonia.Visuals/Media/Imaging/Bitmap.cs
@@ -107,14 +107,13 @@ namespace Avalonia.Media.Imaging
///
void IImage.Draw(
DrawingContext context,
- double opacity,
Rect sourceRect,
Rect destRect,
BitmapInterpolationMode bitmapInterpolationMode)
{
context.PlatformImpl.DrawBitmap(
PlatformImpl,
- opacity,
+ 1,
sourceRect,
destRect,
bitmapInterpolationMode);