public abstract class MetaImage extends Image
Base class for Meta object classes
Constructor and Description |
---|
MetaImage() |
Modifier and Type | Method and Description |
---|---|
void |
crop(int leftShift,
int rightShift,
int topShift,
int bottomShift)
Crop image with shifts.
|
void |
crop(Rectangle rectangle)
Crops the specified rectangle.
|
MetaObjectList |
getRecords()
Gets the records.
|
abstract void |
resizeCanvas(Rectangle newRectangle)
Resizes the canvas.
|
void |
setRecords(MetaObjectList value)
Sets the records.
|
canLoad, canLoad, canLoad, canLoad, canSave, create, getBackgroundColor, getBitsPerPixel, getBounds, getBufferSizeHint, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getHeight, getInterruptMonitor, getOriginalOptions, getPalette, getProportionalHeight, getProportionalWidth, getSize, getWidth, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resize, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, rotateFlip, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setBufferSizeHint, setInterruptMonitor, setPalette, setPalette
cacheData, getDataStreamContainer, isCached, save, save, save, save
close, dispose, getDisposed
public MetaObjectList getRecords()
Gets the records.
This example shows how to load a EMF image from a file and list all of its records.
String dir = "c:\\temp\\"; // Using Aspose.Imaging.Image.Load is a unified way to load all types of images including WMF. com.aspose.imaging.fileformats.emf.EmfImage emfImage = (com.aspose.imaging.fileformats.emf.EmfImage)com.aspose.imaging.Image.load(dir + "test.emf"); try { // Cache data to load all records. emfImage.cacheData(); System.out.println("The total number of records: " + emfImage.getRecords().size()); // The key is a record type, the value is number of records of that type in the WMF image. java.util.HashMap<Class, Integer> types = new java.util.HashMap<>(); // Gather statistics for (Object obj : emfImage.getRecords()) { com.aspose.imaging.fileformats.emf.emf.records.EmfRecord record = (com.aspose.imaging.fileformats.emf.emf.records.EmfRecord) obj; Class objType = record.getClass(); if (!types.containsKey(objType)) { types.put(objType, 1); } else { int n = types.get(objType); types.put(objType, n + 1); } } // Print statistics System.out.println("Record Type Count"); System.out.println("----------------------------------------------"); for (java.util.Map.Entry<Class, Integer> entry : types.entrySet()) { String objectType = entry.getKey().getSimpleName(); int numberOfEntrances = entry.getValue(); // Align output with spaces int alignmentPos = 40; char[] chars = new char[alignmentPos - objectType.length()]; java.util.Arrays.fill(chars, ' '); String gap = new String(chars); System.out.println(objectType + ":" + gap + numberOfEntrances); } } finally { emfImage.dispose(); } //The output may look like this: //The total number of records: 1188 //Record Type Count //---------------------------------------------- //EmfMetafileHeader: 1 //EmfSetBkMode: 1 //EmfSetTextAlign: 1 //EmfSetRop2: 1 //EmfSetWorldTransform: 1 //EmfExtSelectClipRgn: 1 //EmfCreateBrushIndirect: 113 //EmfSelectObject: 240 //EmfCreatePen: 116 //EmfSetPolyFillMode: 1 //EmfBeginPath: 120 //EmfMoveToEx: 122 //EmfPolyBezierTo16: 36 //EmfLineTo: 172 //EmfCloseFigure: 14 //EmfEndPath: 120 //EmfStrokeAndFillPath: 113 //EmfStrokePath: 7 //EmfSetTextColor: 2 //EmfExtCreateFontIndirectW: 2 //EmfExtTextOutW: 2 //EmfStretchBlt: 1 //EmfEof: 1
public void setRecords(MetaObjectList value)
Sets the records.
value
- The records.public void crop(int leftShift, int rightShift, int topShift, int bottomShift)
Crop image with shifts.
leftShift
- The left shift.rightShift
- The right shift.topShift
- The top shift.bottomShift
- The bottom shift.public void crop(Rectangle rectangle)
Crops the specified rectangle.
rectangle
- The rectangle.public abstract void resizeCanvas(Rectangle newRectangle)
Resizes the canvas.
newRectangle
- The new rectangle.Copyright (c) 2008-2019 Aspose Pty Ltd. All Rights Reserved.