Let's say I have an Image that's 100x100. I want to place the image onto a larger canvas size that's 500x500.
My current approach is to use UIGraphics to create a Context, then draw the image onto the context.
UIGraphics.BeginImageContext(....);
ImageView.Draw (....);
That works great, but it's not as fast as I'd like it to be for what I'm doing. I noticed that CIFilters are extremely fast. Is there a way I can place an image on a larger canvas size using CIFilters, or another method that uses the GPU and not the CPU?? I've experimented with the CIFilters CICrop and CIPerspectiveTransform but I can't seem to get my desired result...
Original Image 100x100
My Desired result image at 500x500. I simply want to take the image and increase it's canvas size using CIFilters or some GPU operation.
I tried doing a "reverse crop" using CICrop, but that didn't work. Notice I specified the size of the CIVector to be 500x500 even though the image itself is 100x100, the result image totally ignored that extra space and cut if off. Here is my code:
CICrop crop = new CICrop();
crop.Image = ImageView.Image.CGImage;
crop.Rectangle = new CIVector(0, 0, 500, 500);
ImageView.Image = new UIImage(crop.OutputImage);
Console.WriteLine("ImageView.Image.size = "+ ImageView.Image.Size);