2 Graphics2D objects are being created with alphaComposite "embedded" in their creation process (so an additional setComposite in front seems useless) there is ability to export as SVGs in Batik SVGGenerator and JFreeSVG libraries and the vector export is perfect. I would like to create a new Graphics2D object that is a simple blend AlphaComposition of those and be able to export vectors as well. When creating bufferedimages for each by using setComposite() and drawImage() methods, the raster nature of the the final object handles this "global" alpha composite well and I use it as a preview.
original Graphics2D object 1 --> BufferedImage imageAexport original Graphics2D object 2 --> BufferedImage imageBexport
BufferedImage imageSynthesisRasterExport = new BufferedImage(w,h,BufferedImage.TYPE_INT_ARGB);
Graphics2D g2export = imageSynthesisRasterExport.createGraphics();
g2export.fillRect(0,0,imageSynthesisRasterExport.getWidth(),imageSynthesisRasterExport.getHeight());
g2export.setComposite(getCompositeSliderMain()); //LEVEL 1
g2export.drawImage(imageAexport, 0, 0, null);
g2export.setComposite(getCompositeSliderClone()); // LEVEL 2
g2export.drawImage(imageBexport, 0, 0, null);
... (sorry for not being able to have a ready to run example, hopefully I can explain it)
This "raster" way, the final alpha blended image can be exported as a PNG, but in Batik, obviously SVGGenerator creates a Base64 embedded raster, not vectors (I guess because of the drawImage() method translation). Is there an other way/example/trick to avoid usage of intermediate bufferedimages and instead, use directly original Graphics2D objects in order to gain the ability to "translate" to vector? An object "wrapping" maybe? thanks