public Color StringToColor(string sInput) { Color cColor; string sFixed = FixName(sInput); if (sFixed.StartsWith("#") && sFixed.Length == 7) // an RGB value in the form #RRGGBB { int red = System.Convert.ToInt32(sFixed.Substring(1, 2), 16); int green = System.Convert.ToInt32(sFixed.Substring(3, 2), 16); int blue = System.Convert.ToInt32(sFixed.Substring(5, 2), 16); return(Color.FromArgb(red, green, blue));; } else if (NamedColors.ContainsKey(sFixed)) // a named Color { NamedColor nc = (NamedColor)NamedColors[sFixed]; return(nc.Color); } else { cColor = Color.FromName(sFixed); if (cColor.IsKnownColor) { return(cColor); } else { return(Color.PaleGreen); } } }
public PenX3D WithColor(NamedColor color) { var result = (PenX3D)MemberwiseClone(); result._material = Materials.GetMaterialWithNewColor(result._material, color); return(result); }
public SceneViewModel() { Colors = NamedColorCollection.GetNamedColors(); _selectedColor = Colors.Random(); Grid = new Grid { Length = 5.0D, Segment = 6.0D }; Position = new Point3D(50, 50, 50); for (var x = 0; x < 6; x++) { for (var z = 0; z < 6; z++) { Grid.Place(x, 0, z, new Cube(_selectedColor.Color)); } } Selection = new SelectionViewModel(Grid, CubeHelper.CreateSelection()); Selection.PropertyChanged += (sender, args) => { RaisePropertyChangedEvent(nameof(SelectionTransform)); }; GridView = new GridViewModel(); GridView.PropertyChanged += (sender, args) => { RaisePropertyChangedEvent(nameof(Model)); }; Render(); }
public static void SetDependentColors(Application app) { Color mainBackgroundColor = (Color)app.Resources[Key_BackgroundColor]; Color textColor = (Color)app.Resources[Key_TextColor]; app.Resources[Key_ContrastColor] = NamedColor.BlackOrWhiteForContrast(mainBackgroundColor); app.Resources[Key_DisabledTextColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.5); app.Resources[Key_backgroundTextBlend05PcColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.05); app.Resources[Key_backgroundTextBlend10PcColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.10); app.Resources[Key_backgroundTextBlend25PcColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.25); app.Resources[Key_backgroundTextBlend50PcColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.50); app.Resources[Key_backgroundTextBlend75PcColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.75); app.Resources[Key_backgroundTextBlend85PcColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.85); app.Resources[Key_backgroundTextBlend95PcColor] = NamedColor.BlendColors(mainBackgroundColor, textColor, 0.95); if (mainBackgroundColor == NamedColor.Black) { app.Resources[Key_EntryBackgroundColor] = NamedColor.White; app.Resources[Key_EntryTextColor] = NamedColor.Black; } else { app.Resources[Key_EntryBackgroundColor] = mainBackgroundColor; app.Resources[Key_EntryTextColor] = app.Resources[Key_TextColor]; } }
public override Image GetImage(double maxEffectiveResolutionDpi, NamedColor foreColor, NamedColor backColor) { int pixelDim = GetPixelDimensions(maxEffectiveResolutionDpi); Bitmap bmp = new Bitmap(pixelDim, pixelDim, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(bmp)) { using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, new Rectangle(Point.Empty, bmp.Size)); } g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; // we want the foreground color to be not influenced by the background color if we have a transparent foreground color using (Pen pen = new Pen(foreColor, (float)(pixelDim * _structureFactor))) { pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; g.DrawLine(pen, -1 * bmp.Width, -0.5f * bmp.Height, 1 * bmp.Width, 1.5f * bmp.Height); g.DrawLine(pen, 0 * bmp.Width, -0.5f * bmp.Height, 2 * bmp.Width, 1.5f * bmp.Height); g.DrawLine(pen, -1 * bmp.Width, 1.5f * bmp.Height, 1 * bmp.Width, -0.5f * bmp.Height); g.DrawLine(pen, 0 * bmp.Width, 1.5f * bmp.Height, 2 * bmp.Width, -0.5f * bmp.Height); } } return bmp; }
private static BrushX GetShadowBrush(BrushX mainBrush) { BrushX cachedShadowBrush = null; switch (mainBrush.BrushType) { default: case BrushType.SolidBrush: cachedShadowBrush = new BrushX(NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0)); break; case BrushType.HatchBrush: cachedShadowBrush = new BrushX(NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0)); break; case BrushType.TextureBrush: cachedShadowBrush = new BrushX(NamedColors.Black); break; case BrushType.LinearGradientBrush: case BrushType.PathGradientBrush: cachedShadowBrush = mainBrush.Clone(); cachedShadowBrush.Color = NamedColor.FromArgb(mainBrush.Color.Color.A, 0, 0, 0); cachedShadowBrush.BackColor = NamedColor.FromArgb(mainBrush.BackColor.Color.A, 0, 0, 0); break; } return(cachedShadowBrush); }
private void btnChange_Click(object sender, EventArgs e) { if (CanChange) { NamedColor origColor = SelectedNamedColor; string name = tbColorName.Text.Trim(); Color color = ucColor.BackColor; origColor.Name = name; origColor.Color = color; foreach (ListViewItem lvi in listView.Items) { if (lvi.Tag == origColor) { lvi.Text = origColor.Name; lvi.SubItems[1].BackColor = origColor.Color; break; } } listView.Sort(); UpdateControls(); if (app.GetControlsAttr(ControlsAttr.AutoSave)) { using (Context context = lib.GetContext()) origColor.Save(context); } if (OnNamedColorChanged != null) { OnNamedColorChanged(this, new NamedColorEventArgs(origColor)); } } }
public void RgbVersionReturnsNullForInvalidNames(string nameValue) { var name = new NamedColor(nameValue); var rgb = name.RedGreenBlue; Assert.That(rgb, Is.Null); }
private async Task ConfirmColorAsync(NamedColor color) { var parameters = new NavigationParameters(); parameters.Add("color", color); await NavigationService.GoBackAsync(parameters); }
private void ProcessFileLine(string sLine) { int start = sLine.IndexOf("\t\t"); if (start != -1) { string colorName = FixName(sLine.Substring(start + 2)); if (!IsKnownColor(colorName)) { string colorValue = sLine.Substring(0, start).Trim(); colorValue = colorValue.Replace(" ", " "); colorValue = colorValue.Replace(" ", " "); colorValue = colorValue.Replace(" ", " "); string[] colorValues = colorValue.Split(' '); if ((colorValues.Length == 3) && (colorName.Length > 0)) { NamedColor nc = new NamedColor { Name = colorName }; byte red = byte.Parse(colorValues[0]); byte green = byte.Parse(colorValues[1]); byte blue = byte.Parse(colorValues[2]); nc.Color = Color.FromArgb(red, green, blue); if (!NamedColors.ContainsKey(nc.Name)) { NamedColors.Add(nc.Name, nc); } } } } }
public void NamedVersionIsItself() { var original = new NamedColor("Derp"); var copy = original.Name; Assert.That(original, Is.SameAs(copy)); }
public override Image GetImage(double maxEffectiveResolutionDpi, NamedColor foreColor, NamedColor backColor) { int pixelDim = GetPixelDimensions(maxEffectiveResolutionDpi); var bmp = new Bitmap(pixelDim, pixelDim, PixelFormat.Format32bppArgb); using (var g = Graphics.FromImage(bmp)) { using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, new Rectangle(Point.Empty, bmp.Size)); } g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; // we want the foreground color to be not influenced by the background color if we have a transparent foreground color using (var pen = new Pen(foreColor, (float)(pixelDim * _structureFactor))) { pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; g.DrawLine(pen, -1 * bmp.Width, -0.5f * bmp.Height, 1 * bmp.Width, 1.5f * bmp.Height); g.DrawLine(pen, 0 * bmp.Width, -0.5f * bmp.Height, 2 * bmp.Width, 1.5f * bmp.Height); g.DrawLine(pen, -1 * bmp.Width, 1.5f * bmp.Height, 1 * bmp.Width, -0.5f * bmp.Height); g.DrawLine(pen, 0 * bmp.Width, 1.5f * bmp.Height, 2 * bmp.Width, -0.5f * bmp.Height); } } return(bmp); }
public FilledRectangle(NamedColor c) { _brush = new BrushX(c) { ParentObject = this }; }
public override Image GetImage(double maxEffectiveResolutionDpi, NamedColor foreColor, NamedColor backColor) { int pixelDim = GetPixelDimensions(maxEffectiveResolutionDpi); var bmp = new Bitmap(pixelDim, pixelDim, PixelFormat.Format32bppArgb); using (var g = Graphics.FromImage(bmp)) { using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, new Rectangle(Point.Empty, bmp.Size)); } g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; // we want the foreground color to be not influenced by the background color if we have a transparent foreground color using (var brush = new SolidBrush(foreColor)) { float s = (float)(pixelDim * _structureFactor); float o = (float)(pixelDim * (0.25 - 0.5 * _structureFactor)); g.FillRectangle(brush, o, o, s, s); g.FillRectangle(brush, o + 0.5f * pixelDim, o + 0.5f * pixelDim, s, s); } } return(bmp); }
/// <summary> /// Initializes a new instance of the <see cref="HemisphericAmbientLight"/> class with default values. /// </summary> public HemisphericAmbientLight() { _colorBelow = NamedColors.White; _colorAbove = NamedColors.White; _lightAmplitude = 1; _directionBelowToAbove = new VectorD3D(0, 0, 1); }
/// <summary> /// Shows the custom color dialog (if the <see cref="ShowPlotColorsOnly"/> property is set to <c>true</c>, this command will be ignored. /// </summary> /// <param name="sender">The sender of this event.</param> /// <param name="newColor">The user selected new color.</param> /// <returns><c>True</c> if the user has chosen a new color. Otherwise, <c>false</c>.</returns> protected virtual bool InternalShowCustomColorDialog(object sender, out NamedColor newColor) { if (ShowPlotColorsOnly) { newColor = InternalSelectedColor; return(false); } /* * var SelectedWpfColor = GuiHelper.ToWpf(InternalSelectedColor); * ColorController ctrl = new ColorController(SelectedWpfColor); * ctrl.ViewObject = new ColorPickerControl(SelectedWpfColor); */ var ctrl = new Gui.Drawing.ColorManagement.NamedColorController(); ctrl.InitializeDocument(InternalSelectedColor); Current.Gui.FindAndAttachControlTo(ctrl); if (Current.Gui.ShowDialog(ctrl, "Select a color", false)) { newColor = (NamedColor)ctrl.ModelObject; return(true); } else { newColor = InternalSelectedColor; return(false); } }
public TextGraphic(double posX, double posY, string text, FontX textFont, NamedColor textColor, double Rotation) : this(new PointD2D(posX, posY), text, textFont, textColor, Rotation) { }
public TextGraphic(PointD2D graphicPosition, string text, FontX textFont, NamedColor textColor, double Rotation) : this(graphicPosition, text, textFont, textColor) { this.Rotation = Rotation; }
/// <summary> /// Initializes a new instance of the <see cref="SpotLight"/> class. /// </summary> /// <param name="lightAmplitude">The light amplitude.</param> /// <param name="color">The color of light.</param> /// <param name="position">The position of the light.</param> /// <param name="directionToLight">The direction from the scene to the light.</param> /// <param name="range">The range of the light.</param> /// <param name="outerConeAngle">The outer cone angle in radians.</param> /// <param name="innerConeAngle">The inner cone angle in radians.</param> /// <param name="isAffixedToCamera">Value indicating whether the light source is affixed to the camera coordinate system or the world coordinate system.</param> public SpotLight(double lightAmplitude, NamedColor color, PointD3D position, VectorD3D directionToLight, double range, double outerConeAngle, double innerConeAngle, bool isAffixedToCamera) { _isAffixedToCamera = isAffixedToCamera; VerifyLightAmplitude(lightAmplitude, nameof(lightAmplitude)); _lightAmplitude = lightAmplitude; _color = color; VerifyPosition(position, nameof(position)); _position = position; var dlen = VerifyDirection(directionToLight, nameof(directionToLight)); _directionToLight = directionToLight / dlen; VerifyRange(range, nameof(range)); _range = range; VerifyAngle(outerConeAngle, nameof(outerConeAngle)); _outerConeAngle = outerConeAngle; VerifyAngle(innerConeAngle, nameof(innerConeAngle)); _innerConeAngle = innerConeAngle; }
public SampleSettingsViewModel(IDictionary <string, object> dictionary) { Name = GetDictionaryEntry <string>(dictionary, "Name"); BirthDate = GetDictionaryEntry(dictionary, "BirthDate", new DateTime(1980, 1, 1)); CodesInCSharp = GetDictionaryEntry <bool>(dictionary, "CodesInCSharp"); NumberOfCopies = GetDictionaryEntry(dictionary, "NumberOfCopies", 1.0); BackgroundNamedColor = NamedColor.Find(GetDictionaryEntry(dictionary, "BackgroundNamedColor", "White")); }
/// <summary> /// Initializes a new instance of the <see cref="SpotLight"/> class with default values. /// </summary> public SpotLight() { _lightAmplitude = 1; _color = NamedColors.White; _range = 1; _directionToLight = new VectorD3D(0, 0, -1); _outerConeAngle = Math.PI / 2; }
private void EhFrameColorChanged(NamedColor obj) { if (null != _doc.Frame) { _doc = _doc.WithFrame(_doc.Frame.WithColor(obj)); _view.ScatterSymbolForPreview = _doc; } }
public TextGraphic(PointD3D graphicPosition, string text, FontX3D textFont, NamedColor textColor) : base(new ItemLocationDirectAutoSize()) { SetPosition(graphicPosition, Main.EventFiring.Suppressed); Font = textFont; Text = text; Color = textColor; }
public void ShouldInitializeProperties() { NamedColor color = new NamedColor("color", Colors.AliceBlue); Assert.AreEqual <string>("color", color.Name); Assert.AreEqual <Color>(Colors.AliceBlue, color.Color); Assert.IsNotNull(color.Brush); }
private void EhInsetColorChanged(NamedColor obj) { if (null != _doc.Inset) { _doc = _doc.WithInset(_doc.Inset.WithColor(obj)); _view.ScatterSymbolForPreview = _doc; } }
/// <summary> /// /// </summary> /// <param name="DyeColor"></param> public override void dyeColor(NamedColor DyeColor) { foreach (KeyValuePair <Vector2, StardewValley.Object> pair in this.objects) { (pair.Value as CustomObject).dyeColor(DyeColor); } this.info.DyedColor = DyeColor; }
/// <summary> /// Calculates the brushes. /// </summary> /// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param> /// <param name="plotColor">The current plot color.</param> /// <param name="cachedPathData">The cached path data.</param> /// <param name="cachedBrushData">Cached brush data, which will be filled-in during this call..</param> /// <returns>True if new cached brush data were calculated; false if the cached data were up-to-date.</returns> private bool CalculateBrushes(IScatterSymbol scatterSymbol, NamedColor plotColor, CachedPathData cachedPathData, ref CachedBrushData cachedBrushData) { if (plotColor == cachedBrushData.PlotColor) { return(false); // cached data valid and could be reused; } cachedBrushData.Clear(); cachedBrushData.PlotColor = plotColor; var plotColorInfluence = _overridePlotColorInfluence ?? scatterSymbol.PlotColorInfluence; if (null != cachedPathData.InsetPath) { var insetColor = _overrideInsetColor ?? scatterSymbol.Inset.Color; if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorFull)) { insetColor = plotColor; } else if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorPreserveAlpha)) { insetColor = plotColor.NewWithAlphaValue(insetColor.Color.A); } cachedBrushData.InsetBrush = new SolidBrush(insetColor); } if (null != cachedPathData.FillPath) { var fillColor = _overrideFillColor ?? scatterSymbol.FillColor; if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorFull)) { fillColor = plotColor; } else if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorPreserveAlpha)) { fillColor = plotColor.NewWithAlphaValue(fillColor.Color.A); } cachedBrushData.FillBrush = new SolidBrush(fillColor); } if (null != cachedPathData.FramePath) { var frameColor = _overrideFrameColor ?? scatterSymbol.Frame.Color; if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorFull)) { frameColor = plotColor; } else if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorPreserveAlpha)) { frameColor = plotColor.NewWithAlphaValue(frameColor.Color.A); } cachedBrushData.FrameBrush = new SolidBrush(frameColor); } return(true); }
private static void UpdateThemeColorMonos(NamedColor c) { var allAffected = ResourcesV2.FindAllInScene <ThemeColor>().Filter(x => x._colorName == c.colorName); foreach (var themeColor in allAffected) { themeColor.ApplyColor(c.colorValue); } }
public void RgbVersionWorks(string nameValue, byte red, byte green, byte blue) { var name = new NamedColor(nameValue); var rgb = name.RedGreenBlue; Assert.That(rgb.Red, Is.EqualTo(red)); Assert.That(rgb.Green, Is.EqualTo(green)); Assert.That(rgb.Blue, Is.EqualTo(blue)); }
/// <summary> /// Creates and then validates a Hankies Pattern /// </summary> /// <param name="id">This pattern's unique ID</param> /// <param name="createdAt">When this pattern was originaly created /// </param> /// <param name="name">A name for this patter that is dispayed to /// customers</param> /// <param name="location">The URI location of this pattern's SVG image</param> /// <param name="color">If this pattern has a color detail that should /// be appiled to the SVG.</param> public Pattern(Guid id, DateTimeOffset createdAt, string name, Uri location, NamedColor color) : base(id, createdAt) { Name = name; Location = location; Color = color; OnValidate(); }
public ColorGroupStyle(ColorGroupStyle from) { _isStepEnabled = from._isStepEnabled; _isInitialized = from._isInitialized; _listOfValues = from._listOfValues; _colorIndex = from._colorIndex; _cachedColor = from._cachedColor; _isLocalGroupStyle = from._isLocalGroupStyle; }
public FrameBase WithColor(NamedColor value) { if (_color == value) { return this; } else { var result = (FrameBase)this.MemberwiseClone(); result._color = value; return result; } }
public ColorProviderBase() { this._colorBelow = NamedColors.Black; this._cachedGdiColorBelow = NamedColors.Black; this._colorAbove = NamedColors.Snow; this._cachedGdiColorAbove = NamedColors.Snow; this._colorInvalid = NamedColors.Transparent; this._cachedGdiColorInvalid = NamedColors.Transparent; _alphaChannel = 255; _colorSteps = 0; }
public static ColorProviderBGMYR NewFromColorBelowAboveInvalidAndTransparency(NamedColor colorBelow, NamedColor colorAbove, NamedColor colorInvalid, double transparency) { var result = new ColorProviderBGMYR(); result._colorBelow = colorBelow; result._cachedGdiColorBelow = colorBelow; result._colorAbove = colorAbove; result._cachedGdiColorAbove = colorAbove; result._colorInvalid = colorInvalid; result._cachedGdiColorInvalid = colorInvalid; result._alphaChannel = GetAlphaFromTransparency(transparency); return result; }
public override Image GetImage(double maxEffectiveResolutionDpi, NamedColor foreColor, NamedColor backColor) { int pixelDim = GetPixelDimensions(maxEffectiveResolutionDpi); Bitmap bmp = new Bitmap(pixelDim, pixelDim, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(bmp)) { using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, new Rectangle(Point.Empty, bmp.Size)); } g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; // we want the foreground color to be not influenced by the background color if we have a transparent foreground color using (var brush = new SolidBrush(foreColor)) { float s = (float)(0.5 * pixelDim - pixelDim * _structureFactor); var points = new PointF[] { new PointF(s, 0.5f * pixelDim), new PointF(0.5f * pixelDim, s), new PointF(pixelDim - s, 0.5f * pixelDim), new PointF(0.5f * pixelDim, pixelDim - s) }; g.FillPolygon(brush, points); } } return bmp; }
public override Image GetImage(double maxEffectiveResolutionDpi, NamedColor foreColor, NamedColor backColor) { int pixelDim = GetPixelDimensions(maxEffectiveResolutionDpi); Bitmap bmp = new Bitmap(pixelDim, pixelDim, PixelFormat.Format32bppArgb); bmp.SetResolution(2000, 2000); using (Graphics g = Graphics.FromImage(bmp)) { using (var brush = new SolidBrush(backColor)) { g.FillRectangle(brush, new Rectangle(Point.Empty, bmp.Size)); } g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; // we want the foreground color to be not influenced by the background color if we have a transparent foreground color using (var brush = new SolidBrush(foreColor)) { double w = pixelDim * _structureFactor; double s = 0.5 * (pixelDim - w); g.FillEllipse(brush, (float)s, (float)s, (float)w, (float)w); } } return bmp; }
public LineShape(PointD3D startPosition, PointD3D endPosition, double lineWidth, NamedColor lineColor) : this(startPosition, null) { this._location.SizeX = RADouble.NewAbs(endPosition.X - startPosition.X); this._location.SizeY = RADouble.NewAbs(endPosition.Y - startPosition.Y); this._location.SizeZ = RADouble.NewAbs(endPosition.Z - startPosition.Z); _linePen = _linePen.WithUniformThickness(lineWidth).WithColor(lineColor); }
public bool Remove(NamedColor item) { throw new NotImplementedException(); }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { string colorSetName = info.GetString("Name"); var colorSetLevel = (Altaxo.Main.ItemDefinitionLevel)info.GetEnum("Level", typeof(Altaxo.Main.ItemDefinitionLevel)); var creationDate = info.GetDateTime("CreationDate"); var isPlotColorSet = info.GetBoolean("IsPlotColorSet"); int count = info.OpenArray("Colors"); var colors = new NamedColor[count]; for (int i = 0; i < count; ++i) { string name = info.GetStringAttribute("Name"); string cvalue = info.GetString("e"); colors[i] = new NamedColor(AxoColor.FromInvariantString(cvalue), name); } info.CloseArray(count); return new ColorSet(colorSetName, colors); }
public bool Contains(NamedColor item) { return _innerList.Contains(item); }
public void CopyTo(NamedColor[] array, int arrayIndex) { _innerList.CopyTo(array, arrayIndex); }
public void Insert(int index, NamedColor item) { throw new NotImplementedException(); }
public void Add(NamedColor item) { throw new NotImplementedException(); }
/// <summary> /// Tries to find a color with the color and the name of the given named color. /// </summary> /// <param name="colorValue">The color value to find.</param> /// <param name="colorName">The color name to find.</param> /// <param name="namedColor">On return, if a color with the same color value and name is found in the collection, that color is returned.</param> /// <returns> /// <c>True</c>, if the color with the given color value and name is found in this collection. Otherwise, <c>false</c> is returned. /// </returns> public bool TryGetValue(AxoColor colorValue, string colorName, out NamedColor namedColor) { int idx; if (_namecolorToIndexDictionary.Value.TryGetValue(new ColorNameKey(colorValue, colorName), out idx)) { namedColor = this._innerList[idx]; return true; } else { namedColor = default(NamedColor); return false; } }
/// <summary> /// Get the index of the given color in the ColorSet. /// </summary> /// <param name="color">The color.</param> /// <returns>The index of the color in the set. If the color is not found in the set, a negative value is returned.</returns> public virtual int IndexOf(NamedColor color) { int idx; if (_namecolorToIndexDictionary.Value.TryGetValue(new ColorNameKey(color.Color, color.Name), out idx)) { return idx; } else { return -1; } }
/// <summary> /// Initializes a new instance of the <see cref="DirectionalLight"/> class with default values. /// </summary> public DirectionalLight() { _lightAmplitude = 1; _color = NamedColors.White; _directionToLight = new VectorD3D(-Math.Sqrt(0.25), -Math.Sqrt(0.25), Math.Sqrt(0.5)); }
public static NamedColorValue Parse(NamedColor color) { return new NamedColorValue(color); }
/// <summary> /// Gets a new instance of <see cref="DirectionalLight"/> with the provided value for <see cref="Color"/>. /// </summary> /// <param name="color">The new value for <see cref="Color"/>.</param> /// <returns>New instance of <see cref="DirectionalLight"/> with the provided value for <see cref="Color"/></returns> public DirectionalLight WithColor(NamedColor color) { if (!(color == _color)) { var result = (DirectionalLight)this.MemberwiseClone(); result._color = color; return result; } else { return this; } }
public Square(NamedColor fillColor, bool isFillColorInfluencedByPlotColor) : base(fillColor, isFillColorInfluencedByPlotColor) { }
/// <summary> /// Initializes a new instance of the <see cref="DirectionalLight"/> class. /// </summary> /// <param name="lightAmplitude">The light amplitude.</param> /// <param name="color">The color of light.</param> /// <param name="directionToLight">The direction from the scene to the light.</param> /// <param name="isAffixedToCamera">Value indicating whether the light source is affixed to the camera coordinate system or the world coordinate system.</param> public DirectionalLight(double lightAmplitude, NamedColor color, VectorD3D directionToLight, bool isAffixedToCamera) { _isAffixedToCamera = isAffixedToCamera; VerifyLightAmplitude(lightAmplitude, nameof(lightAmplitude)); _lightAmplitude = lightAmplitude; _color = color; var len = VerifyDirection(directionToLight, nameof(directionToLight)); _directionToLight = directionToLight / len; }
public LineShape(PointD2D startPosition, PointD2D endPosition, double lineWidth, NamedColor lineColor) : this(startPosition, null) { this._location.SizeX = RADouble.NewAbs(endPosition.X - startPosition.X); this._location.SizeY = RADouble.NewAbs(endPosition.Y - startPosition.Y); this.Pen.Width = (float)lineWidth; this.Pen.Color = lineColor; }
public LineShape(double startX, double startY, double endX, double endY, double lineWidth, NamedColor lineColor) : this(new PointD2D(startX, startY), new PointD2D(endX, endY), null) { this.Pen.Width = (float)lineWidth; this.Pen.Color = lineColor; }
public IMaterial WithColor(NamedColor color) { return this; }
private ColorSet(Altaxo.Serialization.Xml.IXmlDeserializationInfo info) { _name = info.GetString("Name"); int count = info.OpenArray("Colors"); _innerList = new NamedColor[count]; for (int i = 0; i < count; ++i) { string name = info.GetStringAttribute("Name"); string cvalue = info.GetString("e"); _innerList[i] = new NamedColor(AxoColor.FromInvariantString(cvalue), name, this); } info.CloseArray(count); InitLazyVariables(); }
public TextGraphic(PointD2D graphicPosition, string text, FontX textFont, NamedColor textColor) : base(new ItemLocationDirectAutoSize()) { this.SetPosition(graphicPosition, Main.EventFiring.Suppressed); this.Font = textFont; this.Text = text; this.Color = textColor; }
internal NamedColorValue(NamedColor color) { Color = color; }
public abstract Image GetImage(double maxEffectiveResolutionDpi, NamedColor foreColor, NamedColor backColor);
public abstract IMaterial WithColor(NamedColor color);