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.
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 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 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