public GameObject BuildMainRoundButtonsMenu() { GameObject go = UIFactory.CreateMainRoundButtonsMenu(this.transform.gameObject, ColorProvider.Department.RESEARCHANDDEVELOPMENT, MainMenuButtonsCount, ButtonSize, ButtonHeight, ButtonSpacing, ToplineDisplayBezelHeight, BezelHeight, true); go.transform.Find("ToplineBezel").Find("ToplineDisplayBezel").GetComponent <RectTransform>().anchoredPosition = new Vector3( (this.transform.gameObject.GetComponent <RectTransform>().sizeDelta.x - (ButtonSpacing * (MainMenuButtonsCount - 1) + ButtonSize)) / 2, 0f, 0f); go.transform.GetComponent <Image>().color = ColorProvider.GetBezelColorFromHex(ColorProvider.COLORHEXCODE_PRIMARYBEZELS); go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[0].transform.GetComponent <RoundButtonController>().DepartmentColor = ColorProvider.Department.HUMANRESOURCES; go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[0].transform.GetComponent <RoundButtonController>().setFunctionSprite(SpritesPackage.Instance.getSpriteFor(SpritesPackage.Department.HUMANRESOURCES)); go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[1].transform.GetComponent <RoundButtonController>().DepartmentColor = ColorProvider.Department.ACCOUNTING; go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[1].transform.GetComponent <RoundButtonController>().setFunctionSprite(SpritesPackage.Instance.getSpriteFor(SpritesPackage.Department.ACCOUNTING)); go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[2].transform.GetComponent <RoundButtonController>().DepartmentColor = ColorProvider.Department.SALESANDMARKETING; go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[2].transform.GetComponent <RoundButtonController>().setFunctionSprite(SpritesPackage.Instance.getSpriteFor(SpritesPackage.Department.SALESANDMARKETING)); go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[3].transform.GetComponent <RoundButtonController>().DepartmentColor = ColorProvider.Department.INFORMATINOTECHNOLOGY; go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[3].transform.GetComponent <RoundButtonController>().setFunctionSprite(SpritesPackage.Instance.getSpriteFor(SpritesPackage.Department.INFORMATINOTECHNOLOGY)); go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[4].transform.GetComponent <RoundButtonController>().DepartmentColor = ColorProvider.Department.LOGISTICS; go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[4].transform.GetComponent <RoundButtonController>().setFunctionSprite(SpritesPackage.Instance.getSpriteFor(SpritesPackage.Department.LOGISTICS)); go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[5].transform.GetComponent <RoundButtonController>().DepartmentColor = ColorProvider.Department.PROCUREMENT; go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[5].transform.GetComponent <RoundButtonController>().setFunctionSprite(SpritesPackage.Instance.getSpriteFor(SpritesPackage.Department.PROCUREMENT)); go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[6].transform.GetComponent <RoundButtonController>().DepartmentColor = ColorProvider.Department.RESEARCHANDDEVELOPMENT; go.transform.GetComponent <RoundButtonsMainMenuController>().buttonsGameObjectList[6].transform.GetComponent <RoundButtonController>().setFunctionSprite(SpritesPackage.Instance.getSpriteFor(SpritesPackage.Department.RESEARCHANDDEVELOPMENT)); return(go); }
/// <summary> /// /// </summary> /// <returns></returns> public static GraphPaneConfig CreateNeedDistributeGraphPaneConfig() { ColorProvider cp = new ColorProvider(); GraphPaneConfig cfg = new GraphPaneConfig(); cfg.XAxisType = ZedGraph.AxisType.Text; cfg.XTitle = strings.WaterUserName; cfg.YTitle = strings.Amount; cfg.CurItemType = CurveItemType.Bar; SingleCurveConfig scc = new SingleCurveConfig(); scc.Name = strings.NeedAmount; scc.Color = cp.GetNextColor(); scc.XDataField = tblNeedDistribute.WaterUserName; scc.YDataField = tblNeedDistribute.NeedAmount; cfg.CurveConfigBaseCollection.Add(scc); scc = new SingleCurveConfig(); scc.Name = strings.DistributeAmount; scc.Color = cp.GetNextColor(); scc.XDataField = tblNeedDistribute.WaterUserName; scc.YDataField = tblNeedDistribute.DistributeAmount; cfg.CurveConfigBaseCollection.Add(scc); scc = new SingleCurveConfig(); scc.Name = strings.UsedAmount; scc.Color = cp.GetNextColor(); scc.XDataField = tblNeedDistribute.WaterUserName; scc.YDataField = tblNeedDistribute.UsedAmount; cfg.CurveConfigBaseCollection.Add(scc); return cfg; }
///// <summary> ///// ///// </summary> ///// <param name="cfg"></param> ///// <param name="p"></param> //private void CreateLineConfigPDuring(LineChartConfig cfg, object dataSource) //{ // DataTable tbl = dataSource as DataTable; // ColorProvider cp = new ColorProvider(); // for( int i=1; //} /// <summary> /// /// </summary> /// <param name="p"></param> /// <returns></returns> private void CreateLineConfig(LineChartConfig cfg, object datasource) { // tbl 表格样式 // ---------------------------------------------------------- // DT | st1 | st2 | st3 | st4 | ... // ---------------------------------------------------------- // 2011-1-1 12:00:00 | 12 | 23 | 17 | 5 | ... // 2011-1-1 12:00:00 | 12 | 23 | 17 | 5 | ... // 2011-1-1 12:00:00 | 12 | 23 | 17 | 5 | ... // ... // // st - 站名称 // DataTable tbl = datasource as DataTable; ColorProvider cp = new ColorProvider(); // create line data configs // 生成除第一列(时间列)意外的所有列的曲线配置 // for (int i = 1; i < tbl.Columns.Count; i++) { DataColumn col = tbl.Columns[i]; string name = col.ColumnName; LineDataConfig ldcfg = new LineDataConfig(name, name, cp.GetNextColorString()); cfg.LineDataConfigCollection.Add(ldcfg); } }
public Bitmap GetGraphic(int pixelsPerModule, ColorProvider provider, bool drawQuietZones = true, bool drawThinLines = false, bool drawDirections = false) { var size = (this.QrCodeData.ModuleMatrix.Count - (drawQuietZones ? 0 : 8)) * pixelsPerModule; var offset = drawQuietZones ? 0 : 4 * pixelsPerModule; var bmp = new Bitmap(size, size); using (var gfx = Graphics.FromImage(bmp)) { for (var x = 0; x < size + offset; x = x + pixelsPerModule) { for (var y = 0; y < size + offset; y = y + pixelsPerModule) { var module = this.QrCodeData.ModuleMatrix[(y + pixelsPerModule) / pixelsPerModule - 1][(x + pixelsPerModule) / pixelsPerModule - 1]; SourceType stype = (SourceType)this.QrCodeData.SourceMatrix[(y + pixelsPerModule) / pixelsPerModule - 1].GetValue((x + pixelsPerModule) / pixelsPerModule - 1); var brush = provider.getBrush(stype, module); gfx.FillRectangle(brush, new Rectangle(x - offset, y - offset, pixelsPerModule, pixelsPerModule)); } } if (drawThinLines) { for (var x = 0; x < size + offset; x = x + pixelsPerModule) { for (var y = 0; y < size + offset; y = y + pixelsPerModule) { gfx.DrawLine(Pens.LightGray, x, 0, x, size + offset); gfx.DrawLine(Pens.LightGray, 0, y, size + offset, y); } } gfx.DrawLine(Pens.LightGray, size - 1, 0, size - 1, size); gfx.DrawLine(Pens.LightGray, 0, size - 1, size, size - 1); } if (drawDirections) { for (int i = 1; i < this.QrCodeData.dataPoints.Count; i++) { var p1 = QrCodeData.dataPoints[i - 1]; var p2 = QrCodeData.dataPoints[i]; gfx.DrawLine(Pens.Black, p1.Item1 * pixelsPerModule + pixelsPerModule / 2, p1.Item2 * pixelsPerModule + pixelsPerModule / 2, p2.Item1 * pixelsPerModule + pixelsPerModule / 2, p2.Item2 * pixelsPerModule + pixelsPerModule / 2 ); gfx.FillRectangle(Brushes.Black, new Rectangle(p1.Item1 * pixelsPerModule + pixelsPerModule / 2 - 1, p1.Item2 * pixelsPerModule + pixelsPerModule / 2 - 1, 3, 3)); gfx.FillRectangle(Brushes.Black, new Rectangle(p2.Item1 * pixelsPerModule + pixelsPerModule / 2 - 1, p2.Item2 * pixelsPerModule + pixelsPerModule / 2 - 1, 3, 3)); } } gfx.Save(); } return(bmp); }
public static void GenerateTrackCode(GpxParser parser, HttpResponse response, bool addScriptTags) { if (addScriptTags) { response.Write("<script type=\"text/javascript\">\r\n"); } response.Write("function addTracks(){\r\n"); if (parser != null) { foreach (Track trk in parser.Tracks) { response.Write(string.Format(@" track = []; track['name'] = '{0}'; track['desc'] = '{1}'; track['clickable'] = true; track['width'] = 3; track['opacity'] = 0.9; track['outline_color'] = '#000000'; track['outline_width'] = 0; track['fill_color'] = '#E60000'; track['fill_opacity'] = 0; trkSeg = []; ", trk.Name, trk.Description)); foreach (TrackSegment seg in trk.Segments) { TrackPoint[] reducedPoints = seg.ReducedPoints; for (int i = 0; i < reducedPoints.Length - 1; i++) { TrackPoint p1 = reducedPoints[i]; TrackPoint p2 = reducedPoints[i + 1]; string color = ColorProvider.GetColorString(p1.ele, parser.MinElevation, parser.MaxElevation); //devo usare InvariantCulture per avere il punto come separatore dei decimali response.Write(string.Format( "trkSeg.push({{ color:'{0}', 'p1': {{ 'lat':{1}, 'lon': {2} }}, 'p2': {{ 'lat':{3}, 'lon': {4} }} }});\r\n", color, p1.lat.ToString(System.Globalization.CultureInfo.InvariantCulture), p1.lon.ToString(System.Globalization.CultureInfo.InvariantCulture), p2.lat.ToString(System.Globalization.CultureInfo.InvariantCulture), p2.lon.ToString(System.Globalization.CultureInfo.InvariantCulture) )); } } response.Write("GV_Draw_Track(trkSeg);"); } } response.Write("}\r\n"); if (addScriptTags) { response.Write("</script>\r\n"); } }
/// <summary> /// Initializes a new instance of the <see cref="Palet" /> class. /// </summary> /// <param name="colorProvider">The color provider.</param> /// <param name="buttonHeight">The button height</param> /// <param name="panel">The panel.</param> public Palet(ColorProvider colorProvider, int buttonHeight, Panel panel) : base() { this.colorProvider = colorProvider; this.buttonHeight = buttonHeight; this.panel = panel; this.DrawButtons(); }
protected override void adjustDepartmentColor() { base.adjustDepartmentColor(); faceTransform.GetComponent <Image>().color = faceColor; functionTransform.GetComponent <Image>().color = functionColor; shadowTransform.GetComponent <Image>().color = shadowColor; infoBoxTransform.GetComponent <Image>().color = ColorProvider.GetBezelColorFromHex(ColorProvider.COLORHEXCODE_PRIMARYBEZELS); }
public void Map_ShouldContain_AllowedValuesOnly() { var allowedColors = new ColorProvider().GetColors(); var usedColors = MigratedColorCode.Map.Values.Select(v => v); usedColors.Should().BeSubsetOf(allowedColors); }
public VertexColorResult ConvertToColor(ColorProvider colorProvider) { var result = new VertexColorResult(); result.Displacement = this.Displacement; result.Position = this.Position; result.Color = colorProvider.GetColor(this.Stress); return(result); }
public MeshColorResult ConvertToColor(ColorProvider colorProvider) { var result = new MeshColorResult(); result.BarId = this.BarId; result.MeshId = this.MeshId; result.VertexResults = this.VertexResults.Select(f => f.ConvertToColor(colorProvider)); return(result); }
public void Awake() { renderer = GetComponent <Renderer>(); provider = GetComponent <ColorProvider>(); button = GetComponent <Button>(); if (button != null) { buttonColorBlock = button.colors; } }
public SecureCoreProfileFormViewModel( Common.Configuration.Config appConfig, ColorProvider colorProvider, IUserStorage userStorage, ServerManager serverManager, ProfileManager profileManager, IModals modals, IDialogs dialogs) : base(appConfig, colorProvider, userStorage, profileManager, dialogs, modals, serverManager) { }
/// <summary> /// Initializes reference to the main view and sets random color. /// </summary> protected Shape(Position position) { Position = position; ListOfParts = new List <Block>(); Color = ColorProvider.GetRandomBrush(); CreateParts(Color); ComposedShape = new Block[4, 4]; }
void OnValidate() { if (toggleTemplate == null) { toggleTemplate = GetComponentInChildren <Toggle>(); } if (colorProvider == null) { colorProvider = GetComponentInParent <ColorProvider>(); } }
public void Move() { if (Left == 0) { return; } IsActive = true; Top = MoveTop(); Brush = new SolidColorBrush(ColorProvider.GetRandomColor()); }
protected BaseCountryServerProfileFormViewModel( Common.Configuration.Config appConfig, ColorProvider colorProvider, IUserStorage userStorage, ProfileManager profileManager, IDialogs dialogs, IModals modals, ServerManager serverManager) : base(appConfig, colorProvider, userStorage, profileManager, dialogs, modals, serverManager) { _modals = modals; }
private void Initialize(TimelineController timeline) { layers = new List <LayerController>(); this.timeline = timeline; toggleLock = false; toggleVisibility = true; rectangleProvider = timeline.RectangleProvider; rectangleProvider.Paint += TimelineContent_Paint; rectangleProvider.Resize += TimelineContent_Resize; timeline.TimelineZoomChanged += Timeline_TimelineZoomChanged; timeline.TimelineLengthChanged += Timeline_TimelineLengthChanged; timeline.LocationChanged += Timeline_LocationChanged; BackColor = ColorProvider.GetRandomSliceColor(); SetId(); CreateLayer(); lockButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin, padding + ButtonController.margin)); lockButton.ButtonClicked += LockButton_ButtonClicked; lockButton.Icon = Properties.Resources.open_lock; visibilityButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin * 3 + ButtonController.width, padding + ButtonController.margin)); visibilityButton.ButtonClicked += VisibilityButton_ButtonClicked; visibilityButton.Icon = Properties.Resources.open_eye; addSliceButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin, padding + ButtonController.margin * 3 + ButtonController.height)); addSliceButton.ButtonClicked += AddSliceButton_ButtonClicked; addSliceButton.Icon = Properties.Resources.plus; removeSliceButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin * 3 + ButtonController.width, padding + ButtonController.margin * 3 + ButtonController.height)); removeSliceButton.ButtonClicked += RemoveSliceButton_ButtonClicked; removeSliceButton.Icon = Properties.Resources.minus; UpdateCache(); UpdateUI(); }
public void DrawCloud(List <WordWithFont> words, string targetPath, string imageName) { using var bitmap = new Bitmap(ImageSize, ImageSize); using var graphics = Graphics.FromImage(bitmap); var layout = MakeLayout(words, graphics); graphics.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 0, ImageSize, ImageSize)); for (var i = 0; i < words.Count; i++) { graphics.DrawString(words[i].Word, words[i].Font, new SolidBrush(ColorProvider.GetNextColor()), layout[i].Location); } ImageSaver.Save(targetPath, imageName, bitmap); }
public ConfigurationFormData(IList <EntryConfiguration> entries, ColorProvider colorProvider, PwDatabase db) { Entries = entries; EntryBindingSource = new BindingSource { DataSource = Entries }; m_colors = null; m_colorProvider = colorProvider; m_db = db; DefaultUseKpgs3ClientId = SyncConfiguration.IsEmpty( PluginConfig.Default.PersonalClientId, PluginConfig.Default.PersonalClientSecret); m_config = PluginConfig.GetCopyOfDefault(); }
private void Initialize(SliceController slice) { this.slice = slice; toggleLock = false; toggleVisibility = true; rectangleProvider = slice.RectangleProvider; rectangleProvider.Paint += TimelineContent_Paint; rectangleProvider.Resize += TimelineContent_Resize; AddSliceEvents(); BackColor = ColorProvider.GetRandomLayerColor(); SetId(); items = new List <ItemController>(); lockButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin, ButtonController.margin)); lockButton.ButtonClicked += LockButton_ButtonClicked; lockButton.Icon = Properties.Resources.open_lock; visibilityButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin * 3 + ButtonController.width, ButtonController.margin)); visibilityButton.ButtonClicked += VisibilityButton_ButtonClicked; visibilityButton.Icon = Properties.Resources.open_eye; addLayerButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin, ButtonController.margin * 3 + ButtonController.height)); addLayerButton.ButtonClicked += AddLayerButton_ButtonClicked; addLayerButton.Icon = Properties.Resources.plus; removeLayerButton = new ButtonController(this, new Point( 5 + dragWidth + ButtonController.margin * 3 + ButtonController.width, ButtonController.margin * 3 + ButtonController.height)); removeLayerButton.ButtonClicked += RemoveLayerButton_ButtonClicked; removeLayerButton.Icon = Properties.Resources.minus; UpdateUI(); }
private void Leer(Bitmap bit, out int pixelAzul, out int pixelRojo) { BitmapData data = bit.LockBits(new Rectangle(0, 0, bit.Width, bit.Height), ImageLockMode.ReadOnly, bit.PixelFormat); IntPtr ptr = data.Scan0; int length = data.Stride * bit.Height; //Cantidad de bytes var pixelSize = data.PixelFormat == PixelFormat.Format32bppArgb ? 4 : 3; // only works with 32 or 24 pixel-size bitmap! var padding = data.Stride - (data.Width * pixelSize); byte[] rgbValues = new byte[length]; // Array del tamaño del bitmap // Copy the RGB values into the array. Marshal.Copy(ptr, rgbValues, 0, length); pixelRojo = 0; pixelAzul = 0; var index = 0; for (var y = 0; y < data.Height; y++) { for (var x = 0; x < data.Width; x++) { var r = rgbValues[index + 2]; var g = (rgbValues[index + 1]); var b = (rgbValues[index]); if (r == ColorProvider.RojoVida().R&& g == ColorProvider.RojoVida().G&& b == ColorProvider.RojoVida().B) { pixelRojo++; } if (r == ColorProvider.AzulMana().R&& g == ColorProvider.AzulMana().G&& b == ColorProvider.AzulMana().B) { pixelAzul++; } index += pixelSize; } index += padding; } bit.UnlockBits(data); }
private bool Leer(Bitmap bit) { BitmapData data = bit.LockBits(new Rectangle(0, 0, bit.Width, bit.Height), ImageLockMode.ReadOnly, bit.PixelFormat); IntPtr ptr = data.Scan0; int length = data.Stride * bit.Height; //Cantidad de bytes var pixelSize = data.PixelFormat == PixelFormat.Format32bppArgb ? 4 : 3; // only works with 32 or 24 pixel-size bitmap! var padding = data.Stride - (data.Width * pixelSize); byte[] rgbValues = new byte[length]; // Array del tamaño del bitmap // Copy the RGB values into the array. Marshal.Copy(ptr, rgbValues, 0, length); var index = 0; for (var y = 0; y < data.Height; y++) { for (var x = 0; x < data.Width; x++) { var r = rgbValues[index + 2]; var g = (rgbValues[index + 1]); var b = (rgbValues[index]); var color = Color.FromArgb(r, g, b); if (color == ColorProvider.AzulNormal() || color == ColorProvider.VerdeFacil() || color == ColorProvider.VerdeMuyFacil() ) { bit.UnlockBits(data); return true; } index += pixelSize; } index += padding; } bit.UnlockBits(data); return false; }
public void GenerateLegendItems() { if (parser == null) { return; } int nItems = 4; double step = (parser.MaxElevation - parser.MinElevation) / nItems; for (int i = 0; i <= nItems; i++) { double ele = parser.MinElevation + step * i; Response.Write(" <div class=\"gv_legend_item\" style=\"text-align:right; padding-right:5px\">\r\n"); Response.Write(string.Format("<span style=\"color: {0}\">{1}</span>\r\n</div>\r\n", ColorProvider.GetColorString(ele, parser.MinElevation, parser.MaxElevation), Convert.ToInt32(ele))); } }
protected AbstractForm( Common.Configuration.Config appConfig, ColorProvider colorProvider, IUserStorage userStorage, ProfileManager profileManager, IDialogs dialogs, IModals modals, ServerManager serverManager) { _appConfig = appConfig; _profileManager = profileManager; UserStorage = userStorage; _colorProvider = colorProvider; _dialogs = dialogs; _modals = modals; ServerManager = serverManager; SelectColorCommand = new RelayCommand <string>(SelectColorAction); }
private void Initialize(Timeline timeline) { this.timeline = timeline; controlsPanel = timeline.ControlsPanel; contentsPanel = timeline.ContentsPanel; Color color = ColorProvider.GetRandomSliceColor(); control = new SliceControl(); control.BackColor = color; controlsPanel.Controls.Add(control); control.AddClicked += Control_AddClicked; content = new SliceContent(); control.BackColor = color; contentsPanel.Controls.Add(content); SetId(); }
private void BindMethodBlocks(IEnumerable <MethodBlock> blocks) { lbBlocks.BeginUpdate(); lbBlocks.Clear(); if (lbBlocks.Columns.Count < 4) { lbBlocks.Columns.Add("Block", 100, HorizontalAlignment.Right); lbBlocks.Columns.Add("Block Length", 100, HorizontalAlignment.Right); lbBlocks.Columns.Add("Visit Count", 100, HorizontalAlignment.Right); lbBlocks.Columns.Add("Have Source", 100, HorizontalAlignment.Right); } foreach (var ib in blocks) { var itemColor = ColorProvider.GetForeColorForBlock(ReportHelper.GetBlockCoverage(ib)); var lvi = new ListViewItem { ForeColor = itemColor, Text = ("Block " + ib.Offset) }; lvi.SubItems.Add(ib.Length.ToString()); lvi.SubItems.Add(ib.VisitCount.ToString()); lvi.SubItems.Add(ib.File > 0 ? "yes" : "no"); lbBlocks.Items.Add(lvi); } BuildSourceViews(); lbBlocks.EndUpdate(); Invalidate(); if (lbBlocks.Items.Count > 0) { lbBlocks.Items[0].Selected = true; } }
/// <summary> /// /// </summary> /// <returns></returns> private Xdgk.UI.Z.GraphPaneConfig GetGraphPaneConfig(DataTable tbl) { ColorProvider cp = new ColorProvider(); GraphPaneConfig cfg = new GraphPaneConfig(); cfg.Title = "历年用水量曲线"; cfg.XTitle = strings.DT; cfg.YTitle = strings.Amount + "(m3)"; cfg.XAxisType = ZedGraph.AxisType.Text; for (int i = 1; i < tbl.Columns.Count; i++) { SingleCurveConfig scc = new SingleCurveConfig(); scc.Name = tbl.Columns[i].ColumnName; scc.Color = cp.GetNextColor(); scc.XDataField = "年份"; scc.YDataField = tbl.Columns[i].ColumnName; cfg.CurveConfigBaseCollection.Add(scc); } return cfg; }
public void SaveTo(IConfig config) { config.Visual.UseDarkTheme = UseDarkTheme; config.Visual.AccentColor = SelectedAccentColor.Name; config.Visual.PrimaryColor = SelectedPrimaryColor.Name; config.Visual.FontSize = SelectedFontSize.Size; config.Visual.HashtagColor = SelectedHashtagColor.Name; config.Visual.LinkColor = SelectedLinkColor.Name; config.Visual.MentionColor = SelectedMentionColor.Name; config.Visual.InlineMedia = InlineMedias; ColorProvider.SetHashtagColor(config.Visual.HashtagColor); ColorProvider.SetLinkColor(config.Visual.LinkColor); ColorProvider.SetMentionColor(config.Visual.MentionColor); ColorProvider.SetFontSize(config.Visual.FontSize); ColorProvider.SetDarkTheme(config.Visual.UseDarkTheme); ColorProvider.SetAccentColor(config.Visual.AccentColor); ColorProvider.SetPrimaryColor(config.Visual.PrimaryColor); }
public void Return_Neutral_ColorsModel_When_GetNeutralColor_Is_Called() { // Arrange var mockedColorRepository = new Mock <IColorRepository>(); mockedColorRepository .Setup(x => x.GetColors()).Returns(new Color[] { Color.YELLOW }); var mockedRandomGenerator = new Mock <IRandomGenerator>(); mockedRandomGenerator .Setup(x => x.GetRandomInt(It.IsAny <int>(), It.IsAny <int>())) .Returns(0); var provider = new ColorProvider(mockedColorRepository.Object, mockedRandomGenerator.Object); // Act var actual = provider.GetNeutralColor(); // Assert Assert.Equal("#000000", actual.ColorAsHex); Assert.Equal(Color.YELLOW, actual.ColorAsWord); }
private static Point?RecorrerImagen(byte[] rgbValues, int height, int width, int deltaHeight, int pixelSize, int padding) { var index = 0; for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { var r = rgbValues[index + 2]; var g = rgbValues[index + 1]; var b = rgbValues[index]; var color = Color.FromArgb(r, g, b); if (ColorProvider.Piedra().Contains(color)) { return(new Point(x, y + deltaHeight)); } index += pixelSize; } index += padding; } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="PaletFactory" /> class. /// </summary> /// <param name="kernel">The kernel.</param> /// <param name="colorProvider">The color provider.</param> public PaletFactory(IKernel kernel, ColorProvider colorProvider) { this.Kernel = kernel; }
/// <summary> /// /// </summary> /// <returns></returns> private GraphPaneConfig GetGraphPaneConfig(DataTable tbl) { ColorProvider cp = new ColorProvider(); GraphPaneConfig cfg = new GraphPaneConfig(); cfg.Title = DataEnumClass.GetDataEnumString(this.DataEnum) + "曲线"; if (this.DataEnum == DataEnum.WL) { cfg.YTitle = strings.WLWithUnit; } if (this.DataEnum == DataEnum.Amount) { cfg.YTitle = strings.AmountWithUnit; } cfg.XTitle = "时间"; cfg.CurItemType = CurveItemType.Line; cfg.XAxisType = ZedGraph.AxisType.Date; for (int i = 1; i < tbl.Columns.Count; i++) { DataColumn col = tbl.Columns[i]; SingleCurveConfig item = new SingleCurveConfig(); item.Color = cp.GetNextColor(); item.Name = col.ColumnName; item.XDataField = "DT"; item.YDataField = col.ColumnName; cfg.CurveConfigBaseCollection.Add(item); } return cfg; }