How do I save image masking result to file correctly?

I’m trying to make collages using masks.

What I do:

  1. stack two images and apply shader-based alpha-mask to topmost image so it is seen through masking area
  2. call bitmapToSave.bitmapData.draw(stage)
  3. encode “bitmapToSave” to jpeg and save it to file

But in the result there is non-masked image over another. Though in js-version I can save html-canvas (canvas.toDataURL) with correct result, I want to build a native app.

I embedded screencast of what I’m doing to that readme if somebody interested – openfl-masking-result/ at main · Dimous/openfl-masking-result · GitHub

Hello, your demo looks very good !

I’m out of my comfort zone here so I might be wrong but I would look on the Lime side of things for this, probably starting with Application.current.window.readPixels(rect) and dig from here

There is a Lime channel on the official Discord server (do a search on “haxe discord” to join it), maybe ask there (if you get an answer please take some time to report it here :wink: )

1 Like
final file_reference:FileReference = new FileReference(); Rectangle(0, 0, 300, 300)).encode()), "test.png");

It works*. THANK YOU!

*on windows target