/// <summary> /// Adjusts the image for different themes /// </summary> public static Image AdjustImage(Image image) { String style = Globals.MainForm.GetThemeValue("ImageManager.ImageSet"); if (style == "Bright") { return(ImageKonverter.ImageAdjust(image, 20, 0)); } else if (style == "Dim") { return(ImageKonverter.ImageAdjust(image, -5, -2)); } else if (style == "Dark") { return(ImageKonverter.ImageAdjust(image, -5, -10)); } else if (style == "Darker") { return(ImageKonverter.ImageAdjust(image, -20, -20)); } else if (style == "Black") { return(ImageKonverter.ImageAdjust(image, -50, -25)); } else { return(image); } }
/// <summary> /// Refreshes the icon. /// </summary> public void RefreshIcon() { if (image != null) { Icon = ImageKonverter.ImageToIcon(image); } }
/// <summary> /// Ask the shell to feed us the appropriate icon for the given file, but /// first try looking in our cache to see if we've already loaded it. /// </summary> private int ExtractIconIfNecessary(String path) { Icon icon; Size size = GetSmallIconSize(); String ext = Path.GetExtension(path); if (String.IsNullOrEmpty(ext)) { ext = "folder"; } if (this.imageList.Images[ext] != null) { return(this.imageList.Images.IndexOfKey(ext)); } else { if (File.Exists(path)) { icon = IconExtractor.GetFileIcon(path, false, true); } else { icon = IconExtractor.GetFolderIcon(path, false, true); } Image image = ImageKonverter.ImageResize(icon.ToBitmap(), size.Width, size.Height); this.imageList.Images.Add(ext, image); icon.Dispose(); image.Dispose(); return(this.imageList.Images.Count - 1); } }
public static FDImage GetGray(string data) { Image image = (mainForm != null) ? mainForm.FindImage(data) : new Bitmap(16, 16); Image converted = ImageKonverter.ImageToGrayscale(image); imageList.Images.Add(converted); return(new FDImage(converted, imageList.Images.Count - 1)); }
public static FDImage GetGray(string data) { Image image = (mainForm != null) ? mainForm.FindImage(data, false) : new Bitmap(16, 16); image = mainForm.GetAutoAdjustedImage(ImageKonverter.ImageToGrayscale(image)); imageList.Images.Add(image); return(new FDImage(image, imageList.Images.Count - 1)); }
/// <summary> /// Creates the Start Page Tab /// </summary> public void CreateStartPage() { this.startPageWebBrowser = new StartPageWebBrowser(this.CurrentPageUrl, this.CurrentRssUrl); this.startPage = PluginBase.MainForm.CreateCustomDocument(this.startPageWebBrowser); this.startPage.Icon = ImageKonverter.ImageToIcon(this.pluginImage); this.startPage.Disposed += new EventHandler(this.PluginPanelDisposed); this.startPage.Closing += new CancelEventHandler(this.PluginPanelClosing); this.startPage.Text = TextHelper.GetString("Title.StartPage"); }
/// <summary> /// Gets an adjusted copy of the specified image. /// </summary> public static Image SetImageAdjustment(Image original) { int saturation, brightness; if (GetImageAdjustments(out saturation, out brightness)) { return(ImageKonverter.ImageAdjust(original, saturation, brightness)); } return(new Bitmap(original)); }
/// <summary> /// Resizes the image based on the display scale. Uses high quality settings. /// </summary> public static Bitmap Scale(Bitmap image) { if (GetScale() == 1) { return(image); } int width = Scale(image.Width); int height = Scale(image.Height); return((Bitmap)ImageKonverter.ImageResize(image, width, height)); }
/// <summary> /// Automaticly updates the document icon /// </summary> private void UpdateDocumentIcon(String file) { if (this.useCustomIcon) { return; } if (!this.IsBrowsable) { this.Icon = IconExtractor.GetFileIcon(file, true); } else { Image image = Globals.MainForm.FindImage("480"); this.Icon = ImageKonverter.ImageToIcon(image); this.useCustomIcon = true; } }
/// <summary> /// Ask the shell to feed us the appropriate icon for the given file, but /// first try looking in our cache to see if we've already loaded it. /// </summary> private int ExtractIconIfNecessary(String path) { Icon icon; Size size = GetSmallIconSize(); if (File.Exists(path)) { icon = IconExtractor.GetFileIcon(path, false, true); } else { icon = IconExtractor.GetFolderIcon(path, false, true); } Image image = ImageKonverter.ImageResize(icon.ToBitmap(), size.Width, size.Height); this.imageList.Images.Add(image); icon.Dispose(); image.Dispose(); return(this.imageList.Images.Count - 1); }
public static FDImage ExtractIconIfNecessary(string file) { string extension = Path.GetExtension(file); if (extensionIcons.ContainsKey(extension)) { return(extensionIcons[extension]); } else { Icon icon = IconExtractor.GetFileIcon(file, true); Image image = ImageKonverter.ImageResize(icon.ToBitmap(), 16, 16); icon.Dispose(); imageList.Images.Add(image); int index = imageList.Images.Count - 1; // of the icon we just added FDImage fdImage = new FDImage(image, index); extensionIcons.Add(extension, fdImage); return(fdImage); } }
/// <summary> /// Adjust colors of all cached images. /// </summary> public static void AdjustAllImages() { int saturation, brightness; GetImageAdjustments(out saturation, out brightness); for (int i = 0, length = AutoAdjusted.Count; i < length; i++) { var imagePair = AutoAdjusted[i]; var adjusted = imagePair.Adjusted; if (adjusted == null) { AutoAdjusted.RemoveAt(i--); length--; } else { ImageKonverter.ImageAdjust(imagePair.Original, adjusted, saturation, brightness); } } }
/// <summary> /// Makes the plugin panel top most form of FD /// </summary> private void TopMostButtonClick(Object sender, EventArgs e) { this.topMostButton.Checked = !this.topMostButton.Checked; if (this.topMostButton.Checked) { this.ClosePluginPanel(); this.popupForm = new Form(); this.popupForm.Controls.Add(this); this.popupForm.MinimumSize = new Size(350, 120); this.popupForm.Text = TextHelper.GetString("Title.PluginPanel"); this.popupForm.FormClosed += new FormClosedEventHandler(this.PopupFormClosed); this.popupForm.Icon = ImageKonverter.ImageToIcon(PluginBase.MainForm.FindImage("412")); if (this.Settings.KeepPopupTopMost) { this.popupForm.TopMost = true; } this.popupForm.Show(); } else { this.popupForm.Close(); } }