aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GUI/PictureBox.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-07-04 17:57:29 -0400
committerMichael <[email protected]>2017-07-04 17:57:29 -0400
commit2adb8859edb95921e8f6d3cbb41fdc349825d6f8 (patch)
treeaa1780fe7f8e2c7ab759429aa53717d7a14ca7ef /ShiftOS.Frontend/GUI/PictureBox.cs
parent5515881e922de087f4e0f5db51ae681bcd7f70d6 (diff)
downloadshiftos_thereturn-2adb8859edb95921e8f6d3cbb41fdc349825d6f8.tar.gz
shiftos_thereturn-2adb8859edb95921e8f6d3cbb41fdc349825d6f8.tar.bz2
shiftos_thereturn-2adb8859edb95921e8f6d3cbb41fdc349825d6f8.zip
abandon system.drawing for anything other than text
Diffstat (limited to 'ShiftOS.Frontend/GUI/PictureBox.cs')
-rw-r--r--ShiftOS.Frontend/GUI/PictureBox.cs33
1 files changed, 2 insertions, 31 deletions
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