Browse Source

Use layer.Width and layer.Height for CombineLayers

CPKreuz 4 years ago
parent
commit
579aca7be3
1 changed files with 5 additions and 5 deletions
  1. 5 5
      PixiEditor/Models/ImageManipulation/BitmapUtils.cs

+ 5 - 5
PixiEditor/Models/ImageManipulation/BitmapUtils.cs

@@ -57,14 +57,14 @@ namespace PixiEditor.Models.ImageManipulation
                         throw new InvalidOperationException("Layers must not extend beyond canvas borders");
                     }
 
-                    for (int y = 0; y < height; y++)
+                    for (int y = 0; y < layer.Height; y++)
                     {
-                        for (int x = 0; x < width; x++)
+                        for (int x = 0; x < layer.Width; x++)
                         {
-                            Color previousColor = finalBitmap.GetPixel(x, y);
-                            Color color = layer.GetPixelWithOffset(x, y);
+                            Color previousColor = finalBitmap.GetPixel(x + layer.OffsetX, y + layer.OffsetY);
+                            Color color = layer.GetPixel(x, y);
 
-                            finalBitmap.SetPixel(x, y, BlendColor(previousColor, color, layerOpacity));
+                            finalBitmap.SetPixel(x + layer.OffsetX, y + layer.OffsetY, BlendColor(previousColor, color, layerOpacity));
                         }
                     }
                 }