canvas.js 1.3 KB

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