private void DrawRectangle() { _canvas.Locked = true; Endogine.Vector4 clrOrg = _colorObject.Vector; clrOrg[_sliderRepresentsAxis] = this.colorSlider1.Value; Endogine.Vector4 clr = new Endogine.Vector4(0, 0, 0, 1); clr[_sliderRepresentsAxis] = this.colorSlider1.Value; int posX, posY; this.GetXYIndices(out posX, out posY); for (int y = _canvas.Height - 1; y >= 0; y--) { clr[posY] = 1f - (float)y / _canvas.Height; for (int x = _canvas.Width - 1; x >= 0; x--) { clr[posX] = (float)x / _canvas.Width; _colorObject.Vector = clr; _canvas.SetPixel(x, y, _colorObject.ColorRGBA); } } _canvas.Locked = false; _colorObject.Vector = clrOrg; this.pictureBox1.Invalidate(); }
private void SetColorFromLocationInRect(Point pnt) { float x = (float)pnt.X / this.pictureBox1.Width; float y = (float)pnt.Y / this.pictureBox1.Height; x = Math.Min(1, Math.Max(0, x)); y = Math.Min(1, Math.Max(0, y)); Endogine.ColorEx.ColorBase clr = this.ColorObject; Endogine.Vector4 v = clr.Vector; int posX, posY; this.GetXYIndices(out posX, out posY); v[posX] = x; v[posY] = 1f - y; clr.Vector = v; this._colorObject = clr; this.colorSlider1.ColorObject = clr; //this.ColorObject = clr; this.pictureBox1.Invalidate(); if (this.ColorChanged != null) { this.ColorChanged(this, null); } }
private void pictureBox1_Paint(object sender, PaintEventArgs e) { int x, y; this.GetXYIndices(out x, out y); Endogine.Vector4 v = this.ColorObject.Vector; Point p = new Point((int)(v[x] * this.pictureBox1.Width) - this._indicator.Width / 2, (int)((1f - v[y]) * this.pictureBox1.Height) - this._indicator.Height / 2); e.Graphics.DrawImage(this._indicator, p); }
void slider_ValueChanged(object sender, EventArgs e) { //((NumericSlider)sender) Endogine.Vector4 v = new Endogine.Vector4(); for (int i = 0; i < this._sliders.Count; i++) { v[i] = this._sliders[i].Value; } this.ColorObject.Vector = v; if (this.ColorChanged != null) { this.ColorChanged(this, null); } }
private void DrawBackground() { _canvas.Locked = true; Endogine.Vector4 vClrOrg = this._colorObject.Vector.Copy(); Endogine.Vector4 vClr = this._colorObject.Vector.Copy(); for (int i = 0; i < this._canvas.Height; i++) { vClr[this._axis] = 1f - (float)i / this._canvas.Height; this._colorObject.Vector = vClr; this._canvas.SetPixel(0, i, this._colorObject.ColorRGBA); } this._colorObject.Vector = vClrOrg; _canvas.Locked = false; this.BackgroundImage = _canvas.ToBitmap(); this.Invalidate(); //this.BackgroundImageLayout = ImageLayout.Stretch; }
void slider_ValueChanged(object sender, EventArgs e) { //((NumericSlider)sender) Endogine.Vector4 v = new Endogine.Vector4(); for (int i = 0; i < this._sliders.Count; i++) { v[i] = this._sliders[i].Value; } this.ColorObject.Vector = v; if (this.ColorChanged != null) this.ColorChanged(this, null); }
private void DrawRectangle() { _canvas.Locked = true; Endogine.Vector4 clrOrg = _colorObject.Vector; clrOrg[_sliderRepresentsAxis] = this.colorSlider1.Value; Endogine.Vector4 clr = new Endogine.Vector4(0, 0, 0, 1); clr[_sliderRepresentsAxis] = this.colorSlider1.Value; int posX, posY; this.GetXYIndices(out posX, out posY); for (int y = _canvas.Height - 1; y >= 0; y--) { clr[posY] = 1f-(float)y/_canvas.Height; for (int x = _canvas.Width - 1; x >= 0; x--) { clr[posX] = (float)x/_canvas.Width; _colorObject.Vector = clr; _canvas.SetPixel(x, y, _colorObject.ColorRGBA); } } _canvas.Locked = false; _colorObject.Vector = clrOrg; this.pictureBox1.Invalidate(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { Endogine.ColorEx.ColorHsb colorHsb1 = new Endogine.ColorEx.ColorHsb(); Endogine.Vector4 vector41 = new Endogine.Vector4(); Endogine.Vector4 vector42 = new Endogine.Vector4(); this.comboColorSpace = new System.Windows.Forms.ComboBox(); this.comboSliderAxis = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.colorPickerMulti1 = new Endogine.Editors.ColorEditors.ColorPickerMulti(); this.SuspendLayout(); // // comboColorSpace // this.comboColorSpace.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboColorSpace.FormattingEnabled = true; this.comboColorSpace.Location = new System.Drawing.Point(90, 0); this.comboColorSpace.Name = "comboColorSpace"; this.comboColorSpace.Size = new System.Drawing.Size(85, 24); this.comboColorSpace.TabIndex = 1; this.comboColorSpace.SelectedIndexChanged += new System.EventHandler(this.comboColorSpace_SelectedIndexChanged); // // comboSliderAxis // this.comboSliderAxis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboSliderAxis.FormattingEnabled = true; this.comboSliderAxis.Location = new System.Drawing.Point(263, 0); this.comboSliderAxis.Name = "comboSliderAxis"; this.comboSliderAxis.Size = new System.Drawing.Size(45, 24); this.comboSliderAxis.TabIndex = 2; this.comboSliderAxis.SelectedIndexChanged += new System.EventHandler(this.comboSliderAxis_SelectedIndexChanged); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 2); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(87, 17); this.label1.TabIndex = 3; this.label1.Text = "Color space:"; // // colorPickerMulti1 // colorHsb1.A = 255; colorHsb1.B = 0F; colorHsb1.ColorRGBA = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); colorHsb1.H = 0F; colorHsb1.S = 0F; colorHsb1.Vector = vector41; colorHsb1.VectorRGBA = vector42; this.colorPickerMulti1.ColorObject = colorHsb1; this.colorPickerMulti1.Location = new System.Drawing.Point(0, 30); this.colorPickerMulti1.Name = "colorPickerMulti1"; this.colorPickerMulti1.Size = new System.Drawing.Size(321, 258); this.colorPickerMulti1.SliderRepresentsAxis = 1; this.colorPickerMulti1.TabIndex = 0; this.colorPickerMulti1.ColorChanged += new System.EventHandler(this.colorPickerMulti1_ColorChanged); // // ColorPickerMultiEx // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.comboColorSpace); this.Controls.Add(this.label1); this.Controls.Add(this.comboSliderAxis); this.Controls.Add(this.colorPickerMulti1); this.Name = "ColorPickerMultiEx"; this.Size = new System.Drawing.Size(315, 288); this.ResumeLayout(false); this.PerformLayout(); }
//public override void SetValue(string name, Vector3 val) { } public override void SetValue(string name, Endogine.Vector4 val) { this._effect.SetValue(name, new Microsoft.DirectX.Vector4(val.X, val.Y, val.Z, val.W)); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { Endogine.Vector4 vector42 = new Endogine.Vector4(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GridSettings)); Endogine.Vector4 vector41 = new Endogine.Vector4(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.cbDisplayLines = new System.Windows.Forms.CheckBox(); this.cbActive = new System.Windows.Forms.CheckBox(); this.ngOffset = new Endogine.Editors.NumericGroup(); this.ngSpacing = new Endogine.Editors.NumericGroup(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.ngSpacing); this.groupBox1.Location = new System.Drawing.Point(5, 4); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(123, 39); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Spacing"; // // groupBox2 // this.groupBox2.Controls.Add(this.ngOffset); this.groupBox2.Location = new System.Drawing.Point(5, 45); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(123, 41); this.groupBox2.TabIndex = 4; this.groupBox2.TabStop = false; this.groupBox2.Text = "Offset"; // // cbDisplayLines // this.cbDisplayLines.AutoSize = true; this.cbDisplayLines.Location = new System.Drawing.Point(5, 90); this.cbDisplayLines.Name = "cbDisplayLines"; this.cbDisplayLines.Size = new System.Drawing.Size(104, 17); this.cbDisplayLines.TabIndex = 5; this.cbDisplayLines.Text = "Display grid lines"; this.cbDisplayLines.UseVisualStyleBackColor = true; this.cbDisplayLines.CheckedChanged += new System.EventHandler(this.cbDisplayLines_CheckedChanged); // // cbActive // this.cbActive.AutoSize = true; this.cbActive.Location = new System.Drawing.Point(5, 113); this.cbActive.Name = "cbActive"; this.cbActive.Size = new System.Drawing.Size(56, 17); this.cbActive.TabIndex = 6; this.cbActive.Text = "Active"; this.cbActive.UseVisualStyleBackColor = true; this.cbActive.CheckedChanged += new System.EventHandler(this.cbActive_CheckedChanged); // // ngOffset // this.ngOffset.Horizontal = true; this.ngOffset.Labels = "X;Y"; this.ngOffset.Location = new System.Drawing.Point(5, 15); this.ngOffset.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.ngOffset.Name = "ngOffset"; this.ngOffset.NumControls = 2; this.ngOffset.Size = new System.Drawing.Size(113, 21); this.ngOffset.Spacing = ((Endogine.EPoint)(resources.GetObject("ngOffset.Spacing"))); this.ngOffset.TabIndex = 0; this.ngOffset.Vector = vector42; this.ngOffset.ValueChanged += new System.EventHandler(this.ngOffset_ValueChanged); // // ngSpacing // this.ngSpacing.Horizontal = true; this.ngSpacing.Labels = "X;Y"; this.ngSpacing.Location = new System.Drawing.Point(5, 16); this.ngSpacing.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.ngSpacing.Name = "ngSpacing"; this.ngSpacing.NumControls = 2; this.ngSpacing.Size = new System.Drawing.Size(113, 21); this.ngSpacing.Spacing = ((Endogine.EPoint)(resources.GetObject("ngSpacing.Spacing"))); this.ngSpacing.TabIndex = 0; this.ngSpacing.Vector = vector41; this.ngSpacing.ValueChanged += new System.EventHandler(this.ngSpacing_ValueChanged); // // GridSettings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(134, 132); this.Controls.Add(this.cbActive); this.Controls.Add(this.cbDisplayLines); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "GridSettings"; this.Text = "GridSettings"; this.Load += new System.EventHandler(this.GridSettings_Load); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); }