private Bitmap EdgeDetection(Bitmap bitmap, FilterType filterType) { ConvolutionFilterBase filter = null; if (filterType == FilterType.EdgeDetection) { filter = new EdgeDetectionFilter(); } else if (filterType == FilterType.EdgeDetection45Degree) { filter = new EdgeDetection45DegreeFilter(); } else if (filterType == FilterType.EdgeDetectionHorizontal) { filter = new EdgeDetectionHorizontalFilter(); } else if (filterType == FilterType.EdgeDetectionTopLeft) { filter = new EdgeDetectionTopLeftFilter(); } else if (filterType == FilterType.EdgeDetectionVertical) { filter = new EdgeDetectionVerticalFilter(); } if (filter is null) { return(bitmap); } return(bitmap.ConvolutionFilter(filter)); }
private Bitmap Emboss(Bitmap bitmap, FilterType filterType) { ConvolutionFilterBase filter = null; if (filterType == FilterType.Emboss) { filter = new EmbossFilter(); } else if (filterType == FilterType.Emboss45Degree) { filter = new Emboss45DegreeFilter(); } else if (filterType == FilterType.EmbossTopLeft) { filter = new EmbossTopLeftFilter(); } else if (filterType == FilterType.EmbossIntense) { filter = new EmbossIntenseFilter(); } if (filter is null) { return(bitmap); } return(bitmap.ConvolutionFilter(filter)); }
public void ConvolutionFilter(ConvolutionFilterBase filter) { var copy = new WriteableBitmap(Image); ConvertedImageSource = copy.ConvolutionFilter(filter); }