diff --git a/src/ImageSharp/Image/PixelAccessor.cs b/src/ImageSharp/Image/PixelAccessor.cs
index fec50b9720..0cd6341261 100644
--- a/src/ImageSharp/Image/PixelAccessor.cs
+++ b/src/ImageSharp/Image/PixelAccessor.cs
@@ -141,24 +141,25 @@ namespace ImageSharp
///
/// The row.
/// The target row index.
+ /// The target column index.
///
/// Thrown when an unsupported component order value is passed.
///
- public void CopyFrom(PixelRow row, int targetY)
+ public void CopyFrom(PixelRow row, int targetY, int targetX = 0)
{
switch (row.ComponentOrder)
{
case ComponentOrder.ZYX:
- this.CopyFromZYX(row, targetY, Math.Min(row.Width, this.Width));
+ this.CopyFromZYX(row, targetY, targetX, Math.Min(row.Width, this.Width));
break;
case ComponentOrder.ZYXW:
- this.CopyFromZYXW(row, targetY, Math.Min(row.Width, this.Width));
+ this.CopyFromZYXW(row, targetY, targetX, Math.Min(row.Width, this.Width));
break;
case ComponentOrder.XYZ:
- this.CopyFromXYZ(row, targetY, Math.Min(row.Width, this.Width));
+ this.CopyFromXYZ(row, targetY, targetX, Math.Min(row.Width, this.Width));
break;
case ComponentOrder.XYZW:
- this.CopyFromXYZW(row, targetY, Math.Min(row.Width, this.Width));
+ this.CopyFromXYZW(row, targetY, targetX, Math.Min(row.Width, this.Width));
break;
default:
throw new NotSupportedException();
@@ -228,11 +229,12 @@ namespace ImageSharp
///
/// The row.
/// The target row index.
+ /// The target column index.
/// The width.
- protected virtual void CopyFromZYX(PixelRow row, int targetY, int width)
+ protected virtual void CopyFromZYX(PixelRow row, int targetY, int targetX, int width)
{
byte* source = row.PixelBase;
- byte* destination = this.GetRowPointer(targetY);
+ byte* destination = this.GetRowPointer(targetY) + targetX;
TColor packed = default(TColor);
int size = Unsafe.SizeOf();
@@ -252,11 +254,12 @@ namespace ImageSharp
///
/// The row.
/// The target row index.
+ /// The target column index.
/// The width.
- protected virtual void CopyFromZYXW(PixelRow row, int targetY, int width)
+ protected virtual void CopyFromZYXW(PixelRow row, int targetY, int targetX, int width)
{
byte* source = row.PixelBase;
- byte* destination = this.GetRowPointer(targetY);
+ byte* destination = this.GetRowPointer(targetY) + targetX;
TColor packed = default(TColor);
int size = Unsafe.SizeOf();
@@ -276,11 +279,12 @@ namespace ImageSharp
///
/// The row.
/// The target row index.
+ /// The target column index.
/// The width.
- protected virtual void CopyFromXYZ(PixelRow row, int targetY, int width)
+ protected virtual void CopyFromXYZ(PixelRow row, int targetY, int targetX, int width)
{
byte* source = row.PixelBase;
- byte* destination = this.GetRowPointer(targetY);
+ byte* destination = this.GetRowPointer(targetY) + targetX;
TColor packed = default(TColor);
int size = Unsafe.SizeOf();
@@ -300,11 +304,12 @@ namespace ImageSharp
///
/// The row.
/// The target row index.
+ /// The target column index.
/// The width.
- protected virtual void CopyFromXYZW(PixelRow row, int targetY, int width)
+ protected virtual void CopyFromXYZW(PixelRow row, int targetY, int targetX, int width)
{
byte* source = row.PixelBase;
- byte* destination = this.GetRowPointer(targetY);
+ byte* destination = this.GetRowPointer(targetY) + targetX;
TColor packed = default(TColor);
int size = Unsafe.SizeOf();
diff --git a/src/ImageSharp/PixelAccessor.cs b/src/ImageSharp/PixelAccessor.cs
index 5c2ec5065f..28cdff54a5 100644
--- a/src/ImageSharp/PixelAccessor.cs
+++ b/src/ImageSharp/PixelAccessor.cs
@@ -23,10 +23,10 @@ namespace ImageSharp
}
///
- protected override void CopyFromZYX(PixelRow row, int targetY, int width)
+ protected override void CopyFromZYX(PixelRow row, int targetY, int targetX, int width)
{
byte* source = row.PixelBase;
- byte* destination = this.GetRowPointer(targetY);
+ byte* destination = this.GetRowPointer(targetY) + targetX;
for (int x = 0; x < width; x++)
{
@@ -38,10 +38,10 @@ namespace ImageSharp
}
///
- protected override void CopyFromZYXW(PixelRow row, int targetY, int width)
+ protected override void CopyFromZYXW(PixelRow row, int targetY, int targetX, int width)
{
byte* source = row.PixelBase;
- byte* destination = this.GetRowPointer(targetY);
+ byte* destination = this.GetRowPointer(targetY) + targetX;
for (int x = 0; x < width; x++)
{