@@ -45,20 +45,27 @@ static int CalcCoordY(int width, int word, int idx)
4545 {
4646 return idx / width * word ;
4747 }
48- static void GenImages ( String str , String imageFile , List < Image > images )
48+
49+ static Image DrawImage ( Image img , String s , int i )
4950 {
5051 int x , y ;
51- Image img ;
52- img = Image . FromFile ( imageFile ) ;
5352 Graphics g = Graphics . FromImage ( img ) ;
53+ x = CalcCoordX ( 6 , 40 , i ) ;
54+ y = CalcCoordY ( 6 , 40 , i ) ;
55+ DrawYellowBox ( x , y , g ) ;
56+ DrawWord ( x , y , g , s . Substring ( i , 1 ) ) ;
57+ return img ;
58+ }
59+ static void GenImages ( String str , String imageFile , List < Image > images )
60+ {
61+
62+ Image imgSrc ;
63+ imgSrc = Image . FromFile ( imageFile ) ;
64+
5465 for ( int i = 0 ; i < str . Length ; ++ i )
5566 {
56- x = CalcCoordX ( 6 , 40 , i ) ;
57- y = CalcCoordY ( 6 , 40 , i ) ;
58- DrawYellowBox ( x , y , g ) ;
59- DrawWord ( x , y , g , str . Substring ( i , 1 ) ) ;
60- images . Add ( ( Image ) img . Clone ( ) ) ;
61- g = Graphics . FromImage ( img ) ;
67+ // images.Add((Image)DrawImage((Image)imgSrc.Clone(), str, i).Clone());
68+ images . Add ( ( Image ) DrawImage ( imgSrc , str , i ) . Clone ( ) ) ;
6269 }
6370 }
6471
0 commit comments