aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GraphicsSubsystem
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-07-05 22:24:17 -0400
committerMichael <[email protected]>2017-07-05 22:24:17 -0400
commit38774ba7930f9d6fa2111c8b71f1056125ab75b5 (patch)
tree68ded6b8c8b848b517dff872bb04d9311fbb3e98 /ShiftOS.Frontend/GraphicsSubsystem
parentde9bc8567b268e9659d174f65ce7dc23dff6fafe (diff)
downloadshiftos_thereturn-38774ba7930f9d6fa2111c8b71f1056125ab75b5.tar.gz
shiftos_thereturn-38774ba7930f9d6fa2111c8b71f1056125ab75b5.tar.bz2
shiftos_thereturn-38774ba7930f9d6fa2111c8b71f1056125ab75b5.zip
all the work I've done for the day
Diffstat (limited to 'ShiftOS.Frontend/GraphicsSubsystem')
-rw-r--r--ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs26
-rw-r--r--ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs11
2 files changed, 23 insertions, 14 deletions
diff --git a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
index 1ab45db..867d18a 100644
--- a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
+++ b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
@@ -148,33 +148,35 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
measure = MeasureString(text, font);
else
measure = MeasureString(text, font, wrapWidth);
- using(var bmp = new System.Drawing.Bitmap((int)measure.X, (int)measure.Y))
+ using (var bmp = new System.Drawing.Bitmap((int)measure.X, (int)measure.Y))
{
- using(var gfx = System.Drawing.Graphics.FromImage(bmp))
+ using (var gfx = System.Drawing.Graphics.FromImage(bmp))
{
var textformat = new System.Drawing.StringFormat(System.Drawing.StringFormat.GenericTypographic);
textformat.FormatFlags = System.Drawing.StringFormatFlags.MeasureTrailingSpaces;
textformat.Trimming = System.Drawing.StringTrimming.None;
textformat.FormatFlags |= System.Drawing.StringFormatFlags.NoClip;
- gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
+ gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
gfx.DrawString(text, font, new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)), 0, 0, textformat);
}
var lck = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var data = new byte[Math.Abs(lck.Stride) * lck.Height];
System.Runtime.InteropServices.Marshal.Copy(lck.Scan0, data, 0, data.Length);
bmp.UnlockBits(lck);
- var tex2 = new Texture2D(_graphicsDevice, bmp.Width, bmp.Height);
- for(int i = 0; i < data.Length; i += 4)
+ using (var tex2 = new Texture2D(_graphicsDevice, bmp.Width, bmp.Height))
{
- byte r = data[i];
- byte b = data[i + 2];
- data[i] = b;
- data[i + 2] = r;
+ for (int i = 0; i < data.Length; i += 4)
+ {
+ byte r = data[i];
+ byte b = data[i + 2];
+ data[i] = b;
+ data[i + 2] = r;
+ }
+
+ tex2.SetData<byte>(data);
+ _spritebatch.Draw(tex2, new Rectangle(x, y, bmp.Width, bmp.Height), Color.White);
}
-
- tex2.SetData<byte>(data);
- _spritebatch.Draw(tex2, new Rectangle(x, y, bmp.Width, bmp.Height), Color.White);
}
}
diff --git a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs
index 1157070..d8fdf2e 100644
--- a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs
+++ b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs
@@ -59,7 +59,7 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
{
for (int i = 5; i > 0; i--)
{
- batch.Draw(_target, new Rectangle(ctrl.X + i, ctrl.Y + i, ctrl.Width, ctrl.Height), new Color(Color.Black, 255 / (i * 2)));
+ batch.Draw(_target, new Rectangle(ctrl.X - i, ctrl.Y - i, ctrl.Width+(i*2), ctrl.Height+(i*2)), new Color(Color.Black, 255 / (i * 2)));
}
}
@@ -69,7 +69,7 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
}
public static void SendToBack(Control ctrl)
- {
+ {
topLevels.Remove(ctrl);
topLevels.Insert(0, ctrl);
}
@@ -171,6 +171,10 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
{
byte r = data[i];
byte b = data[i + 2];
+ if (r == 1 && b == 1 && data[i + 1] == 1)
+ {
+ data[i + 3] = 0;
+ }
data[i] = b;
data[i + 2] = r;
}
@@ -187,6 +191,9 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
tex2.SetData<byte>(new[] { color.B, color.G, color.R, color.A });
SkinTextures.Add(colorfield.Name, tex2);
}
+
+
+
}