How can I use a PathGeometry as a mask for a BitmapSource (or any image data)?
Posted
by Jedidja
on Stack Overflow
See other posts from Stack Overflow
or by Jedidja
Published on 2010-04-09T19:01:25Z
Indexed on
2010/04/10
21:33 UTC
Read the original article
Hit count: 284
Assuming I have a BitmapSource (actually I have access to the raw pixels as well if necessary), how can I use a PathGeometry as a mask to cut out certain parts of the image?
01234567890123456789
0 --------------------
1 | + + |
2 | * |
3 | * ) |
4 | * |
5 | ( |
6 --------------------
Assuming I have a PathGeometry that describes a rectangle that goes from (0, 0) to (8, 3), I would like to be able to get one of the following two images:
01234567890123456789
0 --------------------
1 | + |
2 | * |
3 | |
4 | |
5 | |
6 --------------------
or
012345678
0 ---------
1 | + |
2 | *|
3 ---------
© Stack Overflow or respective owner