Improve background drawing

Don't convert to RectangleF for rescaling
Add function for colored fitting of a texture in bounds
Add DrawLine in IDrawing
This commit is contained in:
Flamefire committed 2014-09-24 16:36:18 +02:00
1 parent 5f139467ea
commit db4096d57f
10 files changed
+77 -70

No files matched your search

+14 -2
View File
@@ -209,7 +209,7 @@ namespace Vocaluxe.Base
/// </summary>
/// <param name="texturePath">Full path to the image file</param>
/// <returns>Reference to texture</returns>
public static CTextureRef EnqueueTexture(String texturePath)
public static CTextureRef EnqueueTexture(String texturePath)
{
return _Draw.EnqueueTexture(texturePath);
}
@@ -399,13 +399,25 @@ namespace Vocaluxe.Base
/// <param name="bounds">Where to draw the texture</param>
/// <param name="aspect">How to fit a texture in the bounds if the size differs</param>
public static void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect)
{
DrawTexture(textureRef, bounds, aspect, textureRef.Color);
}
/// <summary>
/// Draws a texture fitting it within the given color and bounds with the method specified by aspect
/// </summary>
/// <param name="textureRef"></param>
/// <param name="bounds">Where to draw the texture</param>
/// <param name="aspect">How to fit a texture in the bounds if the size differs</param>
/// <param name="color">Color to use</param>
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);
}
/// <summary>
+17 -2
View File
@@ -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);
}
+1 -4
View File
@@ -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()
+3 -2
View File
@@ -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;
}
}
+1 -3
View File
@@ -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();