-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayHandeler.cs
32 lines (31 loc) · 985 Bytes
/
DisplayHandeler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FaceRecognitionLDA
{
/// <summary>
/// Provides basic display methods for front end
/// </summary>
class DisplayHandeler
{
/// <summary>
/// Resizes a Bitmap to fit a certain component.
/// </summary>
/// <param name="bmp"> Bitmap to be resized.</param>
/// <param name="width"> Width of the component. </param>
/// <param name="height"> Height of the component. </param>
/// <returns></returns>
public static Bitmap ResizeBitmap(Bitmap bmp, int width, int height)
{
Bitmap result = new Bitmap(width, height);
using(Graphics g = Graphics.FromImage(result))
{
g.DrawImage(bmp, 0, 0, width, height);
}
return result;
}
}
}