private static Bitmap overlay(Bitmap below, Bitmap over) { Bitmap invertBelow = ImageFilter.FilterImage(below, Filters.filters["Invert"]); Bitmap myMask = maskImage(over, invertBelow); Bitmap overlayImages = OverlayImages(below, myMask, 1, 1); return(operationImages(overlayImages, below, Filters.mode["Merge"])); }
public static Bitmap maskImage(Bitmap img, Bitmap mask) { Bitmap greyscale = ImageFilter.FilterImage(mask, Filters.filters["Greyscale"]); //greyscale = FormatUtil.convert(greyscale, PixelFormat.Format32bppArgb); Bitmap invert = ImageFilter.FilterImage(greyscale, Filters.filters["Invert"]); //invert = FormatUtil.convert(invert, PixelFormat.Format32bppArgb); Bitmap toAddMask = ImageUtil.convert(img, PixelFormat.Format32bppArgb); Bitmap withAlpha = ImageMultiFilter.RGBA_replaceChannel(toAddMask, null, null, null, invert); return(withAlpha); //return ImageMultiFilter.OverlayImages(img, withAlpha, 1, 1); }