Represents a filter that uses a color matrix.
public class ColorMatrixFilter: Filter
ObjectFilterColorMatrixFilter
// 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 );
// 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.
// Applies the ColorMatrixFilter to the AsyncImage.
this.myAsyncImage.ApplyFilter(colMatFil);
}
}
public class Form1 : System.Windows.Forms.Form
{
private MyControl control1= null;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
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);
}
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]
*/
Namespace System.Drawing.Filters Flash Library System.Windows.Forms.scl Flash Library Version 2.0.0.2118 Silverlight Library System.Windows.Forms.dll
| © 2003-2007 NETiKA Technologies. All rights reserved. |