@@ -102,7 +102,7 @@ private Color color_from556(int pixel)
102102#endregion
103103
104104#region Image2Code
105- private String CodeFromImage_1bpp ( Image image , bool horisontal = false )
105+ private String ImageToCode_1bpp ( Image image , bool horisontal = false )
106106 {
107107 String result = "uint8_t image = {" + Environment . NewLine + "\t " ;
108108 int addW = 0 ;
@@ -139,7 +139,7 @@ private String CodeFromImage_1bpp(Image image, bool horisontal = false)
139139 {
140140 for ( int x = 0 ; x < bmp . Width ; x ++ )
141141 {
142- for ( int tmpY = 0 ; tmpY < ( ( horisontal ) ? 1 : 8 ) ; tmpY ++ )
142+ for ( int tmpY = 7 ; tmpY >= ( ( horisontal ) ? 7 : 0 ) ; tmpY -- )
143143 {
144144 pixelColor = bmp . GetPixel ( x , ( ( horisontal ) ? y : y + tmpY ) ) ;
145145
@@ -176,7 +176,7 @@ private String CodeFromImage_1bpp(Image image, bool horisontal = false)
176176 return result ;
177177 }
178178
179- private string CodeFromImage ( TransformColorFormats format )
179+ private string ImageToCode ( TransformColorFormats format )
180180 {
181181 StringBuilder result = new StringBuilder ( ) ;
182182 string codeFormat = "" ;
@@ -270,15 +270,15 @@ private void ImageToCode(object sender, DoWorkEventArgs e)
270270 switch ( e . Argument )
271271 {
272272 case TransformColorFormats . Mono_1bpp_H :
273- e . Result = CodeFromImage_1bpp ( imageBox . Image , true ) ;
273+ e . Result = ImageToCode_1bpp ( imageBox . Image , true ) ;
274274 break ;
275275 case TransformColorFormats . Mono_1bpp_V :
276- e . Result = CodeFromImage_1bpp ( imageBox . Image , false ) ;
276+ e . Result = ImageToCode_1bpp ( imageBox . Image , false ) ;
277277 break ;
278278 case TransformColorFormats . RGB_332 :
279279 case TransformColorFormats . RGB_444 :
280280 case TransformColorFormats . RGB_565 :
281- e . Result = CodeFromImage ( ( TransformColorFormats ) e . Argument ) ;
281+ e . Result = ImageToCode ( ( TransformColorFormats ) e . Argument ) ;
282282 break ;
283283 default :
284284 MessageBox . Show ( "Sorry, unsupported." ) ;
@@ -361,7 +361,7 @@ private void CodeToImage(object sender, DoWorkEventArgs e)
361361 case TransformColorFormats . Mono_1bpp_V :
362362 for ( int offset = 7 ; offset >= 0 ; offset -- )
363363 {
364- result . SetPixel ( x , y + ( - offset + 7 ) , ( ( pixelColor & ( 1 << offset ) ) > 0 ) ? Color . Black : Color . White ) ;
364+ result . SetPixel ( x , y + offset , ( ( pixelColor & ( 1 << offset ) ) > 0 ) ? Color . Black : Color . White ) ;
365365 }
366366 break ;
367367 case TransformColorFormats . RGB_332 : // RRRG GGBB
0 commit comments