Migration from Release 2.4.0 - playMetafile

Hello,

we’re using at the moment Version 2.4.0 from Aspose Imagaing and want update to the current version (3.0.1).

The current code:

RenderingHints oldRenderingHints = g2d.getRenderingHints();
g2d.setRenderingHints(MetafileHelper.getDefaultRenderingHints());

int width = destRight - destLeft;
int height = destBottom - destTop;

AffineTransform scaleXform = new AffineTransform();
double scaleX = width / this.metafile.getWidth();
double scaleY = height / this.metafile.getHeight();
scaleXform.setToScale(scaleX, scaleY);

AffineTransform xform = new AffineTransform();
xform.translate(-(this.metafile.getMinX() * scaleX) + destLeft, -(this.metafile.getMinY() * scaleY) + destTop);
xform.concatenate(scaleXform);

try
{
this.metafile.playMetafile(g2d, xform);
}
catch (MetafilesException e)
{
log.error(e.toString(), e);
}

g2d.setRenderingHints(oldRenderingHints);


So: In the version after 2.4.0 the method MetafileImage.playMetafile(g2d, xform) isn’t visible anymore.
How can I migrate this code?

Thanks

Hi Burkhardt,

We are in communication with our product team on this issue and will update you soon.

Best Regards,

Hi Burkhardt,

This method is now part of Image.save however it will be publically available in the upcoming release of Aspose.Imaging for Java which will be released after a few days. You can upgrade and use the same code after the release.

Sorry for the inconvenience.

Best Regards,

Thanks, so I’ll wait until the next version will released.

Hi Burkhardt,

You will not have to wait for too long. Please stay tuned; we will update you as soon as new version will be available for download.

Thanks for the new release 3.1, but:

Using for example

WmfMetafileImage wmf = (WmfMetafileImage) metafile;
wmf.playMetafile(g2d, xform);

produces the exception:

“AWT-EventQueue-0” java.lang.IllegalAccessError: tried to access method com.aspose.imaging.fileformats.metafile.WmfMetafileImage.playMetafile(Ljava/awt/Graphics2D;Ljava/awt/geom/AffineTransform;)V

Hi Burkhardt,

Thank you for your inquiry.

Please forward us the sample file along with sample code that you are using. This will help us to regenerate the issue at our end. We will look into it and update you about our findings.

Hi Ikram,

the code looks like this:

RenderingHints oldRenderingHints = g2d.getRenderingHints();
g2d.setRenderingHints(MetafileHelper.getDefaultRenderingHints());

AffineTransform xform = new AffineTransform();
xform.translate(-this.metafile.getMinX() + destLeft, -this.metafile.getMinY() + destTop);

AffineTransform scaleXform = new AffineTransform();
scaleXform.setToScale(1.0, 1.0);
scaleXform.concatenate(xform);

try
{

metafile.playMetafile(g2d, xform);


// This is another option to draw into graphics with aspose
/*
RenderedImage bImage = this.metafile.createDefaultRendering();

g2d.drawRenderedImage(bImage, xform);
*/

}
catch (MetafilesException e)
{
log.error(e.toString(), e);
}

g2d.setRenderingHints(oldRenderingHints);


Thanks,
Burkhardt

Hi Burkhardt,

Thank you for the code sample. Please forward us the sample Wmf Metafile that is creating problem at your end.

Hi Ikram,

I’ve send you a wmf file (but it doesn’t matter which metafile is used) some days ago.
Are there any news?

Thanks,
Burkhardt

Hi Burkhardt,

Thank you for your patience.

Please forward us a complete working code sample that generates same error message that you had posted. This will help us to regenerate the issue at our end.

Looking forward for your reply along with sample code.