public ColorSetEdit(ColorSet set, bool nameEditable) { if (set == null) { set = new ColorSet(); } ColorSet = set; InitializeComponent(); textBoxName.Text = set.Name; textBoxName.ReadOnly = !nameEditable; textBoxBackColor.Text = set.BackColorName; textBoxForeColor.Text = set.ForeColorName; switch (set.Mode) { case ColorSetDrawMode.Frame: radioButtonFrame.Checked = true; break; //case ColorSetDrawMode.Fill: default: radioButtonFill.Checked = true; break; } textBoxFont.Text = set.FontName; numericUpDownFrameWidth.Value = (int)set.FrameWidth; UpdateControls(); }
private static ListViewItem GetColorSetItem(ColorSet set) { ListViewItem item = new ListViewItem(set.Name); item.SubItems.Add(set.ForeColorName); item.SubItems.Add(set.BackColorName); item.SubItems.Add(set.Mode.ToString()); item.SubItems.Add(set.FrameWidth.ToString()); item.Tag = set; return item; }
static void TestTexGen() { TexGen generator; ColorSet colors; Texture image; bool grayscale = true; image = ImageBMP.OpenBitmap("medium_gray_stone.bmp", 0); colors = new ColorSet(); colors.TrainFromTexture(image, 0, grayscale); generator = new TexGen(colors, 2, 2); generator.AddTexture(image, grayscale); // generator.TrainFromTexture(image, 16, 16, grayscale); Texture output = generator.GenerateTexture(200, 200, 1); ImageBMP.WriteBitmap("output.bmp", output); }
private void buttonAddColorSet_Click(object sender, EventArgs e) { using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) { if (textDialog.ShowDialog() == DialogResult.OK) { string newName = textDialog.Response; if (_data.ContainsColorSet(newName)) { MessageBox.Show("Color Set already exists."); return; } ColorSet newcs = new ColorSet(); _data.SetColorSet(newName, newcs); UpdateGroupBoxWithColorSet(newName, newcs); UpdateColorSetsList(); } } }
private void buttonAddColorSet_Click(object sender, EventArgs e) { using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) { if (textDialog.ShowDialog() == DialogResult.OK) { string newName = textDialog.Response; if (_data.ContainsColorSet(newName)) { //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible) MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form. var messageBox = new MessageBoxForm("Color Set already exists.", "Error", false, false); messageBox.ShowDialog(); return; } ColorSet newcs = new ColorSet(); _data.SetColorSet(newName, newcs); UpdateGroupBoxWithColorSet(newName, newcs); UpdateColorSetsList(); } } }
private void UpdateGroupBoxWithColorSet(string name, ColorSet cs) { if (cs == null) { panelColorSet.Enabled = false; label2.ForeColor = ThemeColorTable.ForeColorDisabled; label3.ForeColor = ThemeColorTable.ForeColorDisabled; textBoxName.Text = string.Empty; tableLayoutPanelColors.Controls.Clear(); return; } panelColorSet.Enabled = true; label2.ForeColor = ThemeColorTable.ForeColor; label3.ForeColor = ThemeColorTable.ForeColor; textBoxName.Text = name; tableLayoutPanelColors.Controls.Clear(); foreach (System.Drawing.Color color in cs) { ColorPanel colorPanel = new ColorPanel(color); tableLayoutPanelColors.Controls.Add(colorPanel); } }
private bool SaveDisplayedColorSet() { string name = textBoxName.Text; ColorSet newColorSet = new ColorSet(); if (name.Length <= 0) { MessageBox.Show("You must enter a name for the Color Set.", "Name Requred", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } foreach (var control in tableLayoutPanelColors.Controls) { ColorPanel cp = (ColorPanel)control; newColorSet.Add(cp.Color); } _data.SetColorSet(textBoxName.Text, newColorSet); return true; }
public ColouredPlace(PetriNetGraph graph, string name, ColorSet color) : this(graph, name, color.Name) { }
private static List <ColorSet <T> > GetColorSets <T>(IEnumerable <IColorCategory> categories) where T : struct, IComparable <T> { var result = new List <ColorSet <T> >(); foreach (var c in categories) { var cs = new ColorSet <T>(); Color high = c.HighColor; Color low = c.LowColor; cs.Color = Argb.FromColor(low); if (high != low) { cs.GradientModel = c.GradientModel; cs.Gradient = true; cs.MinA = low.A; cs.MinR = low.R; cs.MinG = low.G; cs.MinB = low.B; cs.RangeA = high.A - cs.MinA; cs.RangeR = high.R - cs.MinR; cs.RangeG = high.G - cs.MinG; cs.RangeB = high.B - cs.MinB; } cs.Max = Global.MaximumValue <T>(); var testMax = Convert.ToDouble(cs.Max); cs.Min = Global.MinimumValue <T>(); var testMin = Convert.ToDouble(cs.Min); if (c.Range.Maximum != null && c.Range.Maximum < testMax) { if (c.Range.Maximum < testMin) { cs.Max = cs.Min; } else { cs.Max = (T)Convert.ChangeType(c.Range.Maximum.Value, typeof(T)); } } if (c.Range.Minimum != null && c.Range.Minimum > testMin) { if (c.Range.Minimum > testMax) { cs.Min = Global.MaximumValue <T>(); } else { cs.Min = (T)Convert.ChangeType(c.Range.Minimum.Value, typeof(T)); } } cs.MinInclusive = c.Range.MinIsInclusive; cs.MaxInclusive = c.Range.MaxIsInclusive; result.Add(cs); } // The normal order uses "overwrite" behavior, so that each color is drawn // if it qualifies until all the ranges are tested, overwriting previous. // This can be mimicked by going through the sets in reverse and choosing // the first that qualifies. For lots of color ranges, opting out of // a large portion of the range testing should be faster. result.Reverse(); return(result); }
public override void ReloadColorSet(ColorSet ColorSet) { form.ForeColor = ColorSet.GetValue("fontColor"); form.BackColor = ColorSet.GetValue("bgColorLayer1"); }
public void IsSingle3() { ColorSet colorSet = new ColorSet(); Assert.True(!colorSet.IsSingle()); }
public static ColorBlock Fit(ColorSet colors, Options options, bool isBC1) { int count = colors.Count; Vector3[] points = colors.Points; double[] weights = colors.Weights; // compute the principle component Vector3 principle = ComputePrincipleComponent(count, points, weights); // get the min and max range as the codebook endpoints Vector3 start = new Vector3(); Vector3 end = new Vector3(); if (count > 0) { double min, max; // compute the range start = end = points[0]; min = max = Vector3.Dot(points[0], principle); for (int i = 1; i < count; ++i) { double val = Vector3.Dot(points[i], principle); if (val < min) { start = points[i]; min = val; } else if (val > max) { end = points[i]; max = val; } } } // clamp the output to [0, 1] start = Vector3.Clamp(start, 0.0, 1.0); end = Vector3.Clamp(end, 0.0, 1.0); // clamp to the grid and save Vector3 grid = new Vector3(31.0, 63.0, 31.0); Vector3 gridrcp = Vector3.Reciprocal(grid); Vector3 half = new Vector3(0.5); start = Truncate(grid * start + half) * gridrcp; end = Truncate(grid * end + half) * gridrcp; // create a codebook Vector3[] codes = new Vector3[4]; codes[0] = start; codes[1] = end; codes[2] = (2.0 / 3.0) * start + (1.0 / 3.0) * end; codes[3] = (1.0 / 3.0) * start + (2.0 / 3.0) * end; // match each point to the closest code int[] closest = new int[16]; double error = 0.0f; for (int i = 0; i < count; ++i) { // find the closest code double dist = double.MaxValue; int idx = 0; for (int j = 0; j < 4; ++j) { double d = (options.Metric * (points[i] - codes[j])).MagnitudeSquared; if (d < dist) { dist = d; idx = j; } } // save the index closest[i] = idx; // accumulate the error error += dist; } // remap the indices int[] indices = new int[16]; colors.RemapIndices(closest, indices); return(new ColorBlock(new Color(start.X, start.Y, start.Z), new Color(end.X, end.Y, end.Z), indices)); }
public void ReloadColorSet(ColorSet ColorSet) { Histogram.BackColor = ColorSet.GetValue("bgHistogram"); }
public static AnimationData GetColored(string id, ColorSet set) { if (set == null) { return(Get(id)); } var fullId = $"{id}_{set.Id}"; if (animations.TryGetValue(fullId, out var animation)) { return(animation); } animation = Get(id); if (animation == null) { return(null); } var data = new AnimationData(); var w = animation.Texture.Width; var h = animation.Texture.Height; var texture = new Texture2D(Engine.GraphicsDevice, w, h); var tdata = new Color[w * h]; animation.Texture.GetData(tdata); var pixelData = new Color[w * h]; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { var i = x + y * w; var color = tdata[i]; for (int c = 0; c < set.From.Length; c++) { if (ColorUtils.Compare(set.From[c], color, 4)) { color = set.To[c]; } } pixelData[i] = color; } } texture.SetData(pixelData); foreach (var l in animation.Layers) { var list = new List <AnimationFrame>(); foreach (var f in l.Value) { list.Add(new AnimationFrame { Texture = new TextureRegion(texture, f.Bounds), Duration = f.Duration, Bounds = f.Bounds }); } data.Layers[l.Key] = list; } foreach (var s in animation.Slices) { data.Slices[s.Key] = new TextureRegion(texture, s.Value.Source); } foreach (var t in animation.Tags) { data.Tags[t.Key] = t.Value; } data.Texture = texture; animations[fullId] = data; return(data); }
public PauseState(ColorSet set, float scale = 1.0f) : base(StateType.Pause, set, scale) { // Any special instructions for the pause menu should take place here. }
public void ReloadColorSet(ColorSet ColorSet) { mbText.ForeColor = ColorSet.GetValue("fontColor"); mainButton.BackColor = ColorSet.GetValue("bgColorLayer2"); closeButton.ForeColor = ColorSet.GetValue("fontColor"); }
public static ColorBlock Fit(ColorSet set, Options options) { throw new NotImplementedException(); }
/// <summary> /// This method return an array of colorWells that belong to the desired ColorSet and /// that have been sorted in the desired ColorSortOrder. /// </summary> /// <param name="colorSet">The color palette to be generated.</param> /// <param name="colorSortOrder">The order the generated palette should be sorted.</param> /// <returns></returns> public static ColorWellInfo[] GetColorWells(ColorSet colorSet, ColorSortOrder colorSortOrder) { // get array of desired colorWells and sort // Could have sort order enum/property Array knownColors = Enum.GetValues(typeof(System.Drawing.KnownColor)); int nColors = 0; // How many colors are there? switch (colorSet) { case ColorSet.Web: foreach (KnownColor k in knownColors) { Color c = Color.FromKnownColor(k); if (!c.IsSystemColor && (c.A > 0)) { nColors++; } } break; case ColorSet.System: foreach (KnownColor k in knownColors) { Color c = Color.FromKnownColor(k); if (c.IsSystemColor && (c.A > 0)) { nColors++; } } break; } ColorWellInfo[] colorWells = new ColorWellInfo[nColors]; int index = 0; // Get the colors switch (colorSet) { case ColorSet.Web: foreach (KnownColor k in knownColors) { Color c = Color.FromKnownColor(k); if (!c.IsSystemColor && (c.A > 0)) { colorWells[index] = new ColorWellInfo(c, index); index++; } } break; case ColorSet.System: foreach (KnownColor k in knownColors) { Color c = Color.FromKnownColor(k); if (c.IsSystemColor && (c.A > 0)) { colorWells[index] = new ColorWellInfo(c, index); index++; } } break; } SortColorWells(colorWells, colorSortOrder); return(colorWells); }
public static void WriteToConsole(string stringToWrite, ColorSet colorSet) { Console.ForegroundColor = colorSet.ForegroundColor; Console.BackgroundColor = colorSet.BackgroundColor; Console.WriteLine(stringToWrite); }
public void SetColorSet(string name, ColorSet value) { ColorSets[name] = value; ColorSetChanged(this, new StringEventArgs(name)); }
void chart_Loaded(object sender, RoutedEventArgs e) { Chart chart = sender as Chart; chart.ColorSet = "Visifire1"; if (chart != null) { // 新建一个 ColorSet 集合 ColorSets emcs = new ColorSets(); string resourceName = "Visifire.Charts.ColorSets.xaml"; // Visifire 默认颜色集合的文件 using (System.IO.Stream s = typeof(Chart).Assembly.GetManifestResourceStream(resourceName)) { if (s != null) { System.IO.StreamReader reader = new System.IO.StreamReader(s); String xaml = reader.ReadToEnd(); emcs = System.Windows.Markup.XamlReader.Load(xaml) as ColorSets; reader.Close(); s.Close(); } } // 根据名称取得 Chart 的 ColorSet ( Chart 的 ColorSet 属性为颜色集的名称 ) ColorSet cs = emcs.GetColorSetByName(chart.ColorSet); // 显示图例的 StackPanel StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal, VerticalAlignment = System.Windows.VerticalAlignment.Top, HorizontalAlignment = System.Windows.HorizontalAlignment.Center }; // 图例文本 string[] legendText = { "离异", "已婚", "未婚" }; // 自定义图例 for (int i = 0; i < chart.Series[0].DataPoints.Count; i++) { Grid grid = new Grid(); grid.Margin = new Thickness(15, 0, 0, 0); ColumnDefinition cd1 = new ColumnDefinition(); grid.ColumnDefinitions.Add(cd1); ColumnDefinition cd2 = new ColumnDefinition(); grid.ColumnDefinitions.Add(cd2); Rectangle rect = new Rectangle() { Width = 10, Height = 10, Fill = cs.Brushes[i] }; rect.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(rect); TextBlock tb = new TextBlock() { Text = legendText[i], Margin = new Thickness(5, 0, 0, 0), Foreground = cs.Brushes[i] }; tb.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(tb); sp.Children.Add(grid); } ReportChartList.Children.Add(sp); } }
public static Animation CreateColored(string id, ColorSet set, string layer = null) { return(new Animation(GetColored(id, set), layer)); }
public static IConsole WriteLineColored(this IConsole console, string text, ColorSet colorSet) { return(console.WriteLineColored(text, colorSet?.GetEffectiveForeground(), colorSet?.GetEffectiveBackground())); }
/// <summary> /// <see cref="ColorPlus"/>に変換する /// </summary> /// <param name="colorSet">色の種類</param> /// <exception cref="InvalidEnumArgumentException">不正な値が指定された</exception> public static ColorPlus ColorDetermination(ColorSet colorSet) => colorSet switch {
private void Init() { standardPackages = new List<Package>(); standardExteriorOptionalPackages = new List<Package>(); //standardInteriorOptionalPackages = new List<Package>(); optionalFactoryPackages = new List<Package>(); optionalAccessoryPackages = new List<Package>(); colorSet = new ColorSet(); factoryFeatureSet = new FeatureSet(); interiorSet = new PackageSet(); optionalFactoryPackage = new PackageSet(); optionalAccessories = new PackageSet(); warranty = new FeatureSet(); optionalFactoryTransmissionPackage = new PackageSet(); }
public ExtraAnimationComponent(string animationName, ColorSet set) : base(animationName, set) { }
public override void ReloadColorSet() { ColorSet ColorSet = PROGRAM.GetColorSet(); ReloadColorSet(ColorSet); }
public Mover(State _state, Texture2D _image, string _tag, ColorSet colorset, Vector2?_pos = null, Vector2?_size = null, EntityType _type = EntityType.Test) : base(_state, _image, _tag, _pos, _size, 0f, ScrollBehavior.Wrap, CollisionBehavior.Null, false, true, false, null, colorset) { this.Type = _type; Initialize(null, null); }
public void SetColorScheme(ColorSet _scheme) { scheme = _scheme; }
public Mover(State _state, Texture2D _image, string _tag, ColorSet colorset, Vector2?_pos = null, Vector2?_size = null, Vector2?_acc = null, Vector2?_vel = null, float _mass = 1.0f, bool _friction = true, EntityType _type = EntityType.Test) : base(_state, _image, _tag, _pos, _size, 0f, ScrollBehavior.Wrap, CollisionBehavior.Null, false, true, false, null, colorset) { this.Type = _type; Initialize(_acc, _vel, _mass, _friction); }
public static ColorBlock Fit(ColorSet colors, Options options, bool isBC1) { int count = colors.Count; Vector3[] points = colors.Points; double[] weights = colors.Weights; // compute the principle component Vector3 principle = ComputePrincipleComponent(count, points, weights); // get the min and max range as the codebook endpoints Vector3 start = new Vector3(); Vector3 end = new Vector3(); if( count > 0 ) { double min, max; // compute the range start = end = points[0]; min = max = Vector3.Dot(points[0], principle); for( int i = 1; i < count; ++i ) { double val = Vector3.Dot(points[i], principle); if( val < min ) { start = points[i]; min = val; } else if( val > max ) { end = points[i]; max = val; } } } // clamp the output to [0, 1] start = Vector3.Clamp(start, 0.0, 1.0); end = Vector3.Clamp(end, 0.0, 1.0); // clamp to the grid and save Vector3 grid = new Vector3(31.0, 63.0, 31.0); Vector3 gridrcp = Vector3.Reciprocal(grid); Vector3 half = new Vector3(0.5); start = Truncate(grid * start + half) * gridrcp; end = Truncate(grid * end + half) * gridrcp; // create a codebook Vector3[] codes = new Vector3[4]; codes[0] = start; codes[1] = end; codes[2] = (2.0 / 3.0) * start + (1.0 / 3.0) * end; codes[3] = (1.0 / 3.0) * start + (2.0 / 3.0) * end; // match each point to the closest code int[] closest = new int[16]; double error = 0.0f; for( int i = 0; i < count; ++i ) { // find the closest code double dist = double.MaxValue; int idx = 0; for( int j = 0; j < 4; ++j ) { double d = (options.Metric * (points[i] - codes[j])).MagnitudeSquared; if( d < dist ) { dist = d; idx = j; } } // save the index closest[i] = idx; // accumulate the error error += dist; } // remap the indices int[] indices = new int[16]; colors.RemapIndices(closest, indices); return new ColorBlock(new Color(start.X, start.Y, start.Z), new Color(end.X, end.Y, end.Z), indices); }
private bool SaveDisplayedColorSet() { string name = textBoxName.Text; ColorSet newColorSet = new ColorSet(); if (name.Length <= 0) { //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible) MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form. var messageBox = new MessageBoxForm("You must enter a name for the Color Set.", "Name Requred", false, false); messageBox.ShowDialog(); return false; } foreach (var control in tableLayoutPanelColors.Controls) { ColorPanel cp = (ColorPanel)control; newColorSet.Add(cp.Color); } _data.SetColorSet(textBoxName.Text, newColorSet); return true; }
public MainMenuState(ColorSet set, float scale = 1.0f) : base(StateType.Main, set, scale) { // Any special instructions for the main menu should take place here. }
/// <summary> /// This method return an array of colorWells that belong to the desired ColorSet and /// that have been sorted in the desired ColorSortOrder. /// </summary> /// <param name="colorSet">The color palette to be generated.</param> /// <param name="colorSortOrder">The order the generated palette should be sorted.</param> /// <returns></returns> public static ColorWellInfo[] GetColorWells( ColorSet colorSet, ColorSortOrder colorSortOrder ) { // get array of desired colorWells and sort // Could have sort order enum/property Array knownColors = Enum.GetValues( typeof(System.Drawing.KnownColor) ); int nColors = 0; // How many colors are there? switch( colorSet ) { case ColorSet.Web: foreach( KnownColor k in knownColors ) { Color c = Color.FromKnownColor(k); if( !c.IsSystemColor && (c.A > 0) ) { nColors++; } } break; case ColorSet.System: foreach( KnownColor k in knownColors ) { Color c = Color.FromKnownColor(k); if( c.IsSystemColor && (c.A > 0) ) { nColors++; } } break; } ColorWellInfo[] colorWells = new ColorWellInfo[ nColors ]; int index = 0; // Get the colors switch( colorSet ) { case ColorSet.Web: foreach( KnownColor k in knownColors ) { Color c = Color.FromKnownColor(k); if( !c.IsSystemColor && (c.A > 0) ) { colorWells[index] = new ColorWellInfo(c,index); index++; } } break; case ColorSet.System: foreach( KnownColor k in knownColors ) { Color c = Color.FromKnownColor(k); if( c.IsSystemColor && (c.A > 0) ) { colorWells[index] = new ColorWellInfo(c,index); index++; } } break; } SortColorWells(colorWells, colorSortOrder); return colorWells; }
public bool Perform(IEnumerable <ElementNode> selectedNodes) { DialogResult dr = ShowDialog(); if (dr != DialogResult.OK) { return(false); } // note: the color property can only be applied to leaf nodes. // pull out the new data settings from the form elements ElementColorType colorType; string colorSetName = ""; System.Drawing.Color singleColor = System.Drawing.Color.Black; if (radioButtonOptionSingle.Checked) { colorType = ElementColorType.SingleColor; singleColor = colorPanelSingleColor.Color; } else if (radioButtonOptionMultiple.Checked) { colorType = ElementColorType.MultipleDiscreteColors; colorSetName = comboBoxColorSet.SelectedItem.ToString(); } else if (radioButtonOptionFullColor.Checked) { colorType = ElementColorType.FullColor; } else { Logging.Warn("Unexpected radio option selected"); colorType = ElementColorType.SingleColor; } // PROPERTY SETUP // go through all elements, making a color property for each one. // (If any has one already, check with the user as to what they want to do.) IEnumerable <ElementNode> leafElements = selectedNodes.SelectMany(x => x.GetLeafEnumerator()).Distinct(); List <ElementNode> leafElementList = leafElements.ToList(); bool askedUserAboutExistingProperties = false; bool overrideExistingProperties = false; int colorPropertiesAdded = 0; int colorPropertiesConfigured = 0; int colorPropertiesSkipped = 0; foreach (ElementNode leafElement in leafElementList) { bool skip = false; ColorModule existingProperty = null; if (leafElement.Properties.Contains(ColorDescriptor.ModuleId)) { if (!askedUserAboutExistingProperties) { DialogResult mbr = MessageBox.Show("Some elements already have color properties set up. Should these be overwritten?", "Color Setup", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); overrideExistingProperties = (mbr == DialogResult.Yes); askedUserAboutExistingProperties = true; } skip = !overrideExistingProperties; existingProperty = leafElement.Properties.Get(ColorDescriptor.ModuleId) as ColorModule; } else { existingProperty = leafElement.Properties.Add(ColorDescriptor.ModuleId) as ColorModule; colorPropertiesAdded++; } if (!skip) { if (existingProperty == null) { Logging.Error("Null color property for element " + leafElement.Name); } else { existingProperty.ColorType = colorType; existingProperty.SingleColor = singleColor; existingProperty.ColorSetName = colorSetName; colorPropertiesConfigured++; } } else { colorPropertiesSkipped++; } } // PATCHING // go through each element, walking the tree of patches, building up a list. If any are a 'color // breakdown' already, warn/check with the user if it's OK to overwrite them. Make a new breakdown // filter for each 'leaf' of the patching process. If it's fully patched to an output, ignore it. List <IDataFlowComponentReference> leafOutputs = new List <IDataFlowComponentReference>(); foreach (ElementNode leafElement in leafElementList.Where(x => x.Element != null)) { leafOutputs.AddRange(_FindLeafOutputsOrBreakdownFilters(VixenSystem.DataFlow.GetComponent(leafElement.Element.Id))); } bool askedUserAboutExistingFilters = false; bool overrideExistingFilters = false; ColorBreakdownModule breakdown = null; int colorFiltersAdded = 0; int colorFiltersConfigured = 0; int colorFiltersSkipped = 0; foreach (IDataFlowComponentReference leaf in leafOutputs) { bool skip = false; if (leaf.Component is ColorBreakdownModule) { if (!askedUserAboutExistingFilters) { DialogResult mbr = MessageBox.Show("Some elements are already patched to color filters. Should these be overwritten?", "Color Setup", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); overrideExistingFilters = (mbr == DialogResult.Yes); askedUserAboutExistingFilters = true; } skip = !overrideExistingFilters; breakdown = leaf.Component as ColorBreakdownModule; } else if (leaf.Component.OutputDataType == DataFlowType.None) { // if it's a dead-end -- ie. most likely a controller output -- skip it skip = true; } else { // doesn't exist? make a new module and assign it breakdown = ApplicationServices.Get <IOutputFilterModuleInstance>(ColorBreakdownDescriptor.ModuleId) as ColorBreakdownModule; VixenSystem.DataFlow.SetComponentSource(breakdown, leaf); VixenSystem.Filters.AddFilter(breakdown); colorFiltersAdded++; } if (!skip) { List <ColorBreakdownItem> newBreakdownItems = new List <ColorBreakdownItem>(); bool mixColors = false; ColorBreakdownItem cbi; switch (colorType) { case ElementColorType.FullColor: mixColors = true; // TODO: really, RGB isn't the only option for 'full color': some people use white as well. We should allow for that. cbi = new ColorBreakdownItem(); cbi.Color = System.Drawing.Color.Red; cbi.Name = "Red"; newBreakdownItems.Add(cbi); cbi = new ColorBreakdownItem(); cbi.Color = System.Drawing.Color.Lime; cbi.Name = "Green"; newBreakdownItems.Add(cbi); cbi = new ColorBreakdownItem(); cbi.Color = System.Drawing.Color.Blue; cbi.Name = "Blue"; newBreakdownItems.Add(cbi); break; case ElementColorType.MultipleDiscreteColors: mixColors = false; ColorStaticData csd = ApplicationServices.GetModuleStaticData(ColorDescriptor.ModuleId) as ColorStaticData; if (!csd.ContainsColorSet(colorSetName)) { Logging.Error("Color sets doesn't contain " + colorSetName); } else { ColorSet cs = csd.GetColorSet(colorSetName); foreach (var c in cs) { cbi = new ColorBreakdownItem(); cbi.Color = c; // heh heh, this can be.... creative. cbi.Name = c.Name; newBreakdownItems.Add(cbi); } } break; case ElementColorType.SingleColor: mixColors = false; cbi = new ColorBreakdownItem(); cbi.Color = singleColor; newBreakdownItems.Add(cbi); break; } breakdown.MixColors = mixColors; breakdown.BreakdownItems = newBreakdownItems; colorFiltersConfigured++; } else { colorFiltersSkipped++; } } MessageBox.Show("Color Properties: " + colorPropertiesAdded + " added, " + colorPropertiesConfigured + " configured, " + colorPropertiesSkipped + " skipped. " + "Color Filters: " + colorFiltersAdded + " added, " + colorFiltersConfigured + " configured, " + colorFiltersSkipped + " skipped."); return(true); }
private ColorSet GetExistingColorSet(ColorSet set) { return AllColorSets.FirstOrDefault(c => c.Equals(set)); }
private Bitmap GetBitmap(ColorSet set) { var result = new Bitmap(Width, Height); Brush outerBrush = null; Brush innerBrush = null; Pen borderPen = null; Graphics g = null; try { g = Graphics.FromImage(result); g.SmoothingMode = SmoothingMode.HighQuality; outerBrush = new LinearGradientBrush(this.outerRectangle, set.OuterTop, set.OuterBottom, LinearGradientMode.Vertical); innerBrush = new LinearGradientBrush(this.innerRectangle, set.InnerTop, set.InnerBottom, LinearGradientMode.Vertical); borderPen = new Pen(set.Border); g.FillPath(outerBrush, this.outerPath); g.DrawPath(borderPen, this.outerPath); g.FillPath(innerBrush, this.innerPath); //g.DrawString( Text, Font,textBrush, (float)5, (float)(Height - Font.Height) / 2, center); } finally { if (outerBrush != null) { outerBrush.Dispose(); } if (innerBrush != null) { innerBrush.Dispose(); } if (borderPen != null) { borderPen.Dispose(); } if (g != null) { g.Dispose(); } } return result; }
public abstract void ReloadColorSet(ColorSet ColorSet);
private Color GetColorFromSet(ColorSet cs, int index) { Color rc = cs.Color1; switch (index) { case 0: rc = cs.Color1; break; case 1: rc = cs.Color2; break; case 2: rc = cs.Color3; break; case 3: rc = cs.Color4; break; case 4: rc = cs.Color5; break; case 5: rc = cs.Color6; break; case 6: rc = cs.Color7; break; case 7: rc = cs.Color8; break; case 8: rc = cs.Color9; break; case 9: rc = cs.Color10; break; case 10: rc = cs.Color11; break; case 11: rc = cs.Color12; break; case 12: rc = cs.ColorText; break; } return(rc); }
public OptionsState(ColorSet set, float scale = 1.0f) : base(StateType.Options, set, scale) { // Any special instructions for the options menu should take place here. }