Thursday, March 24, 2011 12:38 PM
I would want to do something in my project and I don't konw if it is possible.
I load a JPG image into an Image control. Know, I want to copy the content of certain area of the image to apply some effect (blur, ...) only to that area. I have seen that there is something to do that with BitmapSource.copypixels method. But it take as argument a rect. My question is...
Is there any way to copy/select the content of an image/bitmap taking as selection area an ellipse?
Thank you very much
Thursday, March 24, 2011 5:13 PMMaybe, the less complicated way to achieve this is to have two images with the same source on top of each other and apply Clip and Effects to the one on top.
Bigsby, Lisboa, Portugal
O que for, quando for, é que será o que é...
Wenn ist das Nunstruck git und Slotermeyer? Ja! ... Beiherhund das Oder die Flipperwaldt gersput!
Thursday, March 24, 2011 6:13 PM
But I need to apply the effect only to a selection area, not to the entire image. That's why I need to copy the selected area.
I have studied the choice of writeablebitmap but it isn't possible to access to pixels property when the image is loaded from a URL.
Thanks for your answer.
Thursday, March 24, 2011 9:03 PM
No, as far as I know there isn't a clipped version of CopyPixel around.
An alternate solution is to use a TileBrush, with the original bitmap as its source. You can then use that brush to fill a Path with pretty much any shape. You could then apply an effect to the Path and, optionally, make it appear on top of the original bitmap.
Friday, March 25, 2011 10:55 AM
Thank you Mario!
I will try it and tell to you. I did't know about TileBrush. I am getting a big headache with this. I want that a round area of a certain radio to be cloned/copied when the user click over a server loaded image. Then, apply an effect to all the rounded areas selected.
Once again, thank you very much. I'll tell to you the results.!
Saturday, March 26, 2011 4:45 PM
I answer to my self and I mark this as answer for those who need it:
Thanks to Mario's idea I used ImageBrush to copy pixels from my image, apply the ScaleTransform and TranslateTransform to center the desired and fill it in my ellipse.
Once again, thanks.
- Marked As Answer by tipopleita Saturday, March 26, 2011 4:45 PM