{"id":17176215,"url":"https://github.com/wanglin2/simulatecssbackgroundincanvas","last_synced_at":"2026-07-20T22:32:27.041Z","repository":{"id":112673127,"uuid":"595966344","full_name":"wanglin2/simulateCSSBackgroundInCanvas","owner":"wanglin2","description":"在canvas中模拟css的background相关样式","archived":false,"fork":false,"pushed_at":"2023-02-01T08:11:21.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T01:08:14.046Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wanglin2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-01T07:14:20.000Z","updated_at":"2023-03-03T09:19:46.000Z","dependencies_parsed_at":"2023-06-10T20:00:19.031Z","dependency_job_id":null,"html_url":"https://github.com/wanglin2/simulateCSSBackgroundInCanvas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wanglin2/simulateCSSBackgroundInCanvas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2FsimulateCSSBackgroundInCanvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2FsimulateCSSBackgroundInCanvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2FsimulateCSSBackgroundInCanvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2FsimulateCSSBackgroundInCanvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wanglin2","download_url":"https://codeload.github.com/wanglin2/simulateCSSBackgroundInCanvas/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wanglin2%2FsimulateCSSBackgroundInCanvas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35702321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"ssl_error","status_checked_at":"2026-07-20T02:08:09.736Z","response_time":111,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T23:59:34.377Z","updated_at":"2026-07-20T22:32:27.026Z","avatar_url":"https://github.com/wanglin2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simulateCSSBackgroundInCanvas\n\n在`canvas`中模拟`css`的`background-size`、`background-position`、`background-repeat`三个属性的部分效果。单位仅支持`px`、`%`。\n\n## 使用\n\n```js\nimport drawBackgroundImageToCanvas from './index.js'\n\nlet width = 500\nlet height = 500\nlet img = '/1.jpg'\nlet canvas = document.createElement('canvas')\ncanvas.width = width\ncanvas.height = height\ndrawBackgroundImageToCanvas(ctx, width, height, img, {\n  backgroundRepeat: 'repeat-y',\n  backgroundSize: '60%',\n  backgroundPosition: 'center center'\n}, (err) =\u003e {\n  if (err) {\n    // 失败\n  } else {\n    // 成功\n  }\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanglin2%2Fsimulatecssbackgroundincanvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwanglin2%2Fsimulatecssbackgroundincanvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwanglin2%2Fsimulatecssbackgroundincanvas/lists"}