@autorunify/capacitor-bleprinter 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -241,7 +241,11 @@ class BlePrinterPlugin : Plugin {
|
|
|
241
241
|
val imageData = call.getObject("imageData")
|
|
242
242
|
?: return@launch call.reject("imageData is required")
|
|
243
243
|
|
|
244
|
-
val colors = IntArray(
|
|
244
|
+
val colors = IntArray(width * height)
|
|
245
|
+
var colorConfig = Bitmap.Config.ARGB_8888
|
|
246
|
+
|
|
247
|
+
val colorsType = imageData.length() / (width * height)
|
|
248
|
+
if (colorsType != 4) return@launch call.reject("imageData type not Uint8ClampedArray")
|
|
245
249
|
|
|
246
250
|
for (i in 0..<colors.size) {
|
|
247
251
|
val R = imageData.getInt((i * 4 + 0).toString())
|
|
@@ -258,9 +262,9 @@ class BlePrinterPlugin : Plugin {
|
|
|
258
262
|
colors[i] = color
|
|
259
263
|
}
|
|
260
264
|
|
|
261
|
-
async.on(call,PRINTER_PRINT_FINISHED)
|
|
265
|
+
async.on(call, PRINTER_PRINT_FINISHED)
|
|
262
266
|
printer!!.printImage(
|
|
263
|
-
Bitmap.createBitmap(colors, width, height,
|
|
267
|
+
Bitmap.createBitmap(colors, width, height, colorConfig),
|
|
264
268
|
width,
|
|
265
269
|
height
|
|
266
270
|
)
|