File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
zxing-android-embedded/src/com/journeyapps/barcodescanner Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1919 * Licensed under the Apache License, Version 2.0.
2020 */
2121public class BarcodeEncoder {
22- private static final int WHITE = 0xFFFFFFFF ;
23- private static final int BLACK = 0xFF000000 ;
22+ private int bgColor = 0xFFFFFFFF ;
23+ private int fgColor = 0xFF000000 ;
2424
2525
2626 public BarcodeEncoder () {
2727 }
2828
29+ public void setBackgroundColor (int bgColor ) {
30+ this .bgColor = bgColor ;
31+ }
32+
33+ public void setForegroundColor (int fgColor ) {
34+ this .fgColor = fgColor ;
35+ }
36+
2937 public Bitmap createBitmap (BitMatrix matrix ) {
3038 int width = matrix .getWidth ();
3139 int height = matrix .getHeight ();
3240 int [] pixels = new int [width * height ];
3341 for (int y = 0 ; y < height ; y ++) {
3442 int offset = y * width ;
3543 for (int x = 0 ; x < width ; x ++) {
36- pixels [offset + x ] = matrix .get (x , y ) ? BLACK : WHITE ;
44+ pixels [offset + x ] = matrix .get (x , y ) ? fgColor : bgColor ;
3745 }
3846 }
3947
You can’t perform that action at this time.
0 commit comments