/// <summary> /// Get a color for a line texture (HSL mode). /// </summary> /// <param name="coord">Coord of the color between 0f and 1f</param> /// <param name="outColor">Result color.</param> private void GetColorHSL(float coord, VoxelColor outColor) { switch (this._lockedAttr) { case GUIColorPicker.ColorAttr.Hue: outColor.SetHSL( coord, this._selectedColor.Saturation, this._selectedColor.Luminosity ); break; case GUIColorPicker.ColorAttr.Saturation: outColor.SetHSL( this._selectedColor.Hue, coord, this._selectedColor.Luminosity ); break; case GUIColorPicker.ColorAttr.Luminosity: outColor.SetHSL( this._selectedColor.Hue, this._selectedColor.Saturation, coord ); break; default: throw new ColorPickerMissConfigurationException("Invalid locked value for HSL mode : " + this._lockedAttr); } }
/// <summary> /// Commit RGB / HSL / A fields to the model. /// </summary> /// <param name="model"></param> private void CommitOther(VoxelColor model) { if (this._rgbDirty) { model.Set( this.Parse(this._red) / 255f, this.Parse(this._green) / 255f, this.Parse(this._blue) / 255f ); this.PullHSL(model); } else if (this._hslDirty) { model.SetHSL( this.Parse(this._hue) / 360f, this.Parse(this._saturation) / 100f, this.Parse(this._luminosity) / 100f ); this.PullRGB(model); } if (this._alphaDirty) { model.A = this.Parse(this._alpha) / 100f; } this.PullHex(model); }
/// <summary> /// Get a color for a square texture (HSL mode). /// </summary> /// <param name="x">Coord of the color between 0f and 1f (absciss)</param> /// <param name="y">Coord of the color between 0f and 1f (ordinates)</param> /// <param name="result">Result, if instanciation is not required</param> private void GetColorHSL(float x, float y, VoxelColor result) { switch (this._lockedAttr) { case GUIColorPicker.ColorAttr.Hue: result.SetHSL(this._selectedColor.Hue, x, y); break; case GUIColorPicker.ColorAttr.Saturation: result.SetHSL(x, this._selectedColor.Saturation, y); break; case GUIColorPicker.ColorAttr.Luminosity: result.SetHSL(x, y, this._selectedColor.Luminosity); break; default: throw new ColorPickerMissConfigurationException("Invalid locked value for HSL mode : " + this._lockedAttr); } }