G
Guest
Hello Guys,
Iam working on a zoom in and out tool and here is the code iam using for it
//Method for zooming in
Bitmap bmpSource=new Bitmap(ImgBox.Image);
Bitmap bmpZoomed=new
Bitmap(bmpSource.Width*ZoomInFactor,bmpSource.Height*ZoomInFactor);
Graphics grZoom=Graphics.FromImage(bmpZoomed);
grZoom.InterpolationMode=InterpolationMode.HighQualityBilinear;
grZoom.DrawImage(bmpSource,0,0,bmpZoomed.Width+1,bmpZoomed.Height+1);
ImgBox.Image=bmpZoomed;
//Method for zooming Out
Bitmap bmpSource=new Bitmap(ImgBox.Image);
Bitmap bmpZoomed=new
Bitmap(bmpSource.Width/ZoomInFactor,bmpSource.Height/ZoomInFactor);
Graphics grZoom=Graphics.FromImage(bmpZoomed);
grZoom.InterpolationMode=InterpolationMode.HighQualityBilinear;
grZoom.DrawImage(bmpSource,0,0,bmpZoomed.Width+1,bmpZoomed.Height+1);
ImgBox.Image=bmpZoomed;
It is working fine but the picture resulution is lost if we do symultaneous
multiple zoomin and zoom out..Specially if you zoomout first and then zoom
in...
Any ideas on how to retain the pixel configuration ....
Any valuable thought should help
Cheerz,
Ajay
Iam working on a zoom in and out tool and here is the code iam using for it
//Method for zooming in
Bitmap bmpSource=new Bitmap(ImgBox.Image);
Bitmap bmpZoomed=new
Bitmap(bmpSource.Width*ZoomInFactor,bmpSource.Height*ZoomInFactor);
Graphics grZoom=Graphics.FromImage(bmpZoomed);
grZoom.InterpolationMode=InterpolationMode.HighQualityBilinear;
grZoom.DrawImage(bmpSource,0,0,bmpZoomed.Width+1,bmpZoomed.Height+1);
ImgBox.Image=bmpZoomed;
//Method for zooming Out
Bitmap bmpSource=new Bitmap(ImgBox.Image);
Bitmap bmpZoomed=new
Bitmap(bmpSource.Width/ZoomInFactor,bmpSource.Height/ZoomInFactor);
Graphics grZoom=Graphics.FromImage(bmpZoomed);
grZoom.InterpolationMode=InterpolationMode.HighQualityBilinear;
grZoom.DrawImage(bmpSource,0,0,bmpZoomed.Width+1,bmpZoomed.Height+1);
ImgBox.Image=bmpZoomed;
It is working fine but the picture resulution is lost if we do symultaneous
multiple zoomin and zoom out..Specially if you zoomout first and then zoom
in...
Any ideas on how to retain the pixel configuration ....
Any valuable thought should help
Cheerz,
Ajay