Class MetaImage

Class MetaImage

Именује се: Aspose.Imaging.FileFormats.Emf Асамблеја: Aspose.Imaging.dll (25.4.0)

Основна класа за класе мета објеката

[JsonObject(MemberSerialization.OptIn)]
public abstract class MetaImage : VectorImage, IDisposable, IObjectWithBounds, IObjectWithSizeF

Inheritance

object DisposableObject DataStreamSupporter Image VectorImage MetaImage

Derived

EmfImage , WmfImage

Implements

IDisposable , IObjectWithBounds , IObjectWithSizeF

Наслеђени чланови

VectorImage.GetEmbeddedImages() , VectorImage.RemoveBackground() , VectorImage.RemoveBackground(RemoveBackgroundSettings) , VectorImage.Resize(int, int, ResizeType) , VectorImage.Resize(int, int, ImageResizeSettings) , VectorImage.RotateFlip(RotateFlipType) , VectorImage.Crop(Rectangle) , VectorImage.Rotate(float) , VectorImage.Modify(RectangleF, float, float, float) , VectorImage.SizeF , VectorImage.WidthF , VectorImage.HeightF , VectorImage.Width , VectorImage.Height , Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.UpdateContainer(Image) , Image.GetCanNotSaveMessage(ImageOptionsBase) , Image.GetFitRectangle(Rectangle) , Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter) , Image.GetFitRectangle(Rectangle, int[]) , Image.OnPaletteChanged(IColorPalette, IColorPalette) , Image.OnPaletteChanging(IColorPalette, IColorPalette) , Image.ReleaseManagedResources() , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.timeout , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.SaveData(Stream) , DataStreamSupporter.ReleaseManagedResources() , DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

MetaImage()

Иницијалише нову инстанцију Aspose.Imaging.FileFormats.Emf.MetaImage.

public MetaImage()

Properties

Records

Добија или поставља рекорде.

public virtual MetaObjectList Records { get; set; }

Вредност имовине

MetaObjectList

Examples

Овај пример показује како да преузмете ВМФ слику из датотеке и наведете све његове записе.

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

Овај пример показује како да преузмете ЕМФ слику из датотеке и наведете све његове записе.

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)

Ne možeš da štediš poruku.

protected override string GetCanNotSaveMessage(ImageOptionsBase optionsBase)

Parameters

optionsBase ImageOptionsBase

Опције за слику.

Returns

string

Ne može da štedi poruku.

GetMissedFonts()

Враћа листу шрифтова који су коришћени у метафилу, али нису пронађени.

public string[] GetMissedFonts()

Returns

string []

Списак шрифта

Examples

Следећи пример показује како да штампате информације о употребљеним и пропуштеним шрифтовима у сликама ВМФ/МЕФ.

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()

Враћа листу шрифта који се користи у метафилу.

public abstract string[] GetUsedFonts()

Returns

string []

Списак шрифта

Examples

Следећи пример показује како да штампате информације о употребљеним и пропуштеним шрифтовима у сликама ВМФ/МЕФ.

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)

Рециклирајте каучу.

public abstract void ResizeCanvas(Rectangle newRectangle)

Parameters

newRectangle Rectangle

Нови правоугао.

Examples

Следећи пример показује како додати границу са одређеним маргинима око метафила (ММФ и ЕМР).

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)

Сачува податке на одређени stream'.

protected override sealed void SaveData(Stream stream)

Parameters

stream Stream

У току струје.

 Српски