Skip to content

How to implement an image backgound eraser?(Like PS) #8855

Answered by lindexi
BigHeadDev asked this question in Q&A
Discussion options

You must be logged in to vote

@BigHeadDev Continuously calculate the geometric shape constructed between the current mouse drop point and the previous one, then overlay it with the current Clip using the Geometry.Combine method in the GeometryCombineMode.Exclude mode. This will allow the clipping part to continuously subtract the current mouse trajectory. The mouse trajectory, as shown in the figure below, is a combination of two circles and a rectangle.

不断的计算当前鼠标落点和上个鼠标落点之间构建的几何形状,然后通过 Geometry.Combine 方式与当前 Clip 采用 GeometryCombineMode.Exclude 方式叠加,如果即可让裁剪部分源源不断减去当前鼠标的轨迹。鼠标轨迹如下图,就是两个圆形和矩形的拼接

Replies: 2 comments 17 replies

Comment options

You must be logged in to vote
12 replies
@lindexi
Comment options

@BigHeadDev
Comment options

@BigHeadDev
Comment options

@lindexi
Comment options

Answer selected by BigHeadDev
@BigHeadDev
Comment options

@lindexi
Comment options

@BigHeadDev
Comment options

@BigHeadDev
Comment options

Comment options

You must be logged in to vote
5 replies
@BigHeadDev
Comment options

@miloush
Comment options

@BigHeadDev
Comment options

@miloush
Comment options

@BigHeadDev
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants