Class Brush

Class Brush

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)

基本的なブラシクラスです。

[JsonObject(MemberSerialization.OptIn)]
public abstract class Brush : DisposableObject, IDisposable

継承

objectDisposableObjectBrush

派生

HatchBrush, SolidBrush, TransformBrush

実装

IDisposable

継承メンバー

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

コンストラクタ

Brush()

protected Brush()

プロパティ

Opacity

ブラシの不透明度を取得または設定します。値は0から1の間である必要があります。値が0の場合、ブラシは完全に表示され、値が1の場合、ブラシは完全に不透明です。

public float Opacity { get; set; }

プロパティ値

float

この例では、Graphicsクラスを使用して画像の表面に基本的な形状を作成します。操作を示すために、この例ではPNG形式の新しい画像を作成し、Graphicsクラスによって公開されているDrawメソッドを使用して画像の表面に基本的な形状を描画します。```csharp [C#]

                                                                                                                                                                                                                                                            //FileStreamのインスタンスを作成
                                                                                                                                                                                                                                                            using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                //PngOptionsのインスタンスを作成し、そのさまざまなプロパティを設定
                                                                                                                                                                                                                                                                Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                //PngOptionsのソースを設定
                                                                                                                                                                                                                                                                pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                //Imageのインスタンスを作成
                                                                                                                                                                                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Graphicsクラスのインスタンスを作成して初期化
                                                                                                                                                                                                                                                                    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                    //Graphics表面をクリア
                                                                                                                                                                                                                                                                    graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                    //Penオブジェクトを指定して弧を描画
                                                                                                                                                                                                                                                                    graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                    //青色のPenオブジェクトと座標ポイントを指定してベジェ曲線を描画
                                                                                                                                                                                                                                                                    graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                    //緑色のPenオブジェクトとポイントの配列を指定して曲線を描画
                                                                                                                                                                                                                                                                    graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                    //Penオブジェクトと周囲の長方形を使用して楕円を描画
                                                                                                                                                                                                                                                                    graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                    //線を描画
                                                                                                                                                                                                                                                                    graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                    //円弧セグメントを描画
                                                                                                                                                                                                                                                                    graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                    //赤色のPenオブジェクトとポイントの配列を指定して多角形を描画
                                                                                                                                                                                                                                                                    graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                    //長方形を描画
                                                                                                                                                                                                                                                                    graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                    //SolidBrushオブジェクトを作成し、そのさまざまなプロパティを設定
                                                                                                                                                                                                                                                                    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                    brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                    brush.Opacity = 100;

                                                                                                                                                                                                                                                                    //SolidBrushオブジェクトとフォントを使用して、特定のポイントに文字列を描画
                                                                                                                                                                                                                                                                    graphics.DrawString("この画像はAspose.Imaging APIによって作成されました", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                    //すべての変更を保存します。
                                                                                                                                                                                                                                                                    image.Save();
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                            }

## メソッド

### <a id="Aspose_Imaging_Brush_DeepClone"></a> DeepClone\(\)

現在のAspose.Imaging.Brushの新しいディープクローンを作成します。

```csharp
public virtual Brush DeepClone()

戻り値

Brush

このAspose.Imaging.Brushインスタンスのディープクローンである新しいAspose.Imaging.Brush。

Equals(object)

オブジェクトが等しいかどうかを確認します。

public override bool Equals(object obj)

パラメータ

obj object

他のオブジェクト。

戻り値

bool

等価比較の結果。

Equals(Brush)

オブジェクトが等しいかどうかを確認します。

protected bool Equals(Brush other)

パラメータ

other Brush

他のオブジェクト。

戻り値

bool

等価比較の結果。

GetHashCode()

現在のオブジェクトのハッシュコードを取得します。

public override int GetHashCode()

戻り値

int

ハッシュコード。

 日本語