diff options
| -rw-r--r-- | ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs | 10 | ||||
| -rw-r--r-- | ShiftOS.Frontend/Properties/Resources.resx | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs index d8e447c..8e83324 100644 --- a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs +++ b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs @@ -126,7 +126,7 @@ namespace ShiftOS.Frontend.GraphicsSubsystem public Vector2 MeasureString(string text, System.Drawing.Font font, int wrapWidth = int.MaxValue) { - using(var gfx = System.Drawing.Graphics.FromImage(new System.Drawing.Bitmap(1, 1))) + using(var gfx = System.Drawing.Graphics.FromHwnd(IntPtr.Zero)) { var s = gfx.SmartMeasureString(text, font, wrapWidth); return new Vector2((float)Math.Ceiling(s.Width), (float)Math.Ceiling(s.Height)); @@ -154,14 +154,20 @@ namespace ShiftOS.Frontend.GraphicsSubsystem var sFormat = System.Drawing.StringFormat.GenericTypographic; sFormat.FormatFlags |= System.Drawing.StringFormatFlags.NoClip; + /*gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; + gfx.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; + gfx.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;*/ gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; - gfx.DrawString(text, font, System.Drawing.Brushes.White, new System.Drawing.RectangleF(0, 0, bmp.Width, bmp.Height), sFormat); + gfx.DrawString(text, font, System.Drawing.Brushes.Black, new System.Drawing.RectangleF(0, 0, bmp.Width, bmp.Height), sFormat); } 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); + for (int i = 0; i < data.Length; i++) + if (i % 4 != 3) + data[i] = (byte)(255 - data[i]); // invert colours var tex2 = new Texture2D(_graphicsDevice, bmp.Width, bmp.Height); tex2.SetData<byte>(data); fontcache = new TextCache(); diff --git a/ShiftOS.Frontend/Properties/Resources.resx b/ShiftOS.Frontend/Properties/Resources.resx index 0676c58..5a92cc4 100644 --- a/ShiftOS.Frontend/Properties/Resources.resx +++ b/ShiftOS.Frontend/Properties/Resources.resx @@ -149,6 +149,6 @@ <value>..\Resources\Ports.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> </data> <data name="Exploits" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\resources\exploits.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> + <value>..\Resources\Exploits.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> </data> </root>
\ No newline at end of file |
