/Source Code/PowerSong/GraphicRoutines.vb
Visual Basic | 25 lines | 13 code | 5 blank | 7 comment | 0 complexity | 0c840227158314c4edac02ae6161bb27 MD5 | raw file
- Imports System.Drawing.Drawing2D
-
- Module GraphicRoutines
-
- ''' <summary>
- ''' Resizes the given image to the given width and height, using interpolation.
- ''' </summary>
- ''' <param name="sourceImage">The image to resize.</param>
- ''' <param name="width">The width of the resulting image.</param>
- ''' <param name="height">The height of the resulting image.</param>
- ''' <returns>The resized image.</returns>
- Function Resize(ByVal sourceImage As Image, ByVal width As Integer, ByVal height As Integer) As Bitmap
-
- Dim Result As New Bitmap(width, height, Imaging.PixelFormat.Format24bppRgb)
- Dim G As Graphics = Graphics.FromImage(Result)
- G.InterpolationMode = InterpolationMode.HighQualityBicubic
- G.DrawImage(sourceImage, _
- New Rectangle(0, 0, width, height), _
- New Rectangle(0, 0, sourceImage.Width, sourceImage.Height), GraphicsUnit.Pixel)
- G.Dispose()
- Return Result
-
- End Function
-
- End Module