mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Fixed debug display (resolves #4) and fixed volume display scaling
This commit is contained in:
parent
c2c002715c
commit
c801656b00
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
@ -82,33 +84,19 @@ namespace Artemis.Modules.Effects.Debug
|
||||
|
||||
public void Handle(ChangeBitmap message)
|
||||
{
|
||||
//// Doesn't show transparancy
|
||||
//using (var memory = new MemoryStream())
|
||||
//{
|
||||
// message.Bitmap.Save(memory, ImageFormat.Bmp);
|
||||
// memory.Position = 0;
|
||||
|
||||
// var bitmapImage = new BitmapImage();
|
||||
// bitmapImage.BeginInit();
|
||||
// bitmapImage.StreamSource = memory;
|
||||
// bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
// bitmapImage.EndInit();
|
||||
|
||||
// ImageSource = bitmapImage;
|
||||
//}
|
||||
|
||||
// Causes "Generic GDI+ Exception" after a while
|
||||
try
|
||||
// Doesn't show transparancy
|
||||
using (var memory = new MemoryStream())
|
||||
{
|
||||
ImageSource = Imaging.CreateBitmapSourceFromHBitmap(
|
||||
message.Bitmap.GetHbitmap(),
|
||||
IntPtr.Zero,
|
||||
Int32Rect.Empty,
|
||||
BitmapSizeOptions.FromEmptyOptions());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
message.Bitmap.Save(memory, ImageFormat.Png);
|
||||
memory.Position = 0;
|
||||
|
||||
var bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.StreamSource = memory;
|
||||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmapImage.EndInit();
|
||||
|
||||
ImageSource = bitmapImage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
},
|
||||
LinearGradientMode.Horizontal)
|
||||
{
|
||||
Width = (int) (100.00/(MainModel.ActiveKeyboard.Width*4)*Volume),
|
||||
Width = (int) ((MainModel.ActiveKeyboard.Width/100.00)*Volume)*Scale,
|
||||
ContainedBrush = false
|
||||
};
|
||||
volumeRect.Draw(g);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user