aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index c103c5c..c5c4ab3 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -30,6 +30,8 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Diagnostics; 32using System.Diagnostics;
33using System.Drawing;
34using System.Drawing.Imaging;
33using System.Globalization; 35using System.Globalization;
34using System.IO; 36using System.IO;
35using System.IO.Compression; 37using System.IO.Compression;
@@ -3442,6 +3444,34 @@ namespace OpenSim.Framework
3442 m_log.ErrorFormat("{0} Failed XML ({1} bytes) = {2}", message, length, xml); 3444 m_log.ErrorFormat("{0} Failed XML ({1} bytes) = {2}", message, length, xml);
3443 } 3445 }
3444 3446
3447 /// <summary>
3448 /// Performs a high quality image resize
3449 /// </summary>
3450 /// <param name="image">Image to resize</param>
3451 /// <param name="width">New width</param>
3452 /// <param name="height">New height</param>
3453 /// <returns>Resized image</returns>
3454 public static Bitmap ResizeImageSolid(Image image, int width, int height)
3455 {
3456 Bitmap result = new Bitmap(width, height, PixelFormat.Format24bppRgb);
3457
3458 using (ImageAttributes atrib = new ImageAttributes())
3459 using (Graphics graphics = Graphics.FromImage(result))
3460 {
3461 atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
3462 atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
3463 graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
3464 graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
3465 graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
3466 graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
3467
3468 graphics.DrawImage(image,new Rectangle(0,0, result.Width, result.Height),
3469 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, atrib);
3470 }
3471
3472 return result;
3473 }
3474
3445 } 3475 }
3446 3476
3447/* don't like this code 3477/* don't like this code
@@ -3606,5 +3636,6 @@ namespace OpenSim.Framework
3606 { 3636 {
3607 rng.GetBytes(buff); 3637 rng.GetBytes(buff);
3608 } 3638 }
3639
3609 } 3640 }
3610} 3641}