Class WmfImage
名称: Aspose.Imaging.FileFormats.Wmf アセンション: Aspose.Imaging.dll (25.4.0)
マイクロソフト ウィンドウ メタファイル (WMF) 画像を API で操作するベクトルおよびビットマップの両方のデータを変数長の記録に保存します。簡単に画像をリサイクル、回転、フリップし、カスタマイズされた画像パレットを設定します。WMF ファイルを圧縮された WMZ フォーマットに変換したり、ラスター 画像フォーマットに保存したりします。プラットフォームやアプリケーションを通じて多様な使用を提供します。
[JsonObject(MemberSerialization.OptIn)]
public class WmfImage : MetaImage, IDisposable, IObjectWithBounds, IObjectWithSizeF
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← VectorImage ← MetaImage ← WmfImage
Implements
IDisposable , IObjectWithBounds , IObjectWithSizeF
相続人
MetaImage.GetUsedFonts() , MetaImage.GetMissedFonts() , MetaImage.ResizeCanvas(Rectangle) , MetaImage.GetCanNotSaveMessage(ImageOptionsBase) , MetaImage.SaveData(Stream) , MetaImage.Records , 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()
Examples
下記の例では、wmz画像をwmf fromatに変換する方法を示しています。
string file = "example.wmz";
string baseFolder = System.IO.Path.Combine("D:", "Compressed");
string inputFile = System.IO.Path.Combine(baseFolder, file);
string outFile = inputFile + ".wmf";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
{
Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions() { PageSize = image.Size};
image.Save(outFile, new Aspose.Imaging.ImageOptions.WmfOptions() {VectorRasterizationOptions = vectorRasterizationOptions});
}
下記の例では、wmf画像をwmz fromatに変換する方法を示しています。
string file = "castle.wmf";
string baseFolder = System.IO.Path.Combine("D:", "Compressed");
string inputFile = System.IO.Path.Combine(baseFolder, file);
string outFile = inputFile + ".wmz";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
{
Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions() { PageSize = image.Size};
image.Save(outFile, new Aspose.Imaging.ImageOptions.WmfOptions() {VectorRasterizationOptions = vectorRasterizationOptions, Compress = true});
}
下記の例では、圧縮された画像を変換する方法を示しています(エムズ.wmz, *.svgz) に ラスター スライド
string[] files = new[] {"example.emz", "example.wmz", "example.svgz"};
string baseFolder = System.IO.Path.Combine("D:","Compressed");
foreach (var file in files)
{
string inputFile = System.IO.Path.Combine(baseFolder, file);
string outFile = inputFile + ".png";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
{
Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Color.White, image.Width, image.Height });
image.Save(outFile, new Aspose.Imaging.ImageOptions.PngOptions(){VectorRasterizationOptions = vectorRasterizationOptions});
}
}
この例では、ファイルから WMF 画像をアップロードし、WmfRasterizationOptions を使用して SVG に変換する方法を示しています。
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"))
{
Aspose.Imaging.ImageOptions.SvgOptions saveOptions = new Aspose.Imaging.ImageOptions.SvgOptions();
// Text will be converted to shapes.
saveOptions.TextAsShapes = true;
Aspose.Imaging.ImageOptions.WmfRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions();
// The background color of the drawing surface.
rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
// The page size.
rasterizationOptions.PageSize = wmfImage.Size;
// If embedded emf exists, then render emf; otherwise render wmf.
rasterizationOptions.RenderMode = Aspose.Imaging.FileFormats.Wmf.WmfRenderMode.Auto;
saveOptions.VectorRasterizationOptions = rasterizationOptions;
wmfImage.Save(dir + "test.output.svg", saveOptions);
}
Constructors
WmfImage()
Aspose.Imaging.FileFormats.Wmf.WmfImage クラスの新しい例を作成し、それを開始します。Windows Metafile (WMF) 画像データのさらなる操作および処理プロデューサーは、WMF画像で作業するための基本的なオブジェクトを提供し、WMF画像処理機能をアプリケーションに無効に統合機能性
[JsonConstructor]
public WmfImage()
WmfImage(int、 int)
Aspose.Imaging.FileFormats.Wmf.WmfImage クラスの新しい例をカスタマイズできるようにインスタントする幅と高さのパラメーター、白いWMF画像の作成を容易にする特定のサイズに適応します. この構造を使用して、ダイナミックに生成します。WMF画像は、正確なサイズで、柔軟な画像作成を可能にし、あなたのアプリケーション内の操作
public WmfImage(int width, int height)
Parameters
width
int
広さ。
height
int
高さです。
Properties
BitsPerPixel
画像のピクセルごとにビットの数を回収し、色のレベルを示す。深さまたはグラノラリティ. この特性を使用して画像の色を決定します。代表性と正確性、互換性チェックおよび色関連を促進するあなたのアプリケーション内での処理
[JsonIgnore]
public override int BitsPerPixel { get; }
不動産価値
Exceptions
FileFormat
画像に関連するファイル形式の値にアクセスし、情報を提供します。画像が保存されている形式について. この属性を使用して、画像のファイル形式、互換性チェックを容易にし、あなたのアプリケーション内で特定のフォーマット処理
public override FileFormat FileFormat { get; }
不動産価値
FrameBounds
フレームの境界にアクセスし、その位置と次元を示す。画像. この属性を使用して、フレームに関する詳細な情報を取得します。スペースの位置、あなたのアプリケーション内で正確な操作と renderingを可能にします。
public Rectangle FrameBounds { get; }
不動産価値
高さF
画像の高さにアクセスし、その垂直に沿ってピクセルの数を表す。axis. この特性を使用して、画像の空間次元と外観を確認します。比率で、正確な配置とアプリケーション内の調整を可能にします。
public override float HeightF { get; }
不動産価値
Exceptions
Inch
インチ属性へのアクセスまたは変更、通常の測定ユニットを表す印刷または表示コンテキストで物理的な次元を指定するために使用される。イメージに関連するインチ値を確立または取得する財産、あなたのアプリケーション内の物理的な次元の正確な表現を容易にします。
public int Inch { get; set; }
不動産価値
IsCached
オブジェクトのデータが現在暗号化されているかどうかを示すボーリー値を回収します。追加のデータ読み取り作業の必要性を排除します. この資産を利用するオブジェクトのデータが容易に利用可能であるかどうかを決定することによってパフォーマンスを最適化するあなたのアプリケーション内の高価なデータ収集プロセスの必要性なし。
public override bool IsCached { get; }
不動産価値
Exceptions
ウィドフ
画像の幅にアクセスし、画像に沿ってピクセルの数を示す。地平線軸:この特性を使用して、画像の空間次元を決定します。and aspect ratio, enabling accurate layout and rendering adjustments within your応募
public override float WidthF { get; }
不動産価値
Exceptions
Methods
AddRecord(WmfObject)
指定された記録オブジェクトを画像に挿入し、そのコンテンツを豊かにします。追加データまたはメタデータ. この方法を使用して、無制限に記録を統合するイメージへのオブジェクト、包括的なデータストレージおよび組織の促進あなたの応募中。
public int AddRecord(WmfObject record)
Parameters
record
WmfObject
記録です。
Returns
記録数です。
CacheData()
効率的にデータをキャッシュし、追加の充電の必要性を排除します。ダウンロード Aspose.Imaging.DataStreamSupporter.DataStreamContainer. これを使用するパフォーマンスを最適化し、アプリ内のリソースの使用を最小限にする方法地元のデータキャッシュを保存およびアクセスすることによって。
public override void CacheData()
Examples
この例では、ファイルからWMF画像をアップロードする方法を示し、そのすべての記録をリストします。
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,>
Exceptions
GetDefaultOptions(対象[])
画像に関連するデフォルトオプションを修正し、アクセスを提供します。既定の設定または設定. この方法を使用してデフォルトにアクセス画像処理作業の設定、一貫性と便利性を促進アプリケーションの機能の範囲内で
public override ImageOptionsBase GetDefaultOptions(object[] args)
Parameters
args
object
( )
主張は。
Returns
デフォルトオプション
GetOriginalOptions()
オリジナルの画像オプションを取得します。
public override ImageOptionsBase GetOriginalOptions()
Returns
オリジナルの画像オプション
GetPostScript()
画像に関連するPostScriptデータにアクセスし、詳細を提供します。構造またはコンテンツに関する情報. この方法を使用してアプリケーション内のさらなる分析または処理のためのPostScriptデータ、PostScript rendering または manipulation に関連する高度な機能を可能にします。
public string GetPostScript()
Returns
ポスト脚本
GetUsedFonts()
メタフィル内で使用される文字のリストをリトリウムし、メタフィル内で使用される文字のリストをリトリウムします。画像に使用されているフォントリソース. この方法を使用してフォントの使用を分析するそして、あなたのアプリケーション内で送信またはさらなる処理のためのフォントの可用性を確保します。
public override string[] GetUsedFonts()
Returns
string ( )
フォントリスト
ResizeCanvas(Rectangle)
画像のカンバを取り戻し、そのサイズを調整し、画像を保存します。コンテンツ. この方法を使用して、カンバのサイズを変更することなく変更します。コンテンツ、レイアウトの調整と構成の変更を促進する応募
public override void ResizeCanvas(Rectangle newRectangle)
Parameters
newRectangle
Rectangle
新しい直角。
Exceptions
SetPalette(ボール、ボール)
画像に指定されたパレットを適用し、色のカスタマイズを可能にします。この方法を使用して、ビジュアル・レンダリングを向上させ、あなたのアプリケーション内の特定の色効果
public override void SetPalette(IColorPalette palette, bool updateColors)
Parameters
palette
IColorPalette
パレットを設定する。
updateColors
bool
「真実」に設定された色は、新しいパレットに従って更新されます; そうでないと、色指数は変わらないままです. 変更されていない指数は、いくつかの指数が不適切なパレットエントリーを持っている場合、ロード上の画像が崩壊する可能性があることに注意してください。