ColorMatrix クラス
アセンブリ: System.Drawing (system.drawing.dll 内)



System.Drawing.Imaging.ColorMatrix


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ColorMatrix コンストラクタ ()
アセンブリ: System.Drawing (system.drawing.dll 内)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ColorMatrix コンストラクタ (Single[][])
アセンブリ: System.Drawing (system.drawing.dll 内)


ColorMatrix を作成して使用する方法を次のコード例で示します。この例を実行するには、コードを Windows フォームに貼り付け、フォームの Paint イベント処理メソッドから、e を PaintEventArgs として渡すことにより、RotateColors を呼び出します。
Private Sub RotateColors(ByVal e As PaintEventArgs) Dim image As Bitmap = New Bitmap("RotationInput.bmp") Dim imageAttributes As New ImageAttributes() Dim width As Integer = image.Width Dim height As Integer = image.Height Dim degrees As Single = 60.0F Dim r As Double = degrees * System.Math.PI / 180 ' degrees to radians Dim colorMatrixElements As Single()() = { _ New Single() {CSng(System.Math.Cos(r)), _ CSng(System.Math.Sin(r)), 0, 0, 0}, _ New Single() {CSng(-System.Math.Sin(r)), _ CSng(-System.Math.Cos(r)), 0, 0, 0}, _ New Single() {0, 0, 2, 0, 0}, _ New Single() {0, 0, 0, 1, 0}, _ New Single() {0, 0, 0, 0, 1}} Dim colorMatrix As New ColorMatrix(colorMatrixElements) imageAttributes.SetColorMatrix( _ colorMatrix, _ ColorMatrixFlag.Default, _ ColorAdjustType.Bitmap) e.Graphics.DrawImage(image, 10, 10, width, height) ' Pass in the destination rectangle (2nd argument), the upper-left corner ' (3rd and 4th arguments), width (5th argument), and height (6th ' argument) of the source rectangle. e.Graphics.DrawImage( _ image, _ New Rectangle(150, 10, width, height), _ 0, 0, _ width, _ height, _ GraphicsUnit.Pixel, _ imageAttributes) End Sub
private void RotateColors(PaintEventArgs e) { Bitmap image = new Bitmap("RotationInput.bmp"); ImageAttributes imageAttributes = new ImageAttributes(); int width = image.Width; int height = image.Height; float degrees = 60f; double r = degrees * System.Math.PI / 180; // degrees to radians float[][] colorMatrixElements = { new float[] {(float)System.Math.Cos(r), (float)System.Math.Sin(r), 0, 0, 0}, new float[] {(float)-System.Math.Sin(r), (float)-System.Math.Cos(r), 0, 0, 0}, new float[] {0, 0, 2, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1}}; ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements); imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); e.Graphics.DrawImage(image, 10, 10, width, height); e.Graphics.DrawImage( image, new Rectangle(150, 10, width, height), // destination rectangle 0, 0, // upper-left corner of source rectangle width, // width of source rectangle height, // height of source rectangle GraphicsUnit.Pixel, imageAttributes); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ColorMatrix コンストラクタ

名前 | 説明 |
---|---|
ColorMatrix () | ColorMatrix クラスの新しいインスタンスを初期化します。 |
ColorMatrix (Single[][]) | 指定した行列 newColorMatrix の要素を使用して、ColorMatrix クラスの新しいインスタンスを初期化します。 |

ColorMatrix プロパティ

名前 | 説明 | |
---|---|---|
![]() | Item | ColorMatrix で指定された行と列にある要素を取得または設定します。 |
![]() | Matrix00 | この ColorMatrix の第 0 (ゼロ) 行、第 0 列にある要素を取得または設定します。 |
![]() | Matrix01 | この ColorMatrix の第 0 (ゼロ) 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix02 | この ColorMatrix の第 0 (ゼロ) 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix03 | この ColorMatrix の第 0 (ゼロ) 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix04 | この ColorMatrix の第 0 (ゼロ) 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix10 | この ColorMatrix の第 1 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix11 | この ColorMatrix の第 1 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix12 | この ColorMatrix の第 1 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix13 | この ColorMatrix の第 1 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix14 | この ColorMatrix の第 1 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix20 | この ColorMatrix の第 2 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix21 | この ColorMatrix の第 2 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix22 | この ColorMatrix の第 2 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix23 | この ColorMatrix の第 2 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix24 | この ColorMatrix の第 2 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix30 | この ColorMatrix の第 3 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix31 | この ColorMatrix の第 3 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix32 | この ColorMatrix の第 3 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix33 | この ColorMatrix の第 3 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix34 | この ColorMatrix の第 3 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix40 | この ColorMatrix の第 4 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix41 | この ColorMatrix の第 4 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix42 | この ColorMatrix の第 4 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix43 | この ColorMatrix の第 4 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix44 | この ColorMatrix の第 4 行、第 4 列にある要素を取得または設定します。 |

ColorMatrix メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

ColorMatrix メンバ
RGBA 空間の座標を格納する 5 × 5 の行列を定義します。ImageAttributes クラスのいくつかのメソッドは、カラー行列を使用してイメージの色を調整します。このクラスは継承できません。
ColorMatrix データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Item | ColorMatrix で指定された行と列にある要素を取得または設定します。 |
![]() | Matrix00 | この ColorMatrix の第 0 (ゼロ) 行、第 0 列にある要素を取得または設定します。 |
![]() | Matrix01 | この ColorMatrix の第 0 (ゼロ) 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix02 | この ColorMatrix の第 0 (ゼロ) 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix03 | この ColorMatrix の第 0 (ゼロ) 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix04 | この ColorMatrix の第 0 (ゼロ) 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix10 | この ColorMatrix の第 1 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix11 | この ColorMatrix の第 1 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix12 | この ColorMatrix の第 1 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix13 | この ColorMatrix の第 1 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix14 | この ColorMatrix の第 1 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix20 | この ColorMatrix の第 2 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix21 | この ColorMatrix の第 2 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix22 | この ColorMatrix の第 2 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix23 | この ColorMatrix の第 2 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix24 | この ColorMatrix の第 2 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix30 | この ColorMatrix の第 3 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix31 | この ColorMatrix の第 3 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix32 | この ColorMatrix の第 3 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix33 | この ColorMatrix の第 3 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix34 | この ColorMatrix の第 3 行、第 4 列にある要素を取得または設定します。 |
![]() | Matrix40 | この ColorMatrix の第 4 行、第 0 (ゼロ) 列にある要素を取得または設定します。 |
![]() | Matrix41 | この ColorMatrix の第 4 行、第 1 列にある要素を取得または設定します。 |
![]() | Matrix42 | この ColorMatrix の第 4 行、第 2 列にある要素を取得または設定します。 |
![]() | Matrix43 | この ColorMatrix の第 4 行、第 3 列にある要素を取得または設定します。 |
![]() | Matrix44 | この ColorMatrix の第 4 行、第 4 列にある要素を取得または設定します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からColorMatrixを検索する場合は、下記のリンクをクリックしてください。

- ColorMatrixのページへのリンク