mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Removed useless code
This commit is contained in:
parent
9a583764c5
commit
23710bdf7a
@ -1,25 +1,25 @@
|
|||||||
<Application x:Class="Artemis.App"
|
<Application x:Class="Artemis.App"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:artemis="clr-namespace:Artemis"
|
xmlns:artemis="clr-namespace:Artemis"
|
||||||
DispatcherUnhandledException="Application_DispatcherUnhandledException"
|
DispatcherUnhandledException="Application_DispatcherUnhandledException"
|
||||||
ShutdownMode="OnExplicitShutdown">
|
ShutdownMode="OnExplicitShutdown">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<artemis:ArtemisBootstrapper x:Key="ArtemisBootstrapper" />
|
<artemis:ArtemisBootstrapper x:Key="ArtemisBootstrapper" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
|
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
||||||
<!-- Accent and AppTheme setting -->
|
<!-- Accent and AppTheme setting -->
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
|
||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
||||||
<ResourceDictionary Source="/Resources/Icons.xaml" />
|
<ResourceDictionary Source="/Resources/Icons.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
using Artemis.Utilities;
|
||||||
using Corale.Colore.Razer.Keyboard.Effects;
|
using Corale.Colore.Razer.Keyboard.Effects;
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders.Razer.Utilities
|
namespace Artemis.KeyboardProviders.Razer.Utilities
|
||||||
@ -11,7 +12,7 @@ namespace Artemis.KeyboardProviders.Razer.Utilities
|
|||||||
{
|
{
|
||||||
var keyboardGrid = Custom.Create();
|
var keyboardGrid = Custom.Create();
|
||||||
if (b.Width > width || b.Height > height)
|
if (b.Width > width || b.Height > height)
|
||||||
b = ResizeImage(b, width, height);
|
b = ImageUtilities.ResizeImage(b, width, height);
|
||||||
|
|
||||||
for (var y = 0; y < b.Height; y++)
|
for (var y = 0; y < b.Height; y++)
|
||||||
for (var x = 0; x < b.Width; x++)
|
for (var x = 0; x < b.Width; x++)
|
||||||
@ -19,37 +20,5 @@ namespace Artemis.KeyboardProviders.Razer.Utilities
|
|||||||
|
|
||||||
return keyboardGrid;
|
return keyboardGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resize the image to the specified width and height.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="image">The image to resize.</param>
|
|
||||||
/// <param name="width">The width to resize to.</param>
|
|
||||||
/// <param name="height">The height to resize to.</param>
|
|
||||||
/// <returns>The resized image.</returns>
|
|
||||||
public static Bitmap ResizeImage(Image image, int width, int height)
|
|
||||||
{
|
|
||||||
var destRect = new Rectangle(0, 0, width, height);
|
|
||||||
var destImage = new Bitmap(width, height);
|
|
||||||
|
|
||||||
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
|
|
||||||
|
|
||||||
using (var graphics = Graphics.FromImage(destImage))
|
|
||||||
{
|
|
||||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
|
||||||
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
|
||||||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
|
||||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
|
||||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
|
||||||
|
|
||||||
using (var wrapMode = new ImageAttributes())
|
|
||||||
{
|
|
||||||
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
|
|
||||||
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return destImage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,44 +78,6 @@ namespace Artemis.Utilities
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Saves an image as a jpeg image, with the given quality
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">Path to which the image would be saved.</param>
|
|
||||||
/// <param name="quality">
|
|
||||||
/// An integer from 0 to 100, with 100 being the
|
|
||||||
/// highest quality
|
|
||||||
/// </param>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// An invalid value was entered for image quality.
|
|
||||||
/// </exception>
|
|
||||||
public static void SaveJpeg(string path, Image image, int quality)
|
|
||||||
{
|
|
||||||
//ensure the quality is within the correct range
|
|
||||||
if ((quality < 0) || (quality > 100))
|
|
||||||
{
|
|
||||||
//create the error message
|
|
||||||
var error =
|
|
||||||
string.Format(
|
|
||||||
"Jpeg image quality must be between 0 and 100, with 100 being the highest quality. A value of {0} was specified.",
|
|
||||||
quality);
|
|
||||||
//throw a helpful exception
|
|
||||||
throw new ArgumentOutOfRangeException(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create an encoder parameter for the image quality
|
|
||||||
var qualityParam = new EncoderParameter(Encoder.Quality, quality);
|
|
||||||
//get the jpeg codec
|
|
||||||
var jpegCodec = GetEncoderInfo("image/jpeg");
|
|
||||||
|
|
||||||
//create a collection of all parameters that we will pass to the encoder
|
|
||||||
var encoderParams = new EncoderParameters(1);
|
|
||||||
//set the quality parameter for the codec
|
|
||||||
encoderParams.Param[0] = qualityParam;
|
|
||||||
//save the image using the codec and the parameters
|
|
||||||
image.Save(path, jpegCodec, encoderParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the image codec with the given mime type
|
/// Returns the image codec with the given mime type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user