jsbar.js 729 B

12345678910111213141516171819202122232425262728293031323334
  1. import {JsBarcode} from "../lib/JsBarcode/JsBarcode.js"
  2. import {CanvasTGA} from "../lib/CanvasTGA.js";
  3. let __$$app$$__ = __$$hmAppManager$$__.currentApp;
  4. let __$$module$$__ = __$$app$$__.current;
  5. __$$module$$__.module = DeviceRuntimeCore.Page({
  6. onInit() {
  7. const canvas = new CanvasTGA(192, 490);
  8. canvas.addPalette({
  9. "#ffffff": 0xFFFFFF,
  10. "#000000": 0x0
  11. })
  12. JsBarcode(canvas, "hello", {
  13. format: "code39"
  14. });
  15. CanvasTGA.rotate90(canvas).saveAsset("1.png");
  16. hmUI.createWidget(hmUI.widget.FILL_RECT, {
  17. x: 0,
  18. y: 0,
  19. w: 192,
  20. h: 490,
  21. color: 0xffffff
  22. })
  23. hmUI.createWidget(hmUI.widget.IMG, {
  24. x: 30,
  25. y: 96,
  26. src: "1.png"
  27. })
  28. }
  29. });