private GMapOverlay paintTweets(Dictionary <string, State> states) { GMapOverlay tweets = new GMapOverlay("tweetPoints"); foreach (var state in states.Values) { if (state.Postcode == "UNKNOWN" || state.Tweets.Count == 0) { continue; } foreach (var tweet in state.Tweets) { if (!float.IsNaN(tweet.Weight)) { Bitmap tweetPoint = new Bitmap(6, 6); using (Graphics g = Graphics.FromImage(tweetPoint)) { Pen pen = new Pen(Color.Black, 2f); g.DrawEllipse(pen, 0, 0, 4.5f, 4.5f); g.FillEllipse(new SolidBrush(Coloring.SetColors(tweet.Weight)), 0, 0, 4.5f, 4.5f); } Coordinates c = tweet.Location; PointLatLng point = new PointLatLng(tweet.Location.Longtitude, tweet.Location.Latitude); GMapMarker GPoint = new GMarkerGoogle(point, tweetPoint); GPoint.ToolTip = new GMapRoundedToolTip(GPoint); GPoint.ToolTipText = tweet.Text; GPoint.IsHitTestVisible = true; GPoint.ToolTipMode = MarkerTooltipMode.Never; tweets.Markers.Add(GPoint); } } } return(tweets); }
/// <summary> /// Wird uisgfiärt wemmr aui Parametr hend. /// </summary> /// <remarks> /// Es cha si dass das meh as einisch uisgfiärt wird, wobih's DMD numä /// einisch ersteuht wird. /// </remarks> public void Init() { if (_isOpen) { return; } _gray2Colorizer = null; _gray4Colorizer = null; _coloring = null; SetupColorizer(); if (_config.VirtualDmd.Enabled) { if (_dmd == null) { Logger.Info("Opening virtual DMD..."); CreateVirtualDmd(); } else { _dmd.Dispatcher.Invoke(() => { SetupGraphs(); SetupVirtualDmd(); }); } } else { SetupGraphs(); } _isOpen = true; }
public GridData(GridData other, bool withValues = true) : base(other) { countX = other.countX; countY = other.countY; if (withValues) { if (other.values != null) { values = (float[])other.values.Clone(); } if (other.valuesMask != null) { valuesMask = (byte[])other.valuesMask.Clone(); } } units = other.units; categoryFilter.CopyFrom(other.categoryFilter); if (other.categories != null) { categories = (IntCategory[])other.categories.Clone(); } minValue = other.minValue; maxValue = other.maxValue; minFilter = other.minFilter; maxFilter = other.maxFilter; coloring = other.coloring; }
public override bool Write(GH_IWriter writer) { writer.SetString("Coloring", Coloring.ToString()); writer.SetString("Metric", Metric.ToString()); writer.SetString("Feature", Feature.ToString()); return(base.Write(writer)); }
private List <GMapPolygon> paintStates(Dictionary <string, State> states) { List <GMapPolygon> polys = new List <GMapPolygon>(); foreach (var item in states.Values) { foreach (var polygons in item.Polygons) { foreach (var polygon in polygons) { List <PointLatLng> points = new List <PointLatLng>(); foreach (var point in polygon) { PointLatLng pnt = new PointLatLng(point.Latitude, point.Longtitude); points.Add(pnt); } GMapPolygon plgn = new GMapPolygon(points, item.Postcode); if (!float.IsNaN(item.Weight)) { plgn.Fill = new SolidBrush(Coloring.SetColors(item.Weight)); } else { plgn.Fill = new SolidBrush(Color.Gray); } plgn.Stroke = new Pen(Color.Black, 0.005F); polys.Add(plgn); } } } return(polys); }
public Coloring(IEditorFormatMap map, string lineName, string toolTipName, double width, double opacity = 1.0) { var brush = Coloring.GetBrush(map, toolTipName, EditorFormatDefinition.ForegroundBrushId); if (brush != null) { brush = brush.Clone(); brush.Opacity = opacity; brush.Freeze(); } this.ToolTipBrush = brush; this.LineBrush = Coloring.GetBrush(map, lineName, EditorFormatDefinition.ForegroundBrushId); if (this.LineBrush != null) { this.LinePen = new Pen(this.LineBrush, width); this.LinePen.Freeze(); } else { this.LinePen = null; } if (this.ToolTipBrush != null) { this.ToolTipPen = new Pen(this.ToolTipBrush, width); this.ToolTipPen.Freeze(); } else { this.ToolTipPen = null; } }
public virtual void KillSelf() { if (Destroyed) { return; } var chunk = ChunkManager.GetChunkByNum(ChunkNumber); chunk.SetIndex(CurrentPos, -1); chunk.RemoveObject(CurrentPos); var ent = chunk.GetGameObjectByIndex(ChunkUtil.GetDovvner(CurrentPos)); if (ent != null) { Coloring.RecolorObject(ent.CurrentPos); } Destroy(gameObject); if (SecondaryGroundLvL.isSecondaryGroup(Group)) { SecondaryGroundLvL.RemovePos(ChunkNumber, CurrentPos); } Destroyed = true; }
public PointData(PointData other, bool withValues = true) : base(other) { count = other.count; if (withValues) { if (other.values != null) { values = (float[])other.values.Clone(); } } units = other.units; categoryFilter.CopyFrom(other.categoryFilter); if (other.categories != null) { categories = (IntCategory[])other.categories.Clone(); } minValue = other.minValue; maxValue = other.maxValue; minFilter = other.minFilter; maxFilter = other.maxFilter; coloring = other.coloring; }
/// <summary> /// Select the specified node. /// </summary> /// <param name="node">The node in the tree to select.</param> /// <remarks> /// If single-node selection is enabled then any previously selected node is /// deselected prior to selecting this node. /// <para> /// If multi-node selection is enabled then this node is added to the collection /// of selected nodes for this tree view. /// </para> /// </remarks> public void SelectNode(TreeNode node) { Coloring coloring = colorings.GetColoring(node); if (coloring == null) { colorings.Add(node); } else { coloring.ForeColor = node.ForeColor; coloring.BackColor = node.BackColor; } if (multiSelect) { if (!selectedNodes.Contains(node)) { selectedNodes.Add(node); } node.BackColor = FontsAndColors.SelectedTextBackground; node.ForeColor = SystemColors.HighlightText; this.Invalidate(node.Bounds); } else { this.SelectedNode = node; } }
public void UpdateContentHelp() { if (Text == "") { _NormalFont = Font; _ForeColor = ForeColor; _IsPwd = PasswordChar; PasswordChar = ((char)0x00); if (ContentFont == null) { _ContentHelpFont = new Font( _NormalFont.FontFamily, _NormalFont.Size, FontStyle.Italic, _NormalFont.Unit ); } else { _ContentHelpFont = new Font( ContentFont.FontFamily, ContentFont.Size, FontStyle.Italic, ContentFont.Unit ); } Font = _ContentHelpFont; base.Text = _ContentHelp; ForeColor = Coloring.MergeColors(_ForeColor, this.BackColor, 0.5); _ShowingContentHelp = true; } }
public Gray2Colorizer(Coloring coloring, AnimationSet animations) { _coloring = coloring; _animations = animations; Has128x32Animation = (_coloring.Masks != null && _coloring.Masks.Length >= 1 && _coloring.Masks[0].Length == 512); SetPalette(coloring.DefaultPalette, coloring.DefaultPaletteIndex, true); }
private void _listBox_SelectedItemChanged(object sender, ListBox.SelectedItemEventArgs e) { var baseItem = e.Item as BaseItem; _itemConsole.Clear(); _itemConsole.Print(1, 1, $"{Coloring.Orange(baseItem.Name)} [{Coloring.DarkGrey(baseItem.GetType().Name)}]"); _itemConsole.Print(1, 2, $"Weigth: {Coloring.Gainsboro(baseItem.Weight.ToString("######0.00").PadLeft(10))} lbs.", Color.Gainsboro); _itemConsole.Print(1, 3, $"Cost: {Coloring.Gold(baseItem.Cost.ToString("######0.00").PadLeft(10))} Gold", Color.Gainsboro); if (baseItem is Weapon weapon) { _itemConsole.Print(1, 5, $"{Coloring.DarkGrey("Damage:")} {Coloring.Green(weapon.MinDmg.ToString())} - {Coloring.Green(weapon.MaxDmg.ToString())}", Color.Gainsboro); _itemConsole.Print(1, 6, $"{Coloring.DarkGrey("Critical:")} {Coloring.Yellow(weapon.CriticalMinRoll)} / {Coloring.Yellow(weapon.CriticalMultiplier)}x ", Color.Gainsboro); _itemConsole.Print(1, 7, $"{Coloring.DarkGrey("Range:")} {weapon.Range}", Color.Gainsboro); _itemConsole.Print(1, 8, $"{Coloring.DarkGrey("Damage:")} {string.Join(",",weapon.WeaponDamageTypes)}", Color.Gainsboro); _itemConsole.Print(1, 9, $"{Coloring.DarkGrey("Effort:")} {weapon.WeaponEffortType}", Color.Gainsboro); } else if (baseItem is Armor armor) { _itemConsole.Print(1, 5, $"{Coloring.DarkGrey("Armor:")} {Coloring.Green(armor.ArmorBonus.ToString())}", Color.Gainsboro); _itemConsole.Print(1, 6, $"{Coloring.DarkGrey("Penaltiy:")} {Coloring.Red(armor.ArmorCheckPenalty.ToString())}", Color.Gainsboro); _itemConsole.Print(1, 7, $"{Coloring.DarkGrey("Max Dex:")} {armor.MaxDexterityBonus}", Color.Gainsboro); _itemConsole.Print(1, 8, $"{Coloring.DarkGrey("Spellf.:")} {armor.ArcaneSpellFailureChance}", Color.Gainsboro); _itemConsole.Print(1, 9, $"{Coloring.DarkGrey("Effort:")} {armor.ArmorEffortType}", Color.Gainsboro); } //_itemConsole.Print(1, 15, $"{baseItem.Description}", Color.Gainsboro); }
public Gray4Colorizer(Coloring coloring, AnimationSet animations) { _coloring = coloring; _animations = animations; SetPalette(coloring.DefaultPalette, coloring.DefaultPaletteIndex, true); }
private void ColorWithArray(Coloring coloring) { var options = coloring.MatchCase ? RichTextBoxFinds.MatchCase : RichTextBoxFinds.None; if (coloring.Keywords != null) { foreach (var keyword in coloring.Keywords) { int start = -1; while ((start = Find(keyword, start + 1, options)) != -1) { if ((start == 0 || start > 0 && !char.IsLetterOrDigit(Text[start - 1])) && (Text.Length == start + keyword.Length || Text.Length > start + keyword.Length && !char.IsLetterOrDigit(Text[start + keyword.Length]))) { Coloring(start, keyword.Length, coloring.Font, coloring.Color); if (coloring.SecondaryColor != Color.Transparent) { int num = Text.IndexOf(LineFeedString, start + keyword.Length); if (num > -1) { Select(start + keyword.Length, num - start - keyword.Length); } else { Select(start + keyword.Length, Text.Length - start - keyword.Length); } SelectionFont = coloring.Font; SelectionColor = coloring.SecondaryColor; } } } } } }
public void ChangeSpeaker(string _speaker, string _color) { Coloring coloring = GetComponent <Coloring>(); speaker_label.GetComponent <Text>().text = _speaker; speaker_label.GetComponent <Text>().color = coloring.SelectColor(_color); }
public static void OnFogChange() { if (!ChunkManager.staticFogEnabled || ChunkManager.CurrentChunk == null) { return; } var ents = ChunkManager.CurrentChunk.Ground; for (int x = 0; x < ents[0].Length; x++) { for (int y = 0; y < ents[0][0].Length; y++) { var ent = ents[0][x][y]; var item = SecondaryGroundLvL.GetGroundEnt(ChunkManager.CurrentChunk.ChunkNumber, new Vector3Int(x, y, 1)); if (item != null) { Coloring.RecolorObject(item, true); Coloring.RecolorObject(new Vector3Int(x, y, 0), true); } else if (ent != null) { OnGroundEntity(ent); } } } }
public bool CheckMate(Coloring coloring) { if (!InCheck(coloring)) { return(false); } foreach (ChessPiece chessPiece in PieceInGameByTeam(coloring)) { bool[,] mat = chessPiece.PieceMoveSet(); for (int i = 0; i < ChessBoard.Ranks; i++) { for (int j = 0; j < ChessBoard.Files; j++) { if (mat[i, j]) { Coordinate moveFrom = chessPiece.Coordinate; Coordinate moveTo = new Coordinate(i, j); ChessPiece pieceCaptured = Movement(moveFrom, moveTo); bool inCheck = InCheck(coloring); UndoMovement(moveFrom, moveTo, pieceCaptured); if (!inCheck) { return(false); } } } } } return(true); }
public ChessPiece(ChessBoard chessBoard, Coloring coloring) { Coordinate = null; Coloring = coloring; MovementQuantity = 0; ChessBoard = chessBoard; }
protected AbstractColorizer(Coloring coloring, Animation[] animations) { Coloring = coloring; Animations = animations; SetPalette(Coloring.DefaultPalette, true); Logger.Debug("[colorize] Initialized."); }
public BlockColoring(double width, Color classColor, Color conditionalColor, Color loopColor, Color methodColor, Color unknownColor) { this.classColoring = new Coloring(classColor, width); this.conditionalColoring = new Coloring(conditionalColor, width); this.loopColoring = new Coloring(loopColor, width); this.methodColoring = new Coloring(methodColor, width); this.unknownColoring = new Coloring(unknownColor, width); }
private void button3_Click(object sender, EventArgs e) { Coloring coloring = new Coloring(); map = coloring.ColorB(map); DisplacementMap.Image = map; }
// koloruje graf algorytmem z powrotami (optymalnie) public static int BacktrackingColor(this IGraph g, out int[] colors) { var gc = new Coloring(g); gc.Color(0, new int[g.VerticesCount], 0); colors = gc.bestColors; return(gc.bestColorsNumber); }
public BlockColoring(double width, Color classColor, Color conditionalColor, Color loopColor, Color methodColor, Color unknownColor) { this.classColoring = new Coloring(classColor, width); this.conditionalColoring = new Coloring(conditionalColor, width); this.loopColoring = new Coloring(loopColor, width); this.methodColoring = new Coloring(methodColor, width); this.unknownColoring = new Coloring(unknownColor, width); }
private List <PixelYUV> GenerateYUVCRDataForColorImage(Bitmap bmp) { List <PixelYUV> imageData = new List <PixelYUV>(); CImage colorCImg = new CImage(bmp); Bitmap greyBMP = Coloring.ConvertToGrayscale(bmp); //greyBMP.Save(@"C:\Temp\SamplesImages\color\v3\ColoredConvertedToGrey.jpg"); CImage greyCImg = new CImage(greyBMP); greyBMP.Dispose(); // Populate LumGrid double[][] lumGrid = new double[greyCImg.Height][]; for (int y = 0; y < bmp.Height; y++) { lumGrid[y] = new double[greyCImg.Width]; for (int x = 0; x < bmp.Width; x++) { int i = (x + (bmp.Width * y)); lumGrid[y][x] = Utilities.CalcLuminance( greyCImg.Grid[3 * i + 2], // R greyCImg.Grid[3 * i + 1], // G greyCImg.Grid[3 * i + 0] // B ); } } // Populate imageData for (int y2 = 0; y2 < bmp.Height; y2++) { for (int x2 = 0; x2 < bmp.Width; x2++) { // get neighbours double[] neighbours = Utilities.GetCardinalNeighbours(ref lumGrid, x2, y2); double mean = Utilities.GetMeanOfNeighbours(neighbours); int i2 = (x2 + (bmp.Width * y2)); var yuvRow = new PixelYUV() { Y = lumGrid[y2][x2], NeighbourMeanLuminance = mean, NeighbourLuminanceStandardDeviation = Utilities.GetStandardDeviationofNeighbours(neighbours, mean, false), }; var tempYUV = new RGB( colorCImg.Grid[3 * i2 + 2], colorCImg.Grid[3 * i2 + 1], colorCImg.Grid[3 * i2 + 0]).ToYUV(); yuvRow.U = (float)tempYUV.U; yuvRow.V = (float)tempYUV.V; imageData.Add(yuvRow); } } return(imageData); }
/// <inheritdoc /> public override void AddGold(int gold) { string msg = $"You just found +{Coloring.Gold(gold)} gold!"; History.Add(LogType.Info, msg); Adventure?.LogEntries.Enqueue(new LogEntry(LogType.Info, msg)); Wealth.Gold += gold; }
public void SetAltColorPath(string path) { try { Coloring = new Coloring($"{path}{Path.DirectorySeparatorChar}pin2dmd.pal"); } catch (Exception e) { } }
private ChessPiece King(Coloring coloring) { foreach (ChessPiece chessPiece in PieceInGameByTeam(coloring)) { if (chessPiece is King) { return(chessPiece); } } return(null); }
private Coloring Adversary(Coloring coloring) { if (coloring == Coloring.White) { return(Coloring.Black); } else { return(Coloring.White); } }
public GameItem SetupItem(GameEntity ent, string name, Vector3Int pos, Player owner) { var index = Loader.GetIndexByName(name); var npc = LuaNpcGetter.GetNpcById(index); ent.Owner = owner; ent.OriginalName = name; ent.name = name; var item = ent as GameItem; var evoTo = LuaNpcGetter.GetEvolutionTo(npc); if (evoTo.Length > 0) { if (!UnitEvolution.IsHasSoloEvolution(name)) { UnitEvolution.AddToSoloDict(name, evoTo); } if (item != null) { item.SoloEvolution = true; } } var evoCross = LuaNpcGetter.GetNpcEvoCrossing(npc); if (evoCross.Keys.Count > 0) { foreach (var pair in evoCross) { UnitEvolution.AddToStackDict(name, pair.Key, pair.Value); if (!string.Equals(pair.Key, name, StringComparison.OrdinalIgnoreCase)) { UnitEvolution.AddToStackDict(pair.Key, name, pair.Value); } } } if (GroupUtil.IsItem(ent.Group)) { SecondaryGroundLvL.SetGroundEnt(ChunkNumber, pos, item); } if (GroupUtil.isBuilding(ent.Group)) { ChunkManager.AddVision(ent); } ItemEvents.OnCreateItem(item, firstCreate); Coloring.RecolorObject(ChunkUtil.GetDovvner(ent.CurrentPos)); return(item); }
public static void Create(HoneycombDef def, string filename) { int p = def.P; int q = def.Q; int r = def.R; double scale = 5.0; Vector3D cen = HoneycombPaper.InteriorPointBall; Sphere[] simplex = SimplexCalcs.Mirrors(p, q, r, moveToBall: false); // Apply transformations. simplex = simplex.Select(s => { Sphere.ScaleSphere(s, scale); return(H3Models.UHSToBall(s)); }).ToArray(); for (int i = 0; i < 4; i++) { if (simplex[i].IsPointInside(cen)) { simplex[i].Invert = true; } } Sphere[] simplexForColorScale = SimplexCalcs.Mirrors(p, q, r, moveToBall: true); CoxeterImages.Settings temp = HoneycombPaper.AutoCalcScale(def, simplexForColorScale); int maxDepth = (int)temp.ColorScaling; bool ball = true; bool dual = false; H3.Cell[] simplicesFinal = HoneycombPaper.GenCell(simplex, null, cen, ball, dual); simplicesFinal = simplicesFinal.Where(s => s.Depths[0] < 1).ToArray(); //simplicesFinal = simplicesFinal.Where( s => s.) // Output the facets. using (StreamWriter sw = File.CreateText(filename)) // We need to reuse this StreamWriter (vs. calling AppendSimplex) for performance. { sw.WriteLine("#include \"hyper_ball.pov\""); int[] include = new int[] { 0 }; foreach (H3.Cell cell in simplicesFinal) { Sphere[] facets = cell.Facets.Select(f => f.Sphere).ToArray(); int depth = cell.Depths[0] + 1; Color c = Coloring.ColorAlongHexagon(maxDepth, depth); PovRay.AddSimplex(sw, facets, cell.Center, include, filename, Coloring.ToVec(c)); } } }
/// <inheritdoc /> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Start != null) { hashCode = hashCode * 59 + Start.GetHashCode(); } if (End != null) { hashCode = hashCode * 59 + End.GetHashCode(); } if (Size != null) { hashCode = hashCode * 59 + Size.GetHashCode(); } if (Coloring != null) { hashCode = hashCode * 59 + Coloring.GetHashCode(); } if (ShowLines != null) { hashCode = hashCode * 59 + ShowLines.GetHashCode(); } if (ShowLabels != null) { hashCode = hashCode * 59 + ShowLabels.GetHashCode(); } if (LabelFont != null) { hashCode = hashCode * 59 + LabelFont.GetHashCode(); } if (LabelFormat != null) { hashCode = hashCode * 59 + LabelFormat.GetHashCode(); } if (Operation != null) { hashCode = hashCode * 59 + Operation.GetHashCode(); } if (Value != null) { hashCode = hashCode * 59 + Value.GetHashCode(); } return(hashCode); } }
// koloruje graf algorytmem z powrotami (optymalnie) public static int BacktrackingColor(this IGraph g, out int[] colors) { if (g == null) { colors = null; return 0; } if (g.VerticesCount == 0) { colors = null; return 0; } if (g.VerticesCount == 1) { colors = new int[1]; colors[0] = 1; return 1; } var gc = new Coloring(g); int EdgesCountFull = -1; if (g.Directed) EdgesCountFull = g.VerticesCount * (g.VerticesCount - 1); else EdgesCountFull = g.VerticesCount * (g.VerticesCount - 1) / 2; if (g.EdgesCount == EdgesCountFull) { colors = new int[g.VerticesCount]; int n = g.VerticesCount; for (int i = 1; i <= g.VerticesCount; i++) colors[i-1] = i; return n; } gc.Color(0, new int[g.VerticesCount], 0); colors = gc.bestColors; /* if (Test(g, colors)) Console.WriteLine("Check POSITIVE"); else Console.WriteLine("Check NEGATIVE"); */ return gc.bestColorsNumber; }
private void OnFormatMappingChanged(object sender, FormatItemsEventArgs e) { this.ClassColoring = new Coloring(_formatMap, BlockStructureClassColorFormat.Name, BlockStructureToolTipClassColorFormat.Name, _width); this.ConditionalColoring = new Coloring(_formatMap, BlockStructureConditionalColorFormat.Name, BlockStructureToolTipConditionalColorFormat.Name, _width); this.LoopColoring = new Coloring(_formatMap, BlockStructureLoopColorFormat.Name, BlockStructureToolTipLoopColorFormat.Name, _width); this.MethodColoring = new Coloring(_formatMap, BlockStructureMethodColorFormat.Name, BlockStructureToolTipMethodColorFormat.Name, _width); this.MethodSeparatorAndHighlightColoring = new Coloring(_formatMap, MethodSeparatorColorFormat.Name, ScrollBarMethodHighlightColorFormat.Name, _width, 0.25); this.UnknownColoring = new Coloring(_formatMap, BlockStructureUnknownColorFormat.Name, BlockStructureToolTipUnknownColorFormat.Name, _width); EventHandler changed = this.Changed; if (changed != null) { changed(this, new EventArgs()); } }