Click here to Skip to main content
15,896,606 members
Articles / Programming Languages / C#

Transparency Tutorial with C# - Part 2

Rate me:
Please Sign up or sign in to vote.
4.86/5 (47 votes)
23 Mar 2004CPOL8 min read 128.8K   5.4K   131  
An article on Compositing, ColorMatrix, and ImageAttributes
// The color finder is based on WhatColor.cs by Charles Petzold, www.charlespetzold.com
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace ColorMatrixDemo
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{

		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.NumericUpDown numericUpDown00;
		private System.Windows.Forms.NumericUpDown numericUpDown01;
		private System.Windows.Forms.NumericUpDown numericUpDown02;
		private System.Windows.Forms.NumericUpDown numericUpDown03;
		private System.Windows.Forms.NumericUpDown numericUpDown04;
		private System.Windows.Forms.NumericUpDown numericUpDown13;
		private System.Windows.Forms.NumericUpDown numericUpDown12;
		private System.Windows.Forms.NumericUpDown numericUpDown11;
		private System.Windows.Forms.NumericUpDown numericUpDown10;
		private System.Windows.Forms.NumericUpDown numericUpDown24;
		private System.Windows.Forms.NumericUpDown numericUpDown23;
		private System.Windows.Forms.NumericUpDown numericUpDown22;
		private System.Windows.Forms.NumericUpDown numericUpDown21;
		private System.Windows.Forms.NumericUpDown numericUpDown20;
		private System.Windows.Forms.NumericUpDown numericUpDown33;
		private System.Windows.Forms.NumericUpDown numericUpDown32;
		private System.Windows.Forms.NumericUpDown numericUpDown31;
		private System.Windows.Forms.NumericUpDown numericUpDown30;
		private System.Windows.Forms.NumericUpDown numericUpDown44;
		private System.Windows.Forms.NumericUpDown numericUpDown43;
		private System.Windows.Forms.NumericUpDown numericUpDown42;
		private System.Windows.Forms.NumericUpDown numericUpDown41;
		private System.Windows.Forms.NumericUpDown numericUpDown40;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label10;

		private float matrix00 = 1.0f;
		private float matrix01 = 0.0f;
		private float matrix02 = 0.0f;
		private float matrix03 = 0.0f;
		private float matrix04 = 0.0f;

		private float matrix10 = 0.0f;
		private float matrix11 = 1.0f;
		private float matrix12 = 0.0f;
		private float matrix13 = 0.0f;
		private float matrix14 = 0.0f;
		
		private float matrix20 = 0.0f;
		private float matrix21 = 0.0f;
		private float matrix22 = 1.0f;
		private float matrix23 = 0.0f;
		private float matrix24 = 0.0f;

		private float matrix30 = 0.0f;
		private float matrix31 = 0.0f;
		private float matrix32 = 0.0f;
		private float matrix33 = 1.0f;
		private float matrix34 = 0.0f;

		private float matrix40 = 0.0f;
		private float matrix41 = 0.0f;
		private float matrix42 = 0.0f;
		private float matrix43 = 0.0f;
		private System.Windows.Forms.NumericUpDown numericUpDown34;
		private System.Windows.Forms.NumericUpDown numericUpDown14;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.Label label12;
		private System.Windows.Forms.Label label13;
		private System.Windows.Forms.Label label14;
		private System.Windows.Forms.NumericUpDown numericUpDownAlpha;
		private System.Windows.Forms.NumericUpDown numericUpDownBlue;
		private System.Windows.Forms.NumericUpDown numericUpDownGreen;
		private System.Windows.Forms.NumericUpDown numericUpDownRed;
		private System.Windows.Forms.Label label15;
		private System.Windows.Forms.Label label16;
		private System.Windows.Forms.Label label17;
		private System.Windows.Forms.Label label18;
		private System.Windows.Forms.Label labelBlueResult;
		private System.Windows.Forms.Label labelGreenResult;
		private System.Windows.Forms.Label labelRedResult;
		private System.Windows.Forms.Label labelAlphaResult;
		private System.Windows.Forms.Label label19;
		private float matrix44 = 1.0f;

		private float startRed = 1.00f;
		private float startGreen = 1.00f;
		private float startBlue = 0.00f;
		private System.Windows.Forms.Label label20;
		private System.Windows.Forms.Label label21;
		private System.Windows.Forms.Label label22;
		private System.Windows.Forms.Label label23;
		private System.Windows.Forms.Label label24;
		private System.Windows.Forms.Label label25;
		private System.Windows.Forms.Label label26;
		private System.Windows.Forms.Label label27;
		private System.Windows.Forms.Label label28;
		private System.Windows.Forms.Label label29;
		private float startAlpha = 0.50f;
	
		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			SetStyle(ControlStyles.AllPaintingInWmPaint | 
				ControlStyles.UserPaint | 
				ControlStyles.DoubleBuffer,
				true);		
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.numericUpDown00 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown01 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown02 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown03 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown04 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown14 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown13 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown12 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown11 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown10 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown24 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown23 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown22 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown21 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown20 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown34 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown33 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown32 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown31 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown30 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown44 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown43 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown42 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown41 = new System.Windows.Forms.NumericUpDown();
			this.numericUpDown40 = new System.Windows.Forms.NumericUpDown();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.label10 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.label11 = new System.Windows.Forms.Label();
			this.label12 = new System.Windows.Forms.Label();
			this.label13 = new System.Windows.Forms.Label();
			this.label14 = new System.Windows.Forms.Label();
			this.numericUpDownAlpha = new System.Windows.Forms.NumericUpDown();
			this.numericUpDownBlue = new System.Windows.Forms.NumericUpDown();
			this.numericUpDownGreen = new System.Windows.Forms.NumericUpDown();
			this.numericUpDownRed = new System.Windows.Forms.NumericUpDown();
			this.label15 = new System.Windows.Forms.Label();
			this.label16 = new System.Windows.Forms.Label();
			this.label17 = new System.Windows.Forms.Label();
			this.label18 = new System.Windows.Forms.Label();
			this.labelBlueResult = new System.Windows.Forms.Label();
			this.labelGreenResult = new System.Windows.Forms.Label();
			this.labelRedResult = new System.Windows.Forms.Label();
			this.labelAlphaResult = new System.Windows.Forms.Label();
			this.label19 = new System.Windows.Forms.Label();
			this.label20 = new System.Windows.Forms.Label();
			this.label21 = new System.Windows.Forms.Label();
			this.label22 = new System.Windows.Forms.Label();
			this.label23 = new System.Windows.Forms.Label();
			this.label24 = new System.Windows.Forms.Label();
			this.label25 = new System.Windows.Forms.Label();
			this.label26 = new System.Windows.Forms.Label();
			this.label27 = new System.Windows.Forms.Label();
			this.label28 = new System.Windows.Forms.Label();
			this.label29 = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown00)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown01)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown02)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown03)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown04)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown14)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown13)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown12)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown24)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown23)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown22)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown20)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown34)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown33)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown32)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown31)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown30)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown44)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown43)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown42)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown41)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown40)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownAlpha)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownBlue)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownGreen)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownRed)).BeginInit();
			this.SuspendLayout();
			// 
			// numericUpDown00
			// 
			this.numericUpDown00.DecimalPlaces = 2;
			this.numericUpDown00.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown00.Location = new System.Drawing.Point(276, 268);
			this.numericUpDown00.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown00.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown00.Name = "numericUpDown00";
			this.numericUpDown00.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown00.TabIndex = 3;
			this.numericUpDown00.Value = new System.Decimal(new int[] {
																		  1,
																		  0,
																		  0,
																		  0});
			this.numericUpDown00.ValueChanged += new System.EventHandler(this.numericUpDown00_ValueChanged);
			// 
			// numericUpDown01
			// 
			this.numericUpDown01.DecimalPlaces = 2;
			this.numericUpDown01.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown01.Location = new System.Drawing.Point(276, 288);
			this.numericUpDown01.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown01.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown01.Name = "numericUpDown01";
			this.numericUpDown01.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown01.TabIndex = 4;
			this.numericUpDown01.ValueChanged += new System.EventHandler(this.numericUpDown01_ValueChanged);
			// 
			// numericUpDown02
			// 
			this.numericUpDown02.DecimalPlaces = 2;
			this.numericUpDown02.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown02.Location = new System.Drawing.Point(276, 308);
			this.numericUpDown02.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown02.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown02.Name = "numericUpDown02";
			this.numericUpDown02.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown02.TabIndex = 5;
			this.numericUpDown02.ValueChanged += new System.EventHandler(this.numericUpDown02_ValueChanged);
			// 
			// numericUpDown03
			// 
			this.numericUpDown03.DecimalPlaces = 2;
			this.numericUpDown03.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown03.Location = new System.Drawing.Point(276, 328);
			this.numericUpDown03.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown03.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown03.Name = "numericUpDown03";
			this.numericUpDown03.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown03.TabIndex = 6;
			this.numericUpDown03.ValueChanged += new System.EventHandler(this.numericUpDown03_ValueChanged);
			// 
			// numericUpDown04
			// 
			this.numericUpDown04.DecimalPlaces = 2;
			this.numericUpDown04.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown04.Location = new System.Drawing.Point(276, 348);
			this.numericUpDown04.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown04.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown04.Name = "numericUpDown04";
			this.numericUpDown04.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown04.TabIndex = 7;
			this.numericUpDown04.ValueChanged += new System.EventHandler(this.numericUpDown04_ValueChanged);
			// 
			// numericUpDown14
			// 
			this.numericUpDown14.DecimalPlaces = 2;
			this.numericUpDown14.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown14.Location = new System.Drawing.Point(324, 348);
			this.numericUpDown14.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown14.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown14.Name = "numericUpDown14";
			this.numericUpDown14.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown14.TabIndex = 12;
			this.numericUpDown14.ValueChanged += new System.EventHandler(this.numericUpDown14_ValueChanged);
			// 
			// numericUpDown13
			// 
			this.numericUpDown13.DecimalPlaces = 2;
			this.numericUpDown13.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown13.Location = new System.Drawing.Point(324, 328);
			this.numericUpDown13.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown13.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown13.Name = "numericUpDown13";
			this.numericUpDown13.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown13.TabIndex = 11;
			this.numericUpDown13.ValueChanged += new System.EventHandler(this.numericUpDown13_ValueChanged);
			// 
			// numericUpDown12
			// 
			this.numericUpDown12.DecimalPlaces = 2;
			this.numericUpDown12.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown12.Location = new System.Drawing.Point(324, 308);
			this.numericUpDown12.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown12.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown12.Name = "numericUpDown12";
			this.numericUpDown12.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown12.TabIndex = 10;
			this.numericUpDown12.ValueChanged += new System.EventHandler(this.numericUpDown12_ValueChanged);
			// 
			// numericUpDown11
			// 
			this.numericUpDown11.DecimalPlaces = 2;
			this.numericUpDown11.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown11.Location = new System.Drawing.Point(324, 288);
			this.numericUpDown11.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown11.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown11.Name = "numericUpDown11";
			this.numericUpDown11.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown11.TabIndex = 9;
			this.numericUpDown11.Value = new System.Decimal(new int[] {
																		  1,
																		  0,
																		  0,
																		  0});
			this.numericUpDown11.ValueChanged += new System.EventHandler(this.numericUpDown11_ValueChanged);
			// 
			// numericUpDown10
			// 
			this.numericUpDown10.DecimalPlaces = 2;
			this.numericUpDown10.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown10.Location = new System.Drawing.Point(324, 268);
			this.numericUpDown10.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown10.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown10.Name = "numericUpDown10";
			this.numericUpDown10.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown10.TabIndex = 8;
			this.numericUpDown10.ValueChanged += new System.EventHandler(this.numericUpDown10_ValueChanged);
			// 
			// numericUpDown24
			// 
			this.numericUpDown24.DecimalPlaces = 2;
			this.numericUpDown24.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown24.Location = new System.Drawing.Point(372, 348);
			this.numericUpDown24.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown24.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown24.Name = "numericUpDown24";
			this.numericUpDown24.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown24.TabIndex = 17;
			this.numericUpDown24.ValueChanged += new System.EventHandler(this.numericUpDown24_ValueChanged);
			// 
			// numericUpDown23
			// 
			this.numericUpDown23.DecimalPlaces = 2;
			this.numericUpDown23.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown23.Location = new System.Drawing.Point(372, 328);
			this.numericUpDown23.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown23.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown23.Name = "numericUpDown23";
			this.numericUpDown23.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown23.TabIndex = 16;
			this.numericUpDown23.ValueChanged += new System.EventHandler(this.numericUpDown23_ValueChanged);
			// 
			// numericUpDown22
			// 
			this.numericUpDown22.DecimalPlaces = 2;
			this.numericUpDown22.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown22.Location = new System.Drawing.Point(372, 308);
			this.numericUpDown22.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown22.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown22.Name = "numericUpDown22";
			this.numericUpDown22.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown22.TabIndex = 15;
			this.numericUpDown22.Value = new System.Decimal(new int[] {
																		  1,
																		  0,
																		  0,
																		  0});
			this.numericUpDown22.ValueChanged += new System.EventHandler(this.numericUpDown22_ValueChanged);
			// 
			// numericUpDown21
			// 
			this.numericUpDown21.DecimalPlaces = 2;
			this.numericUpDown21.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown21.Location = new System.Drawing.Point(372, 288);
			this.numericUpDown21.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown21.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown21.Name = "numericUpDown21";
			this.numericUpDown21.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown21.TabIndex = 14;
			this.numericUpDown21.ValueChanged += new System.EventHandler(this.numericUpDown21_ValueChanged);
			// 
			// numericUpDown20
			// 
			this.numericUpDown20.DecimalPlaces = 2;
			this.numericUpDown20.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown20.Location = new System.Drawing.Point(372, 268);
			this.numericUpDown20.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown20.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown20.Name = "numericUpDown20";
			this.numericUpDown20.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown20.TabIndex = 13;
			this.numericUpDown20.ValueChanged += new System.EventHandler(this.numericUpDown20_ValueChanged);
			// 
			// numericUpDown34
			// 
			this.numericUpDown34.DecimalPlaces = 2;
			this.numericUpDown34.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown34.Location = new System.Drawing.Point(420, 348);
			this.numericUpDown34.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown34.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown34.Name = "numericUpDown34";
			this.numericUpDown34.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown34.TabIndex = 22;
			this.numericUpDown34.ValueChanged += new System.EventHandler(this.numericUpDown34_ValueChanged);
			// 
			// numericUpDown33
			// 
			this.numericUpDown33.DecimalPlaces = 2;
			this.numericUpDown33.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown33.Location = new System.Drawing.Point(420, 328);
			this.numericUpDown33.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown33.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown33.Name = "numericUpDown33";
			this.numericUpDown33.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown33.TabIndex = 21;
			this.numericUpDown33.Value = new System.Decimal(new int[] {
																		  1,
																		  0,
																		  0,
																		  0});
			this.numericUpDown33.ValueChanged += new System.EventHandler(this.numericUpDown33_ValueChanged);
			// 
			// numericUpDown32
			// 
			this.numericUpDown32.DecimalPlaces = 2;
			this.numericUpDown32.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown32.Location = new System.Drawing.Point(420, 308);
			this.numericUpDown32.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown32.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown32.Name = "numericUpDown32";
			this.numericUpDown32.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown32.TabIndex = 20;
			this.numericUpDown32.ValueChanged += new System.EventHandler(this.numericUpDown32_ValueChanged);
			// 
			// numericUpDown31
			// 
			this.numericUpDown31.DecimalPlaces = 2;
			this.numericUpDown31.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown31.Location = new System.Drawing.Point(420, 288);
			this.numericUpDown31.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown31.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown31.Name = "numericUpDown31";
			this.numericUpDown31.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown31.TabIndex = 19;
			this.numericUpDown31.ValueChanged += new System.EventHandler(this.numericUpDown31_ValueChanged);
			// 
			// numericUpDown30
			// 
			this.numericUpDown30.DecimalPlaces = 2;
			this.numericUpDown30.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown30.Location = new System.Drawing.Point(420, 268);
			this.numericUpDown30.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown30.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown30.Name = "numericUpDown30";
			this.numericUpDown30.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown30.TabIndex = 18;
			this.numericUpDown30.ValueChanged += new System.EventHandler(this.numericUpDown30_ValueChanged);
			// 
			// numericUpDown44
			// 
			this.numericUpDown44.DecimalPlaces = 2;
			this.numericUpDown44.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown44.Location = new System.Drawing.Point(468, 348);
			this.numericUpDown44.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown44.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown44.Name = "numericUpDown44";
			this.numericUpDown44.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown44.TabIndex = 27;
			this.numericUpDown44.Value = new System.Decimal(new int[] {
																		  1,
																		  0,
																		  0,
																		  0});
			this.numericUpDown44.ValueChanged += new System.EventHandler(this.numericUpDown44_ValueChanged);
			// 
			// numericUpDown43
			// 
			this.numericUpDown43.DecimalPlaces = 2;
			this.numericUpDown43.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown43.Location = new System.Drawing.Point(468, 328);
			this.numericUpDown43.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown43.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown43.Name = "numericUpDown43";
			this.numericUpDown43.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown43.TabIndex = 26;
			this.numericUpDown43.ValueChanged += new System.EventHandler(this.numericUpDown43_ValueChanged);
			// 
			// numericUpDown42
			// 
			this.numericUpDown42.DecimalPlaces = 2;
			this.numericUpDown42.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown42.Location = new System.Drawing.Point(468, 308);
			this.numericUpDown42.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown42.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown42.Name = "numericUpDown42";
			this.numericUpDown42.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown42.TabIndex = 25;
			this.numericUpDown42.ValueChanged += new System.EventHandler(this.numericUpDown42_ValueChanged);
			// 
			// numericUpDown41
			// 
			this.numericUpDown41.DecimalPlaces = 2;
			this.numericUpDown41.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown41.Location = new System.Drawing.Point(468, 288);
			this.numericUpDown41.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown41.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown41.Name = "numericUpDown41";
			this.numericUpDown41.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown41.TabIndex = 24;
			this.numericUpDown41.ValueChanged += new System.EventHandler(this.numericUpDown41_ValueChanged);
			// 
			// numericUpDown40
			// 
			this.numericUpDown40.DecimalPlaces = 2;
			this.numericUpDown40.Increment = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  131072});
			this.numericUpDown40.Location = new System.Drawing.Point(468, 268);
			this.numericUpDown40.Maximum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			0});
			this.numericUpDown40.Minimum = new System.Decimal(new int[] {
																			5,
																			0,
																			0,
																			-2147483648});
			this.numericUpDown40.Name = "numericUpDown40";
			this.numericUpDown40.Size = new System.Drawing.Size(48, 20);
			this.numericUpDown40.TabIndex = 23;
			this.numericUpDown40.ValueChanged += new System.EventHandler(this.numericUpDown40_ValueChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(256, 332);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(12, 16);
			this.label1.TabIndex = 28;
			this.label1.Text = "A";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(256, 272);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(12, 16);
			this.label2.TabIndex = 29;
			this.label2.Text = "R";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(256, 292);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(12, 16);
			this.label3.TabIndex = 30;
			this.label3.Text = "G";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(256, 312);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(12, 16);
			this.label4.TabIndex = 31;
			this.label4.Text = "B";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(256, 352);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(16, 16);
			this.label5.TabIndex = 32;
			this.label5.Text = "W";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(484, 248);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(16, 16);
			this.label6.TabIndex = 37;
			this.label6.Text = "W";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(384, 248);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(12, 16);
			this.label7.TabIndex = 36;
			this.label7.Text = "B";
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(332, 248);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(12, 16);
			this.label8.TabIndex = 35;
			this.label8.Text = "G";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(284, 248);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(12, 16);
			this.label9.TabIndex = 34;
			this.label9.Text = "R";
			// 
			// label10
			// 
			this.label10.Location = new System.Drawing.Point(432, 248);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(12, 16);
			this.label10.TabIndex = 33;
			this.label10.Text = "A";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(320, 208);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(75, 32);
			this.button1.TabIndex = 38;
			this.button1.Text = "Restore Defaults";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// label11
			// 
			this.label11.Location = new System.Drawing.Point(124, 288);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(12, 16);
			this.label11.TabIndex = 51;
			this.label11.Text = "B";
			// 
			// label12
			// 
			this.label12.Location = new System.Drawing.Point(72, 288);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(12, 16);
			this.label12.TabIndex = 50;
			this.label12.Text = "G";
			// 
			// label13
			// 
			this.label13.Location = new System.Drawing.Point(28, 288);
			this.label13.Name = "label13";
			this.label13.Size = new System.Drawing.Size(12, 16);
			this.label13.TabIndex = 49;
			this.label13.Text = "R";
			// 
			// label14
			// 
			this.label14.Location = new System.Drawing.Point(168, 288);
			this.label14.Name = "label14";
			this.label14.Size = new System.Drawing.Size(12, 16);
			this.label14.TabIndex = 48;
			this.label14.Text = "A";
			// 
			// numericUpDownAlpha
			// 
			this.numericUpDownAlpha.DecimalPlaces = 2;
			this.numericUpDownAlpha.Increment = new System.Decimal(new int[] {
																				 1,
																				 0,
																				 0,
																				 131072});
			this.numericUpDownAlpha.Location = new System.Drawing.Point(156, 308);
			this.numericUpDownAlpha.Maximum = new System.Decimal(new int[] {
																			   1,
																			   0,
																			   0,
																			   0});
			this.numericUpDownAlpha.Name = "numericUpDownAlpha";
			this.numericUpDownAlpha.Size = new System.Drawing.Size(48, 20);
			this.numericUpDownAlpha.TabIndex = 45;
			this.numericUpDownAlpha.Value = new System.Decimal(new int[] {
																			 5,
																			 0,
																			 0,
																			 65536});
			this.numericUpDownAlpha.ValueChanged += new System.EventHandler(this.numericUpDownAlpha_ValueChanged);
			// 
			// numericUpDownBlue
			// 
			this.numericUpDownBlue.DecimalPlaces = 2;
			this.numericUpDownBlue.Increment = new System.Decimal(new int[] {
																				1,
																				0,
																				0,
																				131072});
			this.numericUpDownBlue.Location = new System.Drawing.Point(108, 308);
			this.numericUpDownBlue.Maximum = new System.Decimal(new int[] {
																			  1,
																			  0,
																			  0,
																			  0});
			this.numericUpDownBlue.Name = "numericUpDownBlue";
			this.numericUpDownBlue.Size = new System.Drawing.Size(48, 20);
			this.numericUpDownBlue.TabIndex = 43;
			this.numericUpDownBlue.ValueChanged += new System.EventHandler(this.numericUpDownBlue_ValueChanged);
			// 
			// numericUpDownGreen
			// 
			this.numericUpDownGreen.DecimalPlaces = 2;
			this.numericUpDownGreen.Increment = new System.Decimal(new int[] {
																				 1,
																				 0,
																				 0,
																				 131072});
			this.numericUpDownGreen.Location = new System.Drawing.Point(60, 308);
			this.numericUpDownGreen.Maximum = new System.Decimal(new int[] {
																			   1,
																			   0,
																			   0,
																			   0});
			this.numericUpDownGreen.Name = "numericUpDownGreen";
			this.numericUpDownGreen.Size = new System.Drawing.Size(48, 20);
			this.numericUpDownGreen.TabIndex = 41;
			this.numericUpDownGreen.Value = new System.Decimal(new int[] {
																			 1,
																			 0,
																			 0,
																			 0});
			this.numericUpDownGreen.ValueChanged += new System.EventHandler(this.numericUpDownGreen_ValueChanged);
			// 
			// numericUpDownRed
			// 
			this.numericUpDownRed.DecimalPlaces = 2;
			this.numericUpDownRed.Increment = new System.Decimal(new int[] {
																			   1,
																			   0,
																			   0,
																			   131072});
			this.numericUpDownRed.Location = new System.Drawing.Point(12, 308);
			this.numericUpDownRed.Maximum = new System.Decimal(new int[] {
																			 1,
																			 0,
																			 0,
																			 0});
			this.numericUpDownRed.Name = "numericUpDownRed";
			this.numericUpDownRed.Size = new System.Drawing.Size(48, 20);
			this.numericUpDownRed.TabIndex = 39;
			this.numericUpDownRed.Value = new System.Decimal(new int[] {
																		   1,
																		   0,
																		   0,
																		   0});
			this.numericUpDownRed.ValueChanged += new System.EventHandler(this.numericUpDownRed_ValueChanged);
			// 
			// label15
			// 
			this.label15.Location = new System.Drawing.Point(648, 292);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(12, 16);
			this.label15.TabIndex = 55;
			this.label15.Text = "B";
			// 
			// label16
			// 
			this.label16.Location = new System.Drawing.Point(612, 292);
			this.label16.Name = "label16";
			this.label16.Size = new System.Drawing.Size(12, 16);
			this.label16.TabIndex = 54;
			this.label16.Text = "G";
			// 
			// label17
			// 
			this.label17.Location = new System.Drawing.Point(580, 292);
			this.label17.Name = "label17";
			this.label17.Size = new System.Drawing.Size(12, 16);
			this.label17.TabIndex = 53;
			this.label17.Text = "R";
			// 
			// label18
			// 
			this.label18.Location = new System.Drawing.Point(676, 292);
			this.label18.Name = "label18";
			this.label18.Size = new System.Drawing.Size(12, 16);
			this.label18.TabIndex = 52;
			this.label18.Text = "A";
			// 
			// labelBlueResult
			// 
			this.labelBlueResult.Location = new System.Drawing.Point(636, 316);
			this.labelBlueResult.Name = "labelBlueResult";
			this.labelBlueResult.Size = new System.Drawing.Size(32, 32);
			this.labelBlueResult.TabIndex = 59;
			this.labelBlueResult.Text = "1.00f";
			// 
			// labelGreenResult
			// 
			this.labelGreenResult.Location = new System.Drawing.Point(604, 316);
			this.labelGreenResult.Name = "labelGreenResult";
			this.labelGreenResult.Size = new System.Drawing.Size(36, 32);
			this.labelGreenResult.TabIndex = 58;
			this.labelGreenResult.Text = "1.00f";
			// 
			// labelRedResult
			// 
			this.labelRedResult.Location = new System.Drawing.Point(568, 316);
			this.labelRedResult.Name = "labelRedResult";
			this.labelRedResult.Size = new System.Drawing.Size(40, 32);
			this.labelRedResult.TabIndex = 57;
			this.labelRedResult.Text = "1.00f";
			// 
			// labelAlphaResult
			// 
			this.labelAlphaResult.Location = new System.Drawing.Point(668, 316);
			this.labelAlphaResult.Name = "labelAlphaResult";
			this.labelAlphaResult.Size = new System.Drawing.Size(32, 32);
			this.labelAlphaResult.TabIndex = 56;
			this.labelAlphaResult.Text = "1.00f";
			// 
			// label19
			// 
			this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label19.Location = new System.Drawing.Point(536, 312);
			this.label19.Name = "label19";
			this.label19.Size = new System.Drawing.Size(20, 16);
			this.label19.TabIndex = 60;
			this.label19.Text = "=";
			// 
			// label20
			// 
			this.label20.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label20.Location = new System.Drawing.Point(544, 280);
			this.label20.Name = "label20";
			this.label20.Size = new System.Drawing.Size(32, 96);
			this.label20.TabIndex = 62;
			this.label20.Text = "[";
			// 
			// label21
			// 
			this.label21.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label21.Location = new System.Drawing.Point(712, 280);
			this.label21.Name = "label21";
			this.label21.Size = new System.Drawing.Size(36, 96);
			this.label21.TabIndex = 63;
			this.label21.Text = "]";
			// 
			// label22
			// 
			this.label22.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label22.Location = new System.Drawing.Point(-12, 276);
			this.label22.Name = "label22";
			this.label22.Size = new System.Drawing.Size(36, 96);
			this.label22.TabIndex = 64;
			this.label22.Text = "[";
			// 
			// label23
			// 
			this.label23.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label23.Location = new System.Drawing.Point(212, 276);
			this.label23.Name = "label23";
			this.label23.Size = new System.Drawing.Size(24, 96);
			this.label23.TabIndex = 65;
			this.label23.Text = "]";
			// 
			// label24
			// 
			this.label24.Font = new System.Drawing.Font("Times New Roman", 99.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label24.Location = new System.Drawing.Point(480, 232);
			this.label24.Name = "label24";
			this.label24.Size = new System.Drawing.Size(60, 148);
			this.label24.TabIndex = 66;
			this.label24.Text = "]";
			// 
			// label25
			// 
			this.label25.Font = new System.Drawing.Font("Times New Roman", 99.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label25.Location = new System.Drawing.Point(208, 232);
			this.label25.Name = "label25";
			this.label25.Size = new System.Drawing.Size(68, 148);
			this.label25.TabIndex = 67;
			this.label25.Text = "[";
			// 
			// label26
			// 
			this.label26.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label26.Location = new System.Drawing.Point(204, 308);
			this.label26.Name = "label26";
			this.label26.Size = new System.Drawing.Size(24, 16);
			this.label26.TabIndex = 68;
			this.label26.Text = "1.0";
			// 
			// label27
			// 
			this.label27.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label27.Location = new System.Drawing.Point(700, 316);
			this.label27.Name = "label27";
			this.label27.Size = new System.Drawing.Size(24, 16);
			this.label27.TabIndex = 69;
			this.label27.Text = "1.0";
			// 
			// label28
			// 
			this.label28.Location = new System.Drawing.Point(708, 292);
			this.label28.Name = "label28";
			this.label28.Size = new System.Drawing.Size(16, 16);
			this.label28.TabIndex = 70;
			this.label28.Text = "W";
			// 
			// label29
			// 
			this.label29.Location = new System.Drawing.Point(208, 288);
			this.label29.Name = "label29";
			this.label29.Size = new System.Drawing.Size(16, 16);
			this.label29.TabIndex = 71;
			this.label29.Text = "W";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.Color.White;
			this.ClientSize = new System.Drawing.Size(740, 378);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.label29,
																		  this.label28,
																		  this.label27,
																		  this.label26,
																		  this.label19,
																		  this.labelBlueResult,
																		  this.labelGreenResult,
																		  this.labelRedResult,
																		  this.labelAlphaResult,
																		  this.label15,
																		  this.label16,
																		  this.label17,
																		  this.label18,
																		  this.label11,
																		  this.label12,
																		  this.label13,
																		  this.label14,
																		  this.numericUpDownAlpha,
																		  this.numericUpDownBlue,
																		  this.numericUpDownGreen,
																		  this.numericUpDownRed,
																		  this.button1,
																		  this.label6,
																		  this.label7,
																		  this.label8,
																		  this.label9,
																		  this.label10,
																		  this.label5,
																		  this.label4,
																		  this.label3,
																		  this.label2,
																		  this.label1,
																		  this.numericUpDown44,
																		  this.numericUpDown43,
																		  this.numericUpDown42,
																		  this.numericUpDown41,
																		  this.numericUpDown40,
																		  this.numericUpDown34,
																		  this.numericUpDown33,
																		  this.numericUpDown32,
																		  this.numericUpDown31,
																		  this.numericUpDown30,
																		  this.numericUpDown24,
																		  this.numericUpDown23,
																		  this.numericUpDown22,
																		  this.numericUpDown21,
																		  this.numericUpDown20,
																		  this.numericUpDown14,
																		  this.numericUpDown13,
																		  this.numericUpDown12,
																		  this.numericUpDown11,
																		  this.numericUpDown10,
																		  this.numericUpDown04,
																		  this.numericUpDown03,
																		  this.numericUpDown02,
																		  this.numericUpDown01,
																		  this.numericUpDown00,
																		  this.label21,
																		  this.label20,
																		  this.label22,
																		  this.label23,
																		  this.label24,
																		  this.label25});
			this.Name = "Form1";
			this.Text = "Color Matrix - Single Color";
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown00)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown01)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown02)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown03)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown04)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown14)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown13)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown12)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown24)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown23)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown22)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown20)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown34)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown33)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown32)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown31)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown30)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown44)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown43)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown42)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown41)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown40)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownAlpha)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownBlue)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownGreen)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownRed)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private Bitmap bitmapBefore = new Bitmap(250,200);
		private Bitmap bitmapAfter = new Bitmap(250,200);
		private Rectangle rect = new Rectangle(20,20,700,100);
		private Color afterColor;
		private float floatRed,floatGreen,floatBlue,floatAlpha;
		protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
		{
			// Fill in Background (for effieciency only the area that has been clipped)
			e.Graphics.FillRectangle(new SolidBrush(SystemColors.Window), e.ClipRectangle.X,e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height);

			//
			// Draw the spectrum
			//
			LinearGradientBrush brBrush = 
				new LinearGradientBrush(
				rect, Color.Blue, Color.Red, 
				LinearGradientMode.Vertical);
			
			// Create color and point arrays
			Color[] clrArray =
				{
					Color.FromArgb(255,0,0,0),
					Color.FromArgb(255,128,0,128),
					Color.FromArgb(255,255,0,255),
					Color.FromArgb(255,128,0,255),
					Color.FromArgb(255,0,0,255),
					Color.FromArgb(255,0,128,255),
					Color.FromArgb(255,0,255,255),
					Color.FromArgb(255,0, 255,128),
					Color.FromArgb(255,0,255,0),
					Color.FromArgb(255,128,255,0),
					Color.FromArgb(255,255,255,0),
					Color.FromArgb(255,255,128,0),
					Color.FromArgb(255,255,0,0),
					Color.FromArgb(255,128,0,0),
					Color.FromArgb(255,0,0,0)
				};
			float[] posArray =
				{
					0.0f,
					1.0f/14.0f,
					2.0f/14.0f,
					3.0f/14.0f,
					4.0f/14.0f,
					5.0f/14.0f,
					6.0f/14.0f,
					7.0f/14.0f,
					8.0f/14.0f,
					9.0f/14.0f,
					10.0f/14.0f,
					11.0f/14.0f,
					12.0f/14.0f,
					13.0f/14.0f,
					1.0f

				};

			// Create a ColorBlend object and
			// set its Colors and Positions properties
			ColorBlend colorBlend = new ColorBlend();
			colorBlend.Colors = clrArray;
			colorBlend.Positions = posArray;
			// Set interpolationColors property
			brBrush.InterpolationColors = colorBlend;

			// Fill Rectangle
			e.Graphics.FillRectangle(brBrush, rect);


			// Convert starting color the floats to bytes
			byte alpha = (byte)(startAlpha * (float)255);
			byte red = (byte)(startRed * (float)255);
			byte green = (byte)(startGreen * (float)255);
			byte blue = (byte)(startBlue * (float)255);

			// Create the 'before' color box
			SolidBrush brBefore = new SolidBrush(Color.FromArgb(alpha,red,green,blue));
			Graphics bitmapBeforeGraphics = Graphics.FromImage(bitmapBefore);
			bitmapBeforeGraphics.CompositingMode = CompositingMode.SourceCopy;
			bitmapBeforeGraphics.FillRectangle(brBefore,0,0,250,200);
			e.Graphics.DrawImage(bitmapBefore,20,20,250,200);
			
			// Transform the 'before' color to the 'after' color		
			
			// Create a points array
			float[][] ptsArray = 
			{
				new float[] { matrix00, matrix10, matrix20, matrix30, matrix40},
				new float[] { matrix01, matrix11, matrix21, matrix31, matrix41},
				new float[] { matrix02, matrix12, matrix22, matrix32, matrix42},
				new float[] { matrix03, matrix13, matrix23, matrix33, matrix43},
				new float[] { matrix04, matrix14, matrix24, matrix34, matrix44}
			};
			// Create a ColorMatrix object using pts array
			ColorMatrix clrMatrix = 
				new ColorMatrix(ptsArray);
			// Create an ImageAttributes object
			ImageAttributes imgAttributes =
				new ImageAttributes();
			// Set color matrix of imageAttributes
			imgAttributes.SetColorMatrix(clrMatrix,
				ColorMatrixFlag.Default,
				ColorAdjustType.Bitmap);
			
	
			Graphics bitmapAfterGraphics = Graphics.FromImage(bitmapAfter);
			bitmapAfterGraphics.CompositingMode = CompositingMode.SourceCopy;
			//bitmapBeforeGraphics.FillRectangle(brBefore,0,0,250,200);
			bitmapAfterGraphics.DrawImage(bitmapBefore,
				new Rectangle(0,0,250,200),
				0,0, 250, 200,
				GraphicsUnit.Pixel, imgAttributes);

			afterColor = bitmapAfter.GetPixel(0,0);

			e.Graphics.DrawImage(bitmapAfter,470,20,250,200);
/*			e.Graphics.DrawImage(bitmapBefore,
				new Rectangle(470,20,250,200),
				0,0, 250, 200,
				GraphicsUnit.Pixel, imgAttributes);
*/
			
			//
			// Create the 'after' color box

			//Graphics bitmapAfterGraphics = Graphics.FromImage(bitmapAfter);
			// Draw the image to get the changes
			//bitmapAfterGraphics.DrawImage(bitmapAfter,470,10,250,200);
/*			bitmapAfterGraphics.DrawImage(bitmapAfter,
				new Rectangle(470,10,250,200),
				0,0, 250, 200,
				GraphicsUnit.Pixel, imgAttributes);
			// Get 'after' color from a pixel composited over black
			afterColor = 
				bitmapAfter.GetPixel(0,0);
			
			// Make a brush from the aftercolor		
			SolidBrush brAfter = new SolidBrush(Color.FromArgb(afterColor.A,afterColor.R,afterColor.G,afterColor.B));
			bitmapAfterGraphics.FillRectangle(brAfter,0,0,250,200);
			bitmapAfterGraphics.DrawImage(bitmapAfter,
				new Rectangle(470,10,250,200),
				0,0, 250, 200,
				GraphicsUnit.Pixel, imgAttributes);
*/			
			
			floatRed = (float)afterColor.R/255;
			floatGreen = (float)afterColor.G/255;
			floatBlue= (float)afterColor.B/255;
			floatAlpha = (float)afterColor.A/255;

			// Show results
			labelRedResult.Text = floatRed.ToString("0.00") + " (" + afterColor.R.ToString() + ")";
			labelGreenResult.Text = floatGreen.ToString("0.00") + " (" + afterColor.G.ToString() + ")";
			labelBlueResult.Text = floatBlue.ToString("0.00") + " (" + afterColor.B.ToString() + ")";
			labelAlphaResult.Text = floatAlpha.ToString("0.00") + " (" + afterColor.A.ToString() + ")";
						
			// Draw bitmap to the form
			//e.Graphics.DrawImage(bitmapAfter,470,20,250,200);

			//new Rectangle(470,10,250,200),
			//0,0, 250, 200,
			//GraphicsUnit.Pixel, imgAttributes);

			// Draw the static Spectrum image
			//e.Graphics.DrawImage(Image.FromFile("Spectrum.jpg"),
			//	10,10, 200, 110);
									
			// Dispose of objects
			brBrush.Dispose();
			brBefore.Dispose();


		}

		private void numericUpDown00_ValueChanged(object sender, System.EventArgs e)
		{
			matrix00 = (float)numericUpDown00.Value;
			Invalidate();
		}

		private void numericUpDown01_ValueChanged(object sender, System.EventArgs e)
		{
			matrix01 = (float)numericUpDown01.Value;
			Invalidate();	
		}

		private void numericUpDown02_ValueChanged(object sender, System.EventArgs e)
		{
			matrix02 = (float)numericUpDown02.Value;
			Invalidate();
		}

		private void numericUpDown03_ValueChanged(object sender, System.EventArgs e)
		{
			matrix03 = (float)numericUpDown03.Value;
			Invalidate();
		}

		private void numericUpDown04_ValueChanged(object sender, System.EventArgs e)
		{
			matrix04 = (float)numericUpDown04.Value;
			Invalidate();
		}

		private void numericUpDown10_ValueChanged(object sender, System.EventArgs e)
		{
			matrix10 = (float)numericUpDown10.Value;
			Invalidate();
		}

		private void numericUpDown11_ValueChanged(object sender, System.EventArgs e)
		{
			matrix11 = (float)numericUpDown11.Value;
			Invalidate();
		}

		private void numericUpDown12_ValueChanged(object sender, System.EventArgs e)
		{
			matrix12 = (float)numericUpDown12.Value;
			Invalidate();
		}

		private void numericUpDown13_ValueChanged(object sender, System.EventArgs e)
		{
			matrix13 = (float)numericUpDown13.Value;
			Invalidate();
		}

		private void numericUpDown14_ValueChanged(object sender, System.EventArgs e)
		{
			matrix14 = (float)numericUpDown14.Value;
			Invalidate();
		}

		private void numericUpDown20_ValueChanged(object sender, System.EventArgs e)
		{
			matrix20 = (float)numericUpDown20.Value;
			Invalidate();
		}

		private void numericUpDown21_ValueChanged(object sender, System.EventArgs e)
		{
			matrix21 = (float)numericUpDown21.Value;
			Invalidate();
		}

		private void numericUpDown22_ValueChanged(object sender, System.EventArgs e)
		{
			matrix22 = (float)numericUpDown22.Value;
			Invalidate();
		}

		private void numericUpDown23_ValueChanged(object sender, System.EventArgs e)
		{
			matrix23 = (float)numericUpDown23.Value;
			Invalidate();
		}

		private void numericUpDown24_ValueChanged(object sender, System.EventArgs e)
		{
			matrix24 = (float)numericUpDown24.Value;
			Invalidate();
		}

		private void numericUpDown30_ValueChanged(object sender, System.EventArgs e)
		{
			matrix30 = (float)numericUpDown30.Value;
			Invalidate();		
		}

		private void numericUpDown31_ValueChanged(object sender, System.EventArgs e)
		{
			matrix31 = (float)numericUpDown31.Value;
			Invalidate();
		}

		private void numericUpDown32_ValueChanged(object sender, System.EventArgs e)
		{
			matrix32 = (float)numericUpDown32.Value;
			Invalidate();
		}

		private void numericUpDown33_ValueChanged(object sender, System.EventArgs e)
		{
			matrix33 = (float)numericUpDown33.Value;
			Invalidate();
		}

		private void numericUpDown34_ValueChanged(object sender, System.EventArgs e)
		{
			matrix34 = (float)numericUpDown34.Value;
			Invalidate();
		}

		private void numericUpDown40_ValueChanged(object sender, System.EventArgs e)
		{
			matrix40 = (float)numericUpDown40.Value;
			Invalidate();
		}

		private void numericUpDown41_ValueChanged(object sender, System.EventArgs e)
		{
			matrix41 = (float)numericUpDown41.Value;
			Invalidate();		
		}

		private void numericUpDown42_ValueChanged(object sender, System.EventArgs e)
		{
			matrix42 = (float)numericUpDown42.Value;
			Invalidate();
		}

		private void numericUpDown43_ValueChanged(object sender, System.EventArgs e)
		{
			matrix43 = (float)numericUpDown43.Value;
			Invalidate();
		}

		private void numericUpDown44_ValueChanged(object sender, System.EventArgs e)
		{
			matrix44 = (float)numericUpDown44.Value;
			Invalidate();
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			matrix00 = 1.0f;
			matrix01 = 0.0f;
			matrix02 = 0.0f;
			matrix03 = 0.0f;
			matrix04 = 0.0f;

			matrix10 = 0.0f;
			matrix11 = 1.0f;
			matrix12 = 0.0f;
			matrix13 = 0.0f;
			matrix14 = 0.0f;
			
			matrix20 = 0.0f;
			matrix21 = 0.0f;
			matrix22 = 1.0f;
			matrix23 = 0.0f;
			matrix24 = 0.0f;

			matrix30 = 0.0f;
			matrix31 = 0.0f;
			matrix32 = 0.0f;
			matrix33 = 1.0f;
			matrix34 = 0.0f;

			matrix40 = 0.0f;
			matrix41 = 0.0f;
			matrix42 = 0.0f;
			matrix43 = 0.0f;
			matrix44 = 0.1f;

			numericUpDown00.Value = 1;
			numericUpDown01.Value = 0;
			numericUpDown02.Value = 0;
			numericUpDown03.Value = 0;
			numericUpDown04.Value = 0;

			numericUpDown10.Value = 0;
			numericUpDown11.Value = 1;
			numericUpDown12.Value = 0;
			numericUpDown13.Value = 0;
			numericUpDown14.Value = 0;

			numericUpDown20.Value = 0;
			numericUpDown21.Value = 0;
			numericUpDown22.Value = 1;
			numericUpDown23.Value = 0;
			numericUpDown24.Value = 0;

			numericUpDown30.Value = 0;
			numericUpDown31.Value = 0;
			numericUpDown32.Value = 0;
			numericUpDown33.Value = 1;
			numericUpDown34.Value = 0;

			numericUpDown40.Value = 0;
			numericUpDown41.Value = 0;
			numericUpDown42.Value = 0;
			numericUpDown43.Value = 0;
			numericUpDown44.Value = 1;

			Invalidate();
		}

		private void numericUpDownRed_ValueChanged(object sender, System.EventArgs e)
		{
			startRed = (float)numericUpDownRed.Value;
			Invalidate();
		}

		private void numericUpDownGreen_ValueChanged(object sender, System.EventArgs e)
		{
			startGreen = (float)numericUpDownGreen.Value;
			Invalidate();
		}

		private void numericUpDownBlue_ValueChanged(object sender, System.EventArgs e)
		{
			startBlue = (float)numericUpDownBlue.Value;
			Invalidate();
		}

		private void numericUpDownAlpha_ValueChanged(object sender, System.EventArgs e)
		{
			startAlpha = (float)numericUpDownAlpha.Value;
			Invalidate();
		}

		private void buttonRun_Click(object sender, System.EventArgs e)
		{
			Invalidate();
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Writer Smiley Micros
United States United States
www.smileymicros.com

Comments and Discussions