javafx - How to make an Alpha Gradient Mask? -


i'm trying make : alpha gradient mask using javafx

any idea on how this?

i found way "alphacomposite" function.

here code :

private image mask; private image dest; private float alpha = 1f;  private void loadimages() {      mask = new imageicon("resources/source.png").getimage();     dest = new imageicon("resources/destination.png").getimage(); }  private void dodrawing(graphics g) {      graphics2d g2d = (graphics2d) g.create();      bufferedimage buffimg = new bufferedimage(500, 400,             bufferedimage.type_int_argb);     graphics2d gbi = buffimg.creategraphics();      alphacomposite ac = alphacomposite.getinstance(             alphacomposite.src_in, alpha);      gbi.drawimage(mask, 0, 0, null);     gbi.setcomposite(ac);     gbi.drawimage(dest, 0, 0, null);      g2d.drawimage(buffimg, 20, 20, null);      gbi.dispose();     g2d.dispose(); } 

here :

original image & mask

result

i same thing in javafx because i'm working javafx images (or mat images opencv library).


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -