/// <summary> /// Creates the image with the drawn frame /// </summary> public static BitmapImage GetFramed(int IndexOfImageInUserData) { // Getting the source image UserData.FramedImage framedImage = UserData.FramedImages[IndexOfImageInUserData]; BitmapImage image = new BitmapImage(new Uri(framedImage.source)); // Creating the frames Rectangle[] frames = new Rectangle[framedImage.frames.Count]; for (int i = 0; i < framedImage.frames.Count; i++) { int x = framedImage.frames[i].TopLeftX; int y = framedImage.frames[i].TopLeftY; int width = framedImage.frames[i].BottomRightX - x; int height = framedImage.frames[i].BottomRightY - y; frames[i] = new Rectangle(x, y, width, height); } // Drawing the frames var byteImage = ImageProcess.BitmapImageToByte(image); var framedByteImage = ImageProcess.DrawFrames(byteImage, frames, UserData.FrameColor); return(ImageProcess.ByteToBitmapImage(framedByteImage)); }