@@ -855,7 +855,48 @@ public virtual void DrawImage(Image image, int x, int y)
855855 }
856856 }
857857 }
858-
858+
859+ private int [ ] scaleImage ( Image image , int newWidth , int newHeight )
860+ {
861+ int [ ] pixels = image . rawData ;
862+ int w1 = ( int ) image . Width ;
863+ int h1 = ( int ) image . Height ;
864+ int [ ] temp = new int [ newWidth * newHeight ] ;
865+ int x_ratio = ( int ) ( ( w1 << 16 ) / newWidth ) + 1 ;
866+ int y_ratio = ( int ) ( ( h1 << 16 ) / newHeight ) + 1 ;
867+ int x2 , y2 ;
868+ for ( int i = 0 ; i < newHeight ; i ++ )
869+ {
870+ for ( int j = 0 ; j < newWidth ; j ++ )
871+ {
872+ x2 = ( ( j * x_ratio ) >> 16 ) ;
873+ y2 = ( ( i * y_ratio ) >> 16 ) ;
874+ temp [ ( i * newWidth ) + j ] = pixels [ ( y2 * w1 ) + x2 ] ;
875+ }
876+ }
877+ return temp ;
878+ }
879+ /// <summary>
880+ /// Draw a Scaled Bitmap.
881+ /// </summary>
882+ /// <param name="image">Image to Scale.</param>
883+ /// <param name="x">X coordinate.</param>
884+ /// <param name="y">Y coordinate.</param>
885+ /// <param name="w">Desired Width.</param>
886+ /// <param name="h">Desired Height.</param>
887+ public virtual void DrawImage ( Image image , int x , int y , int w , int h )
888+ {
889+ int [ ] pixels = scaleImage ( image , w , h ) ;
890+ for ( int _x = 0 ; _x < w ; _x ++ )
891+ {
892+ for ( int _y = 0 ; _y < h ; _y ++ )
893+ {
894+ Global . mDebugger . SendInternal ( pixels [ _x + _y * w ] ) ;
895+ DrawPoint ( new Pen ( Color . FromArgb ( pixels [ _x + _y * w ] ) ) , x + _x , y + _y ) ;
896+ }
897+ }
898+ }
899+
859900 /// <summary>
860901 /// Draw image with alpha channel.
861902 /// </summary>
0 commit comments