public Painter(WriteableBitmap filledImage, BitmapImage sourceImage) { this.filledImage = filledImage; SourceImage = sourceImage; this.sourceWidth = sourceImage.PixelWidth; this.sourceHeight = sourceImage.PixelHeight; this.stride = this.sourceWidth*BytesPerPixel; this.sourceImageBytes = sourceImage.GetBytes(); this.patternImageBytes = filledImage.GetBytes(); this.sourcePatternImageBytes = new byte[this.patternImageBytes.Length]; this.patternImageBytes.CopyTo(this.sourcePatternImageBytes, 0); }