<commit_before><!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>canvas-starter</title>
</head>
<body>
  <canvas id="canvas" style="border: 1px solid #000; display: block; margin: 50px auto;">
    呀，你的浏览器不支持啊，要不换个？
  </canvas>
</body>
<script>
  window.onload = function () {
    const canvas = document.getElementById('canvas')
    canvas.width = 800
    canvas.height = 600
    const context = canvas.getContext('2d')

    context.beginPath()
    context.moveTo(300, 100)
    context.lineTo(500, 100)
    context.lineTo(500, 300)
    context.lineTo(300, 300)
    context.lineTo(300, 100)
    context.closePath()
    
    context.fillStyle = "yellow"
    context.lineWidth = 5
    context.strokeStyle = 'blue'

    context.fill()
    context.stroke()
  }<commit_msg>新增函数在 canvas 的应用<commit_after><!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>canvas-starter</title>
</head>
<body>
  <canvas id="canvas" style="border: 1px solid #000; display: block; margin: 50px auto;">
    呀，你的浏览器不支持啊，要不换个？
  </canvas>
</body>
<script>
  window.onload = function () {
    const canvas = document.getElementById('canvas')
    canvas.width = 800
    canvas.height = 600
    const context = canvas.getContext('2d')

    drawRect(context, 200, 100, 100, 100, 'yellow', 5, 'blue')
  }

  const drawRect = (cxt, x, y, width, height, fillColor, borderWidth, borderColor) => {
    cxt.beginPath()
    cxt.moveTo(x, y)
    cxt.lineTo(x + width, y)
    cxt.lineTo(x + width, y + height)
    cxt.lineTo(x, y + height)
    cxt.lineTo(x, y)
    cxt.closePath()

    cxt.lineWidth = borderWidth
    cxt.strokeStyle = borderColor
    cxt.fillStyle = fillColor

    cxt.fill()
    cxt.stroke()
  }
{'fraction_non_alphanumeric': 0.16135558927668184, 'fraction_numerical': 0.03844208396560445, 'mean_word_length': 3.643192488262911, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '302272', 'n_tokens_mistral': 803, 'n_tokens_neox': 732, 'n_words': 152}