Separated Encoder and DrawBarcode code from mainWindow.