From 2adb8859edb95921e8f6d3cbb41fdc349825d6f8 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 4 Jul 2017 17:57:29 -0400 Subject: abandon system.drawing for anything other than text --- ShiftOS.Frontend/GUI/PictureBox.cs | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) (limited to 'ShiftOS.Frontend/GUI/PictureBox.cs') diff --git a/ShiftOS.Frontend/GUI/PictureBox.cs b/ShiftOS.Frontend/GUI/PictureBox.cs index 9a234d4..91735aa 100644 --- a/ShiftOS.Frontend/GUI/PictureBox.cs +++ b/ShiftOS.Frontend/GUI/PictureBox.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading.Tasks; using ShiftOS.Engine; using System.Drawing.Imaging; +using ShiftOS.Frontend.GraphicsSubsystem; namespace ShiftOS.Frontend.GUI { @@ -50,38 +51,8 @@ namespace ShiftOS.Frontend.GUI } } - protected override void OnPaint(Graphics gfx) + protected override void OnPaint(GraphicsContext gfx) { - if(img != null) - switch (_layout) - { - case ImageLayout.None: - //Just draw the image. - gfx.DrawImage(img, new PointF(0, 0)); - break; - case ImageLayout.Stretch: - //Stretch the image, with no regard for aspect ratio. - var stretched = ResizeImage(img, Width, Height); - gfx.DrawImage(stretched, 0, 0); - break; - case ImageLayout.Fit: - //Resize image to fit the control but keep aspect ratio. - var fitted = FixedSize(img, Width, Height); - gfx.DrawImage(fitted, 0, 0); - break; - case ImageLayout.Tile: - //Keep original size but tile the image. - - for(int x = 0; x < Width; x += img.Width) - { - for (int y = 0; y < Height; y += img.Height) - { - gfx.DrawImage(img, x, y); - } - } - - break; - } } //Again, thanks StackOverflow -- cgit v1.2.3