From 4927557c89edfebbe0ef76a2a73464b7b8d1565c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= Date: Wed, 6 Apr 2016 19:38:11 +0200 Subject: [PATCH] C export: Fix rgb ordering in uint32_t --- .../controller/settings/exportimage/CExportController.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/controller/settings/exportimage/CExportController.js b/src/js/controller/settings/exportimage/CExportController.js index ffaef26..d276448 100644 --- a/src/js/controller/settings/exportimage/CExportController.js +++ b/src/js/controller/settings/exportimage/CExportController.js @@ -49,7 +49,7 @@ frameStr += '{\n'; for (var j = 0; j < pix.length; j += 4) { - frameStr += this.rgbToCHex(pix[j], pix[j + 1], pix[j + 2]); + frameStr += this.rgbToCHex(pix[j], pix[j + 1], pix[j + 2], pix[j + 3]); if (j != pix.length - 4) { frameStr += ', '; } @@ -74,11 +74,12 @@ return this.piskelController.getPiskel().getDescriptor().name; }; - ns.CExportController.prototype.rgbToCHex = function (r, g, b) { + ns.CExportController.prototype.rgbToCHex = function (r, g, b, a) { var hexStr = '0x'; - hexStr += ('00' + r.toString(16)).substr(-2); - hexStr += ('00' + g.toString(16)).substr(-2); + hexStr += ('00' + a.toString(16)).substr(-2); hexStr += ('00' + b.toString(16)).substr(-2); + hexStr += ('00' + g.toString(16)).substr(-2); + hexStr += ('00' + r.toString(16)).substr(-2); return hexStr; };