mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
CUERipper: Preview large cover art
This commit is contained in:
2
CUERipper/frmCUERipper.Designer.cs
generated
2
CUERipper/frmCUERipper.Designer.cs
generated
@@ -715,6 +715,8 @@ namespace CUERipper
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseClick);
|
||||
this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
|
||||
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
|
||||
//
|
||||
// backgroundWorkerArtwork
|
||||
//
|
||||
|
||||
@@ -1590,6 +1590,40 @@ namespace CUERipper
|
||||
form.ShowDialog(this);
|
||||
resetEncoderModes(encoder);
|
||||
}
|
||||
|
||||
private static Bitmap cropImage(Image imgToResize, Size boxSize, RectangleF srcRect)
|
||||
{
|
||||
Bitmap b = new Bitmap(boxSize.Width, boxSize.Height);
|
||||
//area.Width / 2 - area.X, area.Height /2 - area.Y, area.Width, area.Height
|
||||
Graphics g = Graphics.FromImage((Image)b);
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||
g.DrawImage(imgToResize, new Rectangle(0, 0, boxSize.Width, boxSize.Height), srcRect, GraphicsUnit.Pixel);
|
||||
g.Dispose();
|
||||
return b;
|
||||
}
|
||||
|
||||
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (currentAlbumArt < 0 || currentAlbumArt >= albumArt.Count || _config.advanced.coversSearch != CUEConfigAdvanced.CTDBCoversSearch.Large)
|
||||
return;
|
||||
|
||||
var isz = new RectangleF(0.0f, 0.0f, albumArt[currentAlbumArt].image.Width, albumArt[currentAlbumArt].image.Height);
|
||||
float ratio = Math.Min(isz.Width / pictureBox1.ClientSize.Width, isz.Height / pictureBox1.ClientSize.Height);
|
||||
ratio = Math.Min(ratio, 1.0f);
|
||||
var rf = new RectangleF(
|
||||
e.Location.X * (isz.Width / pictureBox1.ClientSize.Width - ratio),
|
||||
e.Location.Y * (isz.Height / pictureBox1.ClientSize.Height - ratio),
|
||||
pictureBox1.ClientSize.Width * ratio,
|
||||
pictureBox1.ClientSize.Height * ratio);
|
||||
pictureBox1.Image = cropImage(albumArt[currentAlbumArt].image, pictureBox1.ClientSize, rf);
|
||||
}
|
||||
|
||||
private void pictureBox1_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
if (currentAlbumArt < 0 || currentAlbumArt >= albumArt.Count)
|
||||
return;
|
||||
pictureBox1.Image = albumArt[currentAlbumArt].image;
|
||||
}
|
||||
}
|
||||
|
||||
internal class BackgroundWorkerArtworkArgs
|
||||
|
||||
@@ -816,7 +816,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABy
|
||||
CQAAAk1TRnQBSQFMAgEBBAEAAUwBAgFMAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CQAAAk1TRnQBSQFMAgEBBAEAAWwBAgFsAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
@@ -966,7 +966,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAY
|
||||
EgAAAk1TRnQBSQFMAgEBCwEAAUwBAgFMAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
EgAAAk1TRnQBSQFMAgEBCwEAAWwBAgFsAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
||||
Reference in New Issue
Block a user