Class MetaImage
Nombre del espacio: Aspose.Imaging.FileFormats.Emf Asamblea: Aspose.Imaging.dll (25.4.0)
Clases de Meta Objeto
[JsonObject(MemberSerialization.OptIn)]
public abstract class MetaImage : VectorImage, IDisposable, IObjectWithBounds, IObjectWithSizeF
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← VectorImage ← MetaImage
Derived
Implements
IDisposable ,y, IObjectWithBounds ,y, IObjectWithSizeF
Miembros heredados
VectorImage.GetEmbeddedImages() ,y, VectorImage.RemoveBackground() ,y, VectorImage.RemoveBackground(RemoveBackgroundSettings) ,y, VectorImage.Resize(int, int, ResizeType) ,y, VectorImage.Resize(int, int, ImageResizeSettings) ,y, VectorImage.RotateFlip(RotateFlipType) ,y, VectorImage.Crop(Rectangle) ,y, VectorImage.Rotate(float) ,y, VectorImage.Modify(RectangleF, float, float, float) ,y, VectorImage.SizeF ,y, VectorImage.WidthF ,y, VectorImage.HeightF ,y, VectorImage.Width ,y, VectorImage.Height ,y, Image.CanLoad(string) ,y, Image.CanLoad(string, LoadOptions) ,y, Image.CanLoad(Stream) ,y, Image.CanLoad(Stream, LoadOptions) ,y, Image.Create(ImageOptionsBase, int, int) ,y, Image.Create(Image[]) ,y, Image.Create(MultipageCreateOptions) ,y, Image.Create(string[], bool) ,y, Image.Create(string[]) ,y, Image.Create(Image[], bool) ,y, Image.GetFileFormat(string) ,y, Image.GetFileFormat(Stream) ,y, Image.GetFittingRectangle(Rectangle, int, int) ,y, Image.GetFittingRectangle(Rectangle, int[], int, int) ,y, Image.Load(string, LoadOptions) ,y, Image.Load(string) ,y, Image.Load(Stream, LoadOptions) ,y, Image.Load(Stream) ,y, Image.GetProportionalWidth(int, int, int) ,y, Image.GetProportionalHeight(int, int, int) ,y, Image.RemoveMetadata() ,y, Image.CanSave(ImageOptionsBase) ,y, Image.Resize(int, int) ,y, Image.Resize(int, int, ResizeType) ,y, Image.Resize(int, int, ImageResizeSettings) ,y, Image.GetDefaultOptions(object[]) ,y, Image.GetOriginalOptions() ,y, Image.ResizeWidthProportionally(int) ,y, Image.ResizeHeightProportionally(int) ,y, Image.ResizeWidthProportionally(int, ResizeType) ,y, Image.ResizeHeightProportionally(int, ResizeType) ,y, Image.ResizeWidthProportionally(int, ImageResizeSettings) ,y, Image.ResizeHeightProportionally(int, ImageResizeSettings) ,y, Image.RotateFlip(RotateFlipType) ,y, Image.Rotate(float) ,y, Image.Crop(Rectangle) ,y, Image.Crop(int, int, int, int) ,y, Image.Save() ,y, Image.Save(string) ,y, Image.Save(string, ImageOptionsBase) ,y, Image.Save(string, ImageOptionsBase, Rectangle) ,y, Image.Save(Stream, ImageOptionsBase) ,y, Image.Save(Stream, ImageOptionsBase, Rectangle) ,y, Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) ,y, Image.SetPalette(IColorPalette, bool) ,y, Image.UpdateContainer(Image) ,y, Image.GetCanNotSaveMessage(ImageOptionsBase) ,y, Image.GetFitRectangle(Rectangle) ,y, Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter) ,y, Image.GetFitRectangle(Rectangle, int[]) ,y, Image.OnPaletteChanged(IColorPalette, IColorPalette) ,y, Image.OnPaletteChanging(IColorPalette, IColorPalette) ,y, Image.ReleaseManagedResources() ,y, Image.BitsPerPixel ,y, Image.Bounds ,y, Image.Container ,y, Image.Height ,y, Image.Palette ,y, Image.UsePalette ,y, Image.Size ,y, Image.Width ,y, Image.InterruptMonitor ,y, Image.BufferSizeHint ,y, Image.AutoAdjustPalette ,y, Image.HasBackgroundColor ,y, Image.FileFormat ,y, Image.BackgroundColor ,y, DataStreamSupporter.timeout ,y, DataStreamSupporter.CacheData() ,y, DataStreamSupporter.Save() ,y, DataStreamSupporter.Save(Stream) ,y, DataStreamSupporter.Save(string) ,y, DataStreamSupporter.Save(string, bool) ,y, DataStreamSupporter.SaveData(Stream) ,y, DataStreamSupporter.ReleaseManagedResources() ,y, DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer) ,y, DataStreamSupporter.DataStreamContainer ,y, DataStreamSupporter.IsCached ,y, DisposableObject.Dispose() ,y, DisposableObject.ReleaseManagedResources() ,y, DisposableObject.ReleaseUnmanagedResources() ,y, DisposableObject.VerifyNotDisposed() ,y, DisposableObject.Disposed ,y, object.GetType() ,y, object.MemberwiseClone() ,y, object.ToString() ,y, object.Equals(object?) ,y, object.Equals(object?, object?) ,y, object.ReferenceEquals(object?, object?) ,y, object.GetHashCode()
Constructors
MetaImage()
Inicializa una nueva instancia de Aspose.Imaging.FileFormats.Emf.MetaImage.
public MetaImage()
Properties
Records
Obtenga o coloca los registros.
public virtual MetaObjectList Records { get; set; }
Valor de la propiedad
Examples
Este ejemplo muestra cómo cargar una imagen WMF de un archivo y listar todos sus registros.
string dir = "c:\\temp\\";
// Using Aspose.Imaging.Image.Load is a unified way to load all types of images including WMF.
using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = (Aspose.Imaging.FileFormats.Wmf.WmfImage)Aspose.Imaging.Image.Load(dir + "test.wmf"))
{
// Cache data to load all records.
wmfImage.CacheData();
System.Console.WriteLine("The total number of records: {0}", wmfImage.Records.Count);
// The key is a record type, the value is number of records of that type in the WMF image.
System.Collections.Generic.Dictionary<system.type, int=""> types =
new System.Collections.Generic.Dictionary<system.type, int="">();
// Gather statistics
foreach (Aspose.Imaging.FileFormats.Wmf.Objects.WmfObject obj in wmfImage.Records)
{
System.Type objType = obj.GetType();
if (!types.ContainsKey(objType))
{
types.Add(objType, 1);
}
else
{
types[objType]++;
}
}
// Print statistics
System.Console.WriteLine("Record Type Count");
System.Console.WriteLine("----------------------------------------------");
foreach (System.Collections.Generic.KeyValuePair<system.type, int=""> entry in types)
{
string objectType = entry.Key.Name;
string alignmentGap = new string(' ', 40 - objectType.Length);
System.Console.WriteLine("{0}:{1}{2}", entry.Key.Name, alignmentGap, entry.Value);
}
}
//The output may look like this:
//The total number of records: 613
//Record Type Count
//----------------------------------------------
//WmfSetBkMode: 1
//WmfSetTextAlign: 1
//WmfSetRop2: 1
//WmfSetWindowOrg: 1
//WmfSetWindowExt: 1
//WmfCreateBrushInDirect: 119
//WmfSelectObject: 240
//WmfCreatePenInDirect: 119
//WmfSetPolyFillMode: 1
//WmfPolyPolygon: 114
//WmfPolyLine: 7
//WmfSetTextColor: 2
//WmfCreateFontInDirect: 2
//WmfExtTextOut: 2
//WmfDibStrechBlt: 1
//WmfEof: 1</system.type,></system.type,></system.type,>
Este ejemplo muestra cómo cargar una imagen EMF de un archivo y listar todos sus registros.
string dir = "c:\\temp\\";
// Using Aspose.Imaging.Image.Load is a unified way to load all types of images including WMF.
using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(dir + "test.emf"))
{
// Cache data to load all records.
emfImage.CacheData();
System.Console.WriteLine("The total number of records: {0}", emfImage.Records.Count);
// The key is a record type, the value is number of records of that type in the WMF image.
System.Collections.Generic.Dictionary<system.type, int=""> types =
new System.Collections.Generic.Dictionary<system.type, int="">();
// Gather statistics
foreach (Aspose.Imaging.FileFormats.Emf.Emf.Records.EmfRecord obj in emfImage.Records)
{
System.Type objType = obj.GetType();
if (!types.ContainsKey(objType))
{
types.Add(objType, 1);
}
else
{
types[objType]++;
}
}
// Print statistics
System.Console.WriteLine("Record Type Count");
System.Console.WriteLine("----------------------------------------------");
foreach (System.Collections.Generic.KeyValuePair<system.type, int=""> entry in types)
{
string objectType = entry.Key.Name;
string alignmentGap = new string(' ', 40 - objectType.Length);
System.Console.WriteLine("{0}:{1}{2}", entry.Key.Name, alignmentGap, entry.Value);
}
}
//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</system.type,></system.type,></system.type,>
Methods
GetCanNotSaveMessage(ImageOptionsBase)
Obtén que no puede salvar mensaje.
protected override string GetCanNotSaveMessage(ImageOptionsBase optionsBase)
Parameters
optionsBase
ImageOptionsBase
Opciones de imagen.
Returns
No puede guardar mensaje.
GetMissedFonts()
Devolve la lista de las fuentes que se utilizaron dentro de la metafísica pero no se encontraron.
public string[] GetMissedFonts()
Returns
string [][]
La lista de fonts
Examples
El siguiente ejemplo muestra cómo imprimir información sobre las fuentes usadas y perdidas en las imágenes WMF/EMF.
string dir = "c:\\aspose.imaging\\net\\issues\\3544";
// To make all fonts unaccessable
string[] fontDirectories = Aspose.Imaging.FontSettings.GetFontsFolders();
Aspose.Imaging.FontSettings.SetFontsFolder("empty");
string[] files = new string[]
{
"TestWmfText.wmf",
"TestEmfFonts.emf",
"TestEmfPlusFonts.emf",
};
try
{
foreach (string file in files)
{
System.Console.WriteLine("========== {0} ==========", file);
using (Aspose.Imaging.FileFormats.Emf.MetaImage image = (Aspose.Imaging.FileFormats.Emf.MetaImage)Aspose.Imaging.Image.Load(System.IO.Path.Combine(dir, file)))
{
string[] used = image.GetUsedFonts();
foreach (string it in used)
{
System.Console.WriteLine("Used font: " + it);
}
string[] missed = image.GetMissedFonts();
foreach (string it in missed)
{
System.Console.WriteLine("Missed font: " + it);
}
int ui = 0, mi = 0;
foreach (string it in used)
{
if (it.Contains("Times"))
{
ui++;
continue;
}
if (used[ui] != missed[mi])
{
throw new System.Exception("Font lists must be equal!");
}
ui++; mi++;
}
}
}
}
finally
{
Aspose.Imaging.FontSettings.SetFontsFolders(fontDirectories, true);
}
// The STDOUT log may look like this:
//========== TestWmfText.wmf ==========
//Used font: Garamond
//Used font: Arial
//Used font: Bookman Old Style
//Used font: Comic Sans MS
//Used font: Courier
//Used font: Courier New
//Used font: Impact
//Used font: Modern
//Used font: MS Sans Serif
//Used font: MS Serif
//Used font: Small Fonts
//Used font: Symbol
//Used font: Tahoma
//Used font: Times New Roman
//Used font: Verdana
//Used font: Wingdings
//Missed font: Garamond
//Missed font: Arial
//Missed font: Bookman Old Style
//Missed font: Comic Sans MS
//Missed font: Courier
//Missed font: Courier New
//Missed font: Impact
//Missed font: Modern
//Missed font: MS Sans Serif
//Missed font: MS Serif
//Missed font: Small Fonts
//Missed font: Symbol
//Missed font: Tahoma
//Missed font: Verdana
//Missed font: Wingdings
//========== TestEmfFonts.emf ==========
//Used font: Arial
//Used font: Verdana
//Used font: Times New Roman
//Used font: Symbol
//Missed font: Arial
//Missed font: Verdana
//Missed font: Symbol
//========== TestEmfPlusFonts.emf ==========
//Used font: MICROSOFT SANS SERIF
//Missed font: MICROSOFT SANS SERIF
GetUsedFonts()
Devolve la lista de las letras que se utilizan dentro de la metafísica.
public abstract string[] GetUsedFonts()
Returns
string [][]
La lista de fonts
Examples
El siguiente ejemplo muestra cómo imprimir información sobre las fuentes usadas y perdidas en las imágenes WMF/EMF.
string dir = "c:\\aspose.imaging\\net\\issues\\3544";
// To make all fonts unaccessable
string[] fontDirectories = Aspose.Imaging.FontSettings.GetFontsFolders();
Aspose.Imaging.FontSettings.SetFontsFolder("empty");
string[] files = new string[]
{
"TestWmfText.wmf",
"TestEmfFonts.emf",
"TestEmfPlusFonts.emf",
};
try
{
foreach (string file in files)
{
System.Console.WriteLine("========== {0} ==========", file);
using (Aspose.Imaging.FileFormats.Emf.MetaImage image = (Aspose.Imaging.FileFormats.Emf.MetaImage)Aspose.Imaging.Image.Load(System.IO.Path.Combine(dir, file)))
{
string[] used = image.GetUsedFonts();
foreach (string it in used)
{
System.Console.WriteLine("Used font: " + it);
}
string[] missed = image.GetMissedFonts();
foreach (string it in missed)
{
System.Console.WriteLine("Missed font: " + it);
}
int ui = 0, mi = 0;
foreach (string it in used)
{
if (it.Contains("Times"))
{
ui++;
continue;
}
if (used[ui] != missed[mi])
{
throw new System.Exception("Font lists must be equal!");
}
ui++; mi++;
}
}
}
}
finally
{
Aspose.Imaging.FontSettings.SetFontsFolders(fontDirectories, true);
}
// The STDOUT log may look like this:
//========== TestWmfText.wmf ==========
//Used font: Garamond
//Used font: Arial
//Used font: Bookman Old Style
//Used font: Comic Sans MS
//Used font: Courier
//Used font: Courier New
//Used font: Impact
//Used font: Modern
//Used font: MS Sans Serif
//Used font: MS Serif
//Used font: Small Fonts
//Used font: Symbol
//Used font: Tahoma
//Used font: Times New Roman
//Used font: Verdana
//Used font: Wingdings
//Missed font: Garamond
//Missed font: Arial
//Missed font: Bookman Old Style
//Missed font: Comic Sans MS
//Missed font: Courier
//Missed font: Courier New
//Missed font: Impact
//Missed font: Modern
//Missed font: MS Sans Serif
//Missed font: MS Serif
//Missed font: Small Fonts
//Missed font: Symbol
//Missed font: Tahoma
//Missed font: Verdana
//Missed font: Wingdings
//========== TestEmfFonts.emf ==========
//Used font: Arial
//Used font: Verdana
//Used font: Times New Roman
//Used font: Symbol
//Missed font: Arial
//Missed font: Verdana
//Missed font: Symbol
//========== TestEmfPlusFonts.emf ==========
//Used font: MICROSOFT SANS SERIF
//Missed font: MICROSOFT SANS SERIF
ResizeCanvas(Rectangle)
Recuperar las canvas.
public abstract void ResizeCanvas(Rectangle newRectangle)
Parameters
newRectangle
Rectangle
El nuevo rectángulo.
Examples
El siguiente ejemplo muestra cómo agregar una frontera con las margen especificadas alrededor de un metáfil (WMF y EMF).
int borderLeft = 50;
int borderTop = 50;
int borderRight = 50;
int borderBottom = 50;
string dir = "c:\\aspose.imaging\\issues\\net\\3280\\";
string[] fileNames = new[] { "image1.emf", "image2.wmf" };
foreach (string fileName in fileNames)
{
string inputFilePath = dir + fileName;
string outputFilePath = dir + "AddBorder_" + fileName;
using (Aspose.Imaging.FileFormats.Emf.MetaImage image = (Aspose.Imaging.FileFormats.Emf.MetaImage)Aspose.Imaging.Image.Load(inputFilePath))
{
image.ResizeCanvas(new Aspose.Imaging.Rectangle(-borderLeft, -borderTop, image.Width + borderLeft + borderRight, image.Height + borderTop + borderBottom));
image.Save(outputFilePath);
}
}
SaveData(Stream)
Salva los datos a la stream'.
protected override sealed void SaveData(Stream stream)
Parameters
stream
Stream
El flujo.