GOA - System.Drawing.Filters.ColorMatrixFilter

ColorMatrixFilter Class


Represents a filter that uses a color matrix.

Definition

public class ColorMatrixFilter: Filter

Members Table

MethodDescription
CloneCreates a shallow copy of the current Filter. (Inherited from Filter)
ColorMatrixFilterInitializes a new instance of ColorMatrixFilter.
CopyMatrixCopies the ColorMatrix of the ColorMatrixFilter to another ColorMatrix.
EqualsOverloaded. Compares two objects to determine if they are equal. (Inherited from Object)
GetHashCodeServes as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object)
GetTypeGets the Type of the current instance. (Inherited from Object)
ReferenceEqualsDetermines whether the specified Object instances are the same instance. (Inherited from Object)
SetMatrixSets a specified ColorMatrix to the current ColorMatrixFilter.
ToStringReturns a String that represents the current Object. (Inherited from Object)

Inheritance Hierarchy

Object
Filter
ColorMatrixFilter

Examples

// This sample shows how to create an AsyncImage class and how to apply a ColorMatrixFilter on it.

 

using System;

using System.Drawing;

using System.Diagnostics;

using System.Windows.Forms;

using System.Drawing.Filters;

 

public class MyControl : System.Windows.Forms.Control

{

     AsyncImage myAsyncImage;

 

     public MyControl() {}

 

     protected override void OnCreateControl()

     {

          Visual v= this.Visual;

 

          string url= "http://www.netikatech.com/demos/resources/image.aspx?index=1";

 

          // Creates a new instance of the AsyncImage.

          this.myAsyncImage = new AsyncImage(v, 30, 20 );

          this.myAsyncImage.Load(url );

 

          // Creates a new ColorMatrix.

          ColorMatrix colMat = new ColorMatrix();

 

          // Sets some elements of the ColorMatrix.

          colMat[4]=255;

          colMat[9]=80;

          colMat[2,4]=50;

 

          // Displays the content of the ColorMatrix

          Debug.WriteLine("\nColor matrix:" +colMat.ToString());

 

          // Creates a new ColorMatrixFilter.

          ColorMatrixFilter colMatFil = new ColorMatrixFilter();

 

          // Sets the ColorMatrix to the ColorMatrixFilter.

          colMatFil.SetMatrix(colMat);

 

          // Applies the ColorMatrixFilter to the AsyncImage.

          this.myAsyncImage.ApplyFilter(colMatFil);

 

          base.OnCreateControl();

     }

}

 

public class Form1 : System.Windows.Forms.Form

{

 

     private MyControl control1= null;

 

     public Form1()

     {

          InitializeComponent();

     }

 

     private void InitializeComponent()

     {

          this.SuspendLayout();

          this.control1= new MyControl();

          this.control1.Location= new System.Drawing.Point(10,10);

          this.control1.Size= new Size(Application.Width-10,Application.Height-10);

          this.Controls.Add(this.control1);

          this.ResumeLayout(false);

     }

 

     static void Main()

     {

          Application.Run( new Form1() );

     }

}

 

/*

The output of the sample:

 

Color matrix:[1,0,0,0,255,0,1,0,0,80,0,0,1,0,50,0,0,0,1,0]

 

*/

 

Class Information

NamespaceSystem.Drawing.Filters
Flash LibrarySystem.Windows.Forms.scl
Flash Library Version2.0.0.2118
Silverlight LibrarySystem.Windows.Forms.dll



© 2003-2007 NETiKA Technologies. All rights reserved.