-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wangsuyan
committed
Oct 31, 2021
1 parent
483f96e
commit 98036b5
Showing
4 changed files
with
127 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @author 素燕(我有个公众号:素燕) | ||
* @description data 值 | ||
*/ | ||
|
||
(function() { | ||
// safari 画布有最大的宽度限制 | ||
const parentEl = document.getElementById('canvas-wrap'); | ||
|
||
const canvasEl = document.createElement('canvas'); | ||
canvasEl.width = 32; | ||
canvasEl.height = 32; | ||
canvasEl.style.border = '1px solid red'; | ||
parentEl.appendChild(canvasEl); | ||
|
||
const ctx = canvasEl.getContext('2d') as CanvasRenderingContext2D; | ||
ctx.textBaseline = 'top'; | ||
ctx.font = `32px sans-serif`; | ||
ctx.fillStyle = 'rgba(12, 200, 100, 1)'; | ||
ctx.fillText('S', 0, 0); | ||
ctx.fillStyle = 'rgba(90, 10, 180, 1)'; | ||
ctx.fillText('Y', 0, 0); | ||
|
||
let data = ctx.getImageData(0, 0, canvasEl.width, canvasEl.height); | ||
console.log('data = ', data); | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters