canvas.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.adaptor = void 0;
  4. function adaptor(ctx) {
  5. // @ts-ignore
  6. return Object.assign(ctx, {
  7. setStrokeStyle: function (val) {
  8. ctx.strokeStyle = val;
  9. },
  10. setLineWidth: function (val) {
  11. ctx.lineWidth = val;
  12. },
  13. setLineCap: function (val) {
  14. ctx.lineCap = val;
  15. },
  16. setFillStyle: function (val) {
  17. ctx.fillStyle = val;
  18. },
  19. setFontSize: function (val) {
  20. ctx.font = String(val);
  21. },
  22. setGlobalAlpha: function (val) {
  23. ctx.globalAlpha = val;
  24. },
  25. setLineJoin: function (val) {
  26. ctx.lineJoin = val;
  27. },
  28. setTextAlign: function (val) {
  29. ctx.textAlign = val;
  30. },
  31. setMiterLimit: function (val) {
  32. ctx.miterLimit = val;
  33. },
  34. setShadow: function (offsetX, offsetY, blur, color) {
  35. ctx.shadowOffsetX = offsetX;
  36. ctx.shadowOffsetY = offsetY;
  37. ctx.shadowBlur = blur;
  38. ctx.shadowColor = color;
  39. },
  40. setTextBaseline: function (val) {
  41. ctx.textBaseline = val;
  42. },
  43. createCircularGradient: function () { },
  44. draw: function () { },
  45. });
  46. }
  47. exports.adaptor = adaptor;