diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs
index ee71bf34..5b10b7a0 100644
--- a/Vocaluxe/Base/CDraw.cs
+++ b/Vocaluxe/Base/CDraw.cs
@@ -209,7 +209,7 @@ namespace Vocaluxe.Base
///
/// Full path to the image file
/// Reference to texture
- public static CTextureRef EnqueueTexture(String texturePath)
+ public static CTextureRef EnqueueTexture(String texturePath)
{
return _Draw.EnqueueTexture(texturePath);
}
@@ -399,13 +399,25 @@ namespace Vocaluxe.Base
/// Where to draw the texture
/// How to fit a texture in the bounds if the size differs
public static void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect)
+ {
+ DrawTexture(textureRef, bounds, aspect, textureRef.Color);
+ }
+
+ ///
+ /// Draws a texture fitting it within the given color and bounds with the method specified by aspect
+ ///
+ ///
+ /// Where to draw the texture
+ /// How to fit a texture in the bounds if the size differs
+ /// Color to use
+ public static void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color)
{
if (textureRef == null)
return;
SRectF rect;
CHelper.SetRect(bounds, out rect, textureRef.OrigAspect, aspect);
- DrawTexture(textureRef, rect);
+ DrawTexture(textureRef, rect, color);
}
///
diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs
index a67fce16..536d0a23 100644
--- a/Vocaluxe/Base/CMain.cs
+++ b/Vocaluxe/Base/CMain.cs
@@ -423,6 +423,16 @@ namespace Vocaluxe.Base
CDraw.DrawTexture(texture, rect, color, bounds, mirrored);
}
+ public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect)
+ {
+ CDraw.DrawTexture(textureRef, bounds, aspect);
+ }
+
+ public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color)
+ {
+ CDraw.DrawTexture(textureRef, bounds, aspect, color);
+ }
+
public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float reflectionSpace, float reflectionHeight)
{
CDraw.DrawTextureReflection(texture, rect, color, reflectionSpace, reflectionHeight);
@@ -438,12 +448,17 @@ namespace Vocaluxe.Base
CDraw.RemoveTexture(ref texture);
}
- public void DrawColor(SColorF color, SRectF rect)
+ public void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2)
+ {
+ CDraw.DrawLine(color, w, x1, y1, x2, y2);
+ }
+
+ public void DrawRect(SColorF color, SRectF rect)
{
CDraw.DrawRect(color, rect);
}
- public void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
+ public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
{
CDraw.DrawRectReflection(color, rect, space, height);
}
diff --git a/Vocaluxe/Base/CVideoPlayer.cs b/Vocaluxe/Base/CVideoPlayer.cs
index 24667b3f..0838ae7c 100644
--- a/Vocaluxe/Base/CVideoPlayer.cs
+++ b/Vocaluxe/Base/CVideoPlayer.cs
@@ -62,11 +62,8 @@ namespace Vocaluxe.Base
}
if (_VideoTexture == null)
return;
- var bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
- RectangleF rect;
- CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop);
- CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
+ CDraw.DrawTexture(_VideoTexture, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, CSettings.ZFar / 4), EAspect.Crop);
}
public void PreLoad()
diff --git a/Vocaluxe/Lib/Draw/CDrawBase.cs b/Vocaluxe/Lib/Draw/CDrawBase.cs
index 1b71d4dd..8cf32f54 100644
--- a/Vocaluxe/Lib/Draw/CDrawBase.cs
+++ b/Vocaluxe/Lib/Draw/CDrawBase.cs
@@ -660,8 +660,9 @@ namespace Vocaluxe.Lib.Draw
{
lock (_TextureQueue)
{
- CTextureRef textureRef = _GetTextureReference(w, h, _CreateTexture(new Size(-1, -1)));
- _TextureQueue.Enqueue(new STextureQueue(textureRef, EQueueAction.Add, new Size(w, h), data));
+ TTextureType texture = _CreateTexture(new Size(-1, -1));
+ CTextureRef textureRef = _GetTextureReference(w, h, texture);
+ _TextureQueue.Enqueue(new STextureQueue(texture, EQueueAction.Add, new Size(w, h), data));
return textureRef;
}
}
diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs
index 6c857553..6d85cf91 100644
--- a/Vocaluxe/Screens/CScreenSing.cs
+++ b/Vocaluxe/Screens/CScreenSing.cs
@@ -467,9 +467,7 @@ namespace Vocaluxe.Screens
if (background != null)
{
var bounds = new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, 0);
- SRectF rect;
- CHelper.SetRect(bounds, out rect, background.OrigAspect, aspect);
- CDraw.DrawTexture(background, rect, background.Color);
+ CDraw.DrawTexture(background, bounds, aspect, background.Color);
}
else if (_SlideShow != null)
_SlideShow.Draw();
diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs
index 27c93374..204a9b96 100644
--- a/VocaluxeLib/IBasic.cs
+++ b/VocaluxeLib/IBasic.cs
@@ -143,13 +143,16 @@ namespace VocaluxeLib
void DrawTexture(CTextureRef texture, SRectF rect);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false);
+ void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect);
+ void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color);
void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float reflectionSpace, float reflectionHeight);
CTextureRef AddTexture(string fileName);
void RemoveTexture(ref CTextureRef texture);
- void DrawColor(SColorF color, SRectF rect);
- void DrawColorReflection(SColorF color, SRectF rect, float space, float height);
+ void DrawRect(SColorF color, SRectF rect);
+ void DrawRectReflection(SColorF color, SRectF rect, float space, float height);
+ void DrawLine(SColorF color, float w, int x1, int y1, int x2, int y2);
}
public interface IGraphics
diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs
index c6647651..f1132ca2 100644
--- a/VocaluxeLib/Menu/CBackground.cs
+++ b/VocaluxeLib/Menu/CBackground.cs
@@ -16,7 +16,6 @@
#endregion
using System;
-using System.Drawing;
using System.Xml;
using System.Diagnostics;
using System.Collections.Generic;
@@ -172,36 +171,31 @@ namespace VocaluxeLib.Menu
CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID);
}
- public bool Draw()
+ public void Draw()
{
bool ok = false;
- if (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON &&
- CBase.Config.GetVideosToBackground() == EOffOn.TR_CONFIG_ON && CBase.BackgroundMusic.IsPlaying() && CBase.BackgroundMusic.SongHasVideo() &&
- CBase.BackgroundMusic.VideoEnabled() && !CBase.BackgroundMusic.IsDisabled())
+ if (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
{
- Pause();
- ok = _DrawBackgroundMusicVideo();
+ if (CBase.Config.GetVideosToBackground() == EOffOn.TR_CONFIG_ON && CBase.BackgroundMusic.IsPlaying() && CBase.BackgroundMusic.SongHasVideo() &&
+ CBase.BackgroundMusic.VideoEnabled())
+ {
+ Pause();
+ ok = _DrawBackgroundMusicVideo();
+ }
+ else
+ {
+ Resume();
+ ok = _DrawVideo();
+ }
}
- else if (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
- {
- Resume();
- ok = _DrawVideo();
- }
-
-
- if (_Theme.Type == EBackgroundTypes.SlideShow && _Theme.SlideShowTextures.Count > 0)
+ else if (_Theme.Type == EBackgroundTypes.SlideShow && _Theme.SlideShowTextures.Count > 0)
ok = _DrawSlideShow();
- if (!String.IsNullOrEmpty(_Theme.TextureName) &&
- (_Theme.Type == EBackgroundTypes.Texture ||
- (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF)))
+ if (!String.IsNullOrEmpty(_Theme.TextureName) && (_Theme.Type == EBackgroundTypes.Texture || !ok))
ok = _DrawTexture();
- if (_Theme.Type == EBackgroundTypes.Color || _Theme.Type == EBackgroundTypes.Texture && !ok ||
- (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF && !ok))
+ if (_Theme.Type == EBackgroundTypes.Color || !ok)
_DrawColor();
-
- return true;
}
public void UnloadTextures()
@@ -247,11 +241,14 @@ namespace VocaluxeLib.Menu
#endregion public
#region internal
+ private static SRectF _GetDrawRect()
+ {
+ return new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
+ }
+
private void _DrawColor()
{
- var bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
-
- CBase.Drawing.DrawColor(Color, bounds);
+ CBase.Drawing.DrawRect(Color, _GetDrawRect());
}
private bool _DrawTexture()
@@ -259,11 +256,7 @@ namespace VocaluxeLib.Menu
CTextureRef texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (texture != null)
{
- var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
- RectangleF rect;
- CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
-
- CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
+ CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop);
return true;
}
return false;
@@ -284,7 +277,7 @@ namespace VocaluxeLib.Menu
_SlideShowTimer.Restart();
if (_SlideShowCurrent + 1 < _SlideShowTextures.Count)
_SlideShowCurrent++;
- else if (_SlideShowCurrent != 0)
+ else
_SlideShowCurrent = 0;
}
@@ -293,11 +286,7 @@ namespace VocaluxeLib.Menu
if (texture == null)
return false;
- var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
- RectangleF rect;
- CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
-
- CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
+ CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop);
if (_SlideShowTimer.ElapsedMilliseconds >= CBase.Settings.GetSlideShowImageTime())
{
@@ -310,9 +299,9 @@ namespace VocaluxeLib.Menu
if (texture != null)
{
- float alpha = (_SlideShowTimer.ElapsedMilliseconds - CBase.Settings.GetSlideShowImageTime()) / CBase.Settings.GetSlideShowFadeTime();
- CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
- CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, (CBase.Settings.GetZFar() / 4) - 1), new SColorF(1, 1, 1, alpha));
+ SColorF color = texture.Color;
+ color.A = (_SlideShowTimer.ElapsedMilliseconds - CBase.Settings.GetSlideShowImageTime()) / CBase.Settings.GetSlideShowFadeTime();
+ CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop, color);
}
}
@@ -326,11 +315,7 @@ namespace VocaluxeLib.Menu
CTextureRef videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
if (videoTexture != null)
{
- var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
- RectangleF rect;
- CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
-
- CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
+ CBase.Drawing.DrawTexture(videoTexture, _GetDrawRect(), EAspect.Crop);
return true;
}
return false;
@@ -341,11 +326,7 @@ namespace VocaluxeLib.Menu
CTextureRef videoTexture = CBase.BackgroundMusic.GetVideoTexture();
if (videoTexture != null)
{
- var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
- RectangleF rect;
- CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
-
- CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
+ CBase.Drawing.DrawTexture(videoTexture, _GetDrawRect(), EAspect.Crop);
return true;
}
return false;
diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs
index 83bb74c0..a519ba8b 100644
--- a/VocaluxeLib/Menu/CEqualizer.cs
+++ b/VocaluxeLib/Menu/CEqualizer.cs
@@ -275,10 +275,10 @@ namespace VocaluxeLib.Menu
if (i == _MaxBar)
color = MaxColor;
- CBase.Drawing.DrawColor(color, bar);
+ CBase.Drawing.DrawRect(color, bar);
if (Reflection)
- CBase.Drawing.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight);
+ CBase.Drawing.DrawRectReflection(color, bar, ReflectionSpace, ReflectionHeight);
}
}
diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs
index 31861b76..9745933d 100644
--- a/VocaluxeLib/Menu/CStatic.cs
+++ b/VocaluxeLib/Menu/CStatic.cs
@@ -208,11 +208,11 @@ namespace VocaluxeLib.Menu
CBase.Drawing.DrawTextureReflection(texture, rect, color, ReflectionSpace, ReflectionHeight);
}
else
- CBase.Drawing.DrawColor(color, rect);
+ CBase.Drawing.DrawRect(color, rect);
}
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
- CBase.Drawing.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
+ CBase.Drawing.DrawRect(new SColorF(1f, 1f, 1f, 0.5f), rect);
}
public void UnloadTextures() {}
diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs
index 711cc930..129fb34e 100644
--- a/VocaluxeLib/Menu/CText.cs
+++ b/VocaluxeLib/Menu/CText.cs
@@ -475,7 +475,7 @@ namespace VocaluxeLib.Menu
CBase.Fonts.DrawTextReflection(_Text, Rect.H, Rect.X, Rect.Y, Z, color, ReflectionSpace, ReflectionHeight);
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
- CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(Rect.X, Rect.Y, Rect.W, Rect.H, Z));
+ CBase.Drawing.DrawRect(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(Rect.X, Rect.Y, Rect.W, Rect.H, Z));
}
public void Draw(float begin, float end)
@@ -494,7 +494,7 @@ namespace VocaluxeLib.Menu
}
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
- CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(X, Y, Rect.W, Rect.H, Z));
+ CBase.Drawing.DrawRect(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(X, Y, Rect.W, Rect.H, Z));
}
public void DrawRelative(float rx, float ry, float reflectionHeight = 0f, float reflectionSpace = 0f, float rectHeight = 0f)