utils.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import type { CrossOrigin, ERROR_LEVEL_MAPPED_TYPE, ErrorCorrectionLevel, Excavation, ImageSettings } from './interface';
  2. export declare const ERROR_LEVEL_MAP: ERROR_LEVEL_MAPPED_TYPE;
  3. export declare const DEFAULT_SIZE = 128;
  4. export declare const DEFAULT_LEVEL: ErrorCorrectionLevel;
  5. export declare const DEFAULT_BACKGROUND_COLOR = "#FFFFFF";
  6. export declare const DEFAULT_FRONT_COLOR = "#000000";
  7. export declare const DEFAULT_NEED_MARGIN = false;
  8. export declare const DEFAULT_MINVERSION = 1;
  9. export declare const SPEC_MARGIN_SIZE = 4;
  10. export declare const DEFAULT_MARGIN_SIZE = 0;
  11. export declare const DEFAULT_IMG_SCALE = 0.1;
  12. /**
  13. * Generate a path string from modules
  14. * @param modules
  15. * @param margin
  16. * @returns
  17. */
  18. export declare const generatePath: (modules: boolean[][], margin?: number) => string;
  19. /**
  20. * Excavate modules
  21. * @param modules
  22. * @param excavation
  23. * @returns
  24. */
  25. export declare const excavateModules: (modules: boolean[][], excavation: Excavation) => boolean[][];
  26. /**
  27. * Get image settings
  28. * @param cells The modules of the QR code
  29. * @param size The size of the QR code
  30. * @param margin
  31. * @param imageSettings
  32. * @returns
  33. */
  34. export declare const getImageSettings: (cells: boolean[][], size: number, margin: number, imageSettings?: ImageSettings) => {
  35. x: number;
  36. y: number;
  37. h: number;
  38. w: number;
  39. excavation: Excavation | null;
  40. opacity: number;
  41. crossOrigin: CrossOrigin;
  42. };
  43. /**
  44. * Get margin size
  45. * @param needMargin Whether need margin
  46. * @param marginSize Custom margin size
  47. * @returns
  48. */
  49. export declare const getMarginSize: (needMargin: boolean, marginSize?: number) => number;
  50. /**
  51. * Check if Path2D is supported
  52. */
  53. export declare const isSupportPath2d: boolean;