public ExtensionRecord(ExtensionRecords records, string extension) { this.records = records; this.extension = extension.ToLower(); color = new Rgb24Color(150, 150, 150); /*if (IsEmptyExtension) * name = "File"; * else * name = extension.TrimStart('.').ToUpper() + " File";*/ }
private TreemapItem(TreemapItem file, TreemapItem parent) { this.parent = parent; int count = file.ChildCount; children = new List <TreemapItem>(count); for (int i = 0; i < count; i++) { children.Add(new TreemapItem(file[i], this)); } children.Sort(CompareReverse); children.Sort(Compare); size = file.Size; extension = file.Extension + ""; name = file.name + ""; type = file.type; color = file.Color; }
public static Rgb24Color SetBrightness(Rgb24Color color, float brightness) { Debug.Assert(brightness >= 0); Debug.Assert(brightness <= 1); Number redf = color.R / 255f; Number greenf = color.G / 255f; Number bluef = color.B / 255f; Number f = 3 * brightness / (redf + greenf + bluef); int red = (int)(redf * f * 255); int green = (int)(greenf * f * 255); int blue = (int)(bluef * f * 255); NormalizeColor(ref red, ref green, ref blue); return(new Rgb24Color(red, green, blue)); }
public static Rgb24Color SetBrightness(Rgb24Color color, float brightness) { Debug.Assert(brightness >= 0f); Debug.Assert(brightness <= 1f); float redf = color.R / 255f; float greenf = color.G / 255f; float bluef = color.B / 255f; float f = 3f * brightness / (redf + greenf + bluef); redf *= f; greenf *= f; bluef *= f; int red = (int) (redf * 255); int green = (int) (greenf * 255); int blue = (int) (bluef * 255); NormalizeColor(ref red, ref green, ref blue); return new Rgb24Color(red, green, blue); }
/// <summary> /// Updates the information about selected pixel. /// </summary> /// <param name="x">Selected pixel x coordinate.</param> /// <param name="y">Selected pixel y coordinate.</param> /// <param name="pixelColor">Selected pixel color.</param> private void ShowSelectedPixelColor(int x, int y, ColorBase pixelColor) { VintasoftImage image = _viewer.Image; _selectedColorX = x; _selectedColorY = y; _selectedColor = pixelColor; selectedPixelLabel.Text = string.Format("Selected Pixel: X={0},Y={1}; ColorType={2}", x, y, pixelColor.GetType().Name); _pixelSelect = true; if (pixelColor is Rgb24Color) { Rgb24Color rgbColor = (Rgb24Color)pixelColor; argbPanel.Visible = true; indexedPanel.Visible = false; gray16Panel.Visible = false; redNumericUpDown.Maximum = 255; redNumericUpDown.Value = rgbColor.Red; greenNumericUpDown.Maximum = 255; greenNumericUpDown.Value = rgbColor.Green; blueNumericUpDown.Maximum = 255; blueNumericUpDown.Value = rgbColor.Blue; if (pixelColor is Argb32Color) { alphaNumericUpDown.Maximum = 255; alphaNumericUpDown.Value = ((Argb32Color)pixelColor).Alpha; alphaNumericUpDown.Visible = true; rgbColorTypeLabel.Text = "ARGB32 ="; } else { alphaNumericUpDown.Visible = false; rgbColorTypeLabel.Text = "RGB (24bpp) ="; } } else if (pixelColor is Rgb48Color) { Rgb48Color rgb48Color = (Rgb48Color)pixelColor; argbPanel.Visible = true; indexedPanel.Visible = false; gray16Panel.Visible = false; redNumericUpDown.Maximum = 65535; redNumericUpDown.Value = rgb48Color.Red; greenNumericUpDown.Maximum = 65535; greenNumericUpDown.Value = rgb48Color.Green; blueNumericUpDown.Maximum = 65535; blueNumericUpDown.Value = rgb48Color.Blue; if (pixelColor is Argb64Color) { alphaNumericUpDown.Maximum = 65535; alphaNumericUpDown.Value = ((Argb64Color)pixelColor).Alpha; alphaNumericUpDown.Visible = true; rgbColorTypeLabel.Text = "ARGB64 ="; } else { alphaNumericUpDown.Visible = false; rgbColorTypeLabel.Text = "RGB (48bpp) ="; } } else if (pixelColor is Rgb16ColorBase) { Rgb16ColorBase rgb16Color = (Rgb16ColorBase)pixelColor; argbPanel.Visible = true; indexedPanel.Visible = false; gray16Panel.Visible = false; redNumericUpDown.Maximum = 31; redNumericUpDown.Value = rgb16Color.Red; blueNumericUpDown.Maximum = 31; blueNumericUpDown.Value = rgb16Color.Blue; alphaNumericUpDown.Visible = false; if (pixelColor is Rgb16Color555) { greenNumericUpDown.Maximum = 31; rgbColorTypeLabel.Text = "RGB16 (5-5-5) ="; } else { greenNumericUpDown.Maximum = 63; rgbColorTypeLabel.Text = "RGB16 (5-6-5) ="; } greenNumericUpDown.Value = rgb16Color.Green; } else if (pixelColor is IndexedColor) { IndexedColor indexedColor = (IndexedColor)pixelColor; argbPanel.Visible = false; indexedPanel.Visible = true; gray16Panel.Visible = false; indexNumericUpDown.Maximum = indexedColor.Palette.ColorCount - 1; indexNumericUpDown.Value = indexedColor.Index; } else if (pixelColor is Gray16Color) { Gray16Color gray16 = (Gray16Color)pixelColor; argbPanel.Visible = false; indexedPanel.Visible = false; gray16Panel.Visible = true; gray16LumNumericUpDown.Value = gray16.Luminance; } selectedPixelColorPanel.BackColor = pixelColor.ToColor(); _pixelSelect = false; pixelsGroupBox.Refresh(); }
/// <summary>Casts the <see cref="Rgb24Color"/> to a <see cref="WpfColor"/>.</summary> public static WpfColor ToWpfColor(this Rgb24Color color) { return(WpfColor.FromRgb(color.R, color.G, color.B)); }
/// <summary>Adds a <see cref="PreviewTreemapItem"/> leaf to the children.</summary> /// /// <param name="size">The size of the child treemap item.</param> /// <param name="color">The color of the child treemap item.</param> public void Add(long size, Rgb24Color color) { children.Add(new PreviewTreemapItem(size, color)); }
/// <summary>Constructs a <see cref="PreviewTreemapItem"/> leaf.</summary> /// /// <param name="size">The size of the treemap item.</param> /// <param name="color">The color of the treemap item.</param> public PreviewTreemapItem(long size, Rgb24Color color) { Size = size; Color = color; }
public static float GetBrightness(Rgb24Color color) { return((color.R + color.G + color.B) / (Number)255 / 3); }
public PreviewTreemapItem(long size, Rgb24Color color) { this.size = size; this.color = color; }
public static float GetBrightness(Rgb24Color color) { return (color.R + color.G + color.B) / 255f / 3f; }
/// <summary>Constructs an <see cref="ExtensionItem"/> with the specified extension.</summary> /// /// <param name="extensions">The collection containing this extension.</param> /// <param name="normalizedExtension">The pre-normalized extension for this item.</param> internal ExtensionItem(ExtensionItems extensions, string normalizedExtension) { this.extensions = extensions; Extension = normalizedExtension; color = new Rgb24Color(150, 150, 150); }
/// <summary>Constructs the not-a-file extension.</summary> private ExtensionItem() { extensions = null; Extension = string.Empty; color = Rgb24Color.Black; }