I have tried a few different methods for scaling an image down but all
seem a bit on the slow side. Is there any way i can make this scaling
faster.......
Here is how i do it now.
To display my image at 1:2 zoom i have the following
xScaleFactor = 0.5
yScaleFactor = 0.5
public static Bitmap ScaleBitmap(Bit map inputBmp, double xScaleFactor,
double yScaleFactor) {
//Create a new bitmap object based on the input
Bitmap newBmp = new Bitmap((int)(in putBmp.Size.Wid th*xScaleFactor ),
(int)(inputBmp. Size.Height*ySc aleFactor),
PixelFormat.For mat32bppArgb);//Graphics.FromIm age doesn't
like Indexed pixel format
//Create a graphics object attached to the new bitmap
Graphics newBmpGraphics = Graphics.FromIm age(newBmp);
newBmpGraphics. InterpolationMo de = InterpolationMo de.HighQualityB icubic;
newBmpGraphics. ScaleTransform( (float)xScaleFa ctor, (float)yScaleFa ctor);
Rectangle drawRect = new Rectangle(0, 0, inputBmp.Size.W idth,
inputBmp.Size.H eight);
newBmpGraphics. DrawImage(input Bmp, drawRect, drawRect,
GraphicsUnit.Pi xel);
newBmpGraphics. Dispose();
return ConvertBitmap(n ewBmp, inputBmp.RawFor mat);
}
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!