Compare commits

...

21 Commits

14 changed files with 805 additions and 99 deletions

View File

@@ -401,7 +401,7 @@ darkmode:
end: end:
# Show scroll percent in scroll-to-top button # Show scroll percent in scroll-to-top button
rightside_scroll_percent: false rightside_scroll_percent: true
# Don't modify the following settings unless you know how they work # Don't modify the following settings unless you know how they work
# Choose: readmode,translate,darkmode,hideAside,toc,chat,comment # Choose: readmode,translate,darkmode,hideAside,toc,chat,comment
@@ -447,9 +447,9 @@ wordcount:
# Busuanzi count for PV / UV in site # Busuanzi count for PV / UV in site
busuanzi: busuanzi:
site_uv: true site_uv: false
site_pv: true site_pv: false
page_pv: true page_pv: false
# -------------------------------------- # --------------------------------------
# Math # Math
@@ -544,9 +544,9 @@ comments:
# If you set it to true, the comment count will be invalid # If you set it to true, the comment count will be invalid
lazyload: false lazyload: false
# Display comment count in post's top_img # Display comment count in post's top_img
count: false count: true
# Display comment count in Home Page # Display comment count in Home Page
card_post_count: false card_post_count: true
# Disqus # Disqus
# https://disqus.com/ # https://disqus.com/
@@ -1069,19 +1069,16 @@ inject:
bottom: bottom:
# - <script src="xxxx"></script> # - <script src="xxxx"></script>
- <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
- <script src="/js/random.js"></script> - <script src="/js/random.js"></script>
- <script src="/js/shuoshuoshouye.js"></script> - <script src="/js/shuoshuoshouye.js"></script>
- <script src="/js/ai-summary.js"></script> - <script src="/js/ai-summary.js"></script>
- <script src="/js/typesense-search.js"></script> - <script src="/js/search/typesense-search.js"></script>
- <script src="/js/statistic.js"></script>
- <script src="/js/footer.js" - <script src="/js/footer.js"
- <script src="https://code.jquery.com/jquery-4.0.0.js"></script>
- <script src="https://cdn.jsdmirror.com/npm/echarts@4.9.0/dist/echarts.min.js"></script> - <script src="https://cdn.jsdmirror.com/npm/echarts@4.9.0/dist/echarts.min.js"></script>
- <script src="https://cdn.jsdmirror.com/npm/aplayer/dist/APlayer.min.js"></script>
- <script src="https://cdn.jsdmirror.com/npm/meting/dist/Meting.min.js"></script>
- <script src="https://cdn.jsdmirror.com/gh/bishshi/welcomemessage/txmap.js"></script> - <script src="https://cdn.jsdmirror.com/gh/bishshi/welcomemessage/txmap.js"></script>
- <script src="https://cdn.jsdmirror.com/gh/bishshi/rightmenu@1.2/rightmenu.js"></script> - <script src="https://cdn.jsdmirror.com/gh/bishshi/rightmenu@1.2/rightmenu.js"></script>
- <script src="https://cdn.jsdmirror.com/gh/bishshi/sidecalendar/calendar.js"></script> - <script src="https://cdn.jsdmirror.com/gh/bishshi/sidecalendar@latest/calendar.js"></script>
- <script src="https://cdn.jsdmirror.com/npm/chinese-lunar@0.1.4/lib/chinese-lunar.js"></script> - <script src="https://cdn.jsdmirror.com/npm/chinese-lunar@0.1.4/lib/chinese-lunar.js"></script>
- <script src="https://cdn.jsdmirror.com/npm/instantsearch.js@4.56.0"></script> - <script src="https://cdn.jsdmirror.com/npm/instantsearch.js@4.56.0"></script>
- <script src="https://cdn.jsdmirror.com/npm/typesense-instantsearch-adapter@2.7.0/dist/typesense-instantsearch-adapter.min.js"></script> - <script src="https://cdn.jsdmirror.com/npm/typesense-instantsearch-adapter@2.7.0/dist/typesense-instantsearch-adapter.min.js"></script>

138
package-lock.json generated
View File

@@ -8,11 +8,11 @@
"name": "hexo-site", "name": "hexo-site",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"axios": "^1.13.5", "axios": "^1.14.0",
"cheerio": "^1.2.0", "cheerio": "^1.2.0",
"hexo": "^8.1.1", "hexo": "^8.1.1",
"hexo-abbrlink": "^2.2.1", "hexo-abbrlink": "^2.2.1",
"hexo-ai-summary-liushen": "^1.3.1", "hexo-ai-summary-liushen": "^1.4.0",
"hexo-butterfly-swiper-lyx": "^1.0.2", "hexo-butterfly-swiper-lyx": "^1.0.2",
"hexo-deployer-git": "^4.0.0", "hexo-deployer-git": "^4.0.0",
"hexo-douban": "^2.3.6", "hexo-douban": "^2.3.6",
@@ -30,14 +30,14 @@
"hexo-renderer-marked": "^7.0.1", "hexo-renderer-marked": "^7.0.1",
"hexo-renderer-pug": "^3.0.0", "hexo-renderer-pug": "^3.0.0",
"hexo-renderer-stylus": "^3.0.1", "hexo-renderer-stylus": "^3.0.1",
"hexo-safego": "^2.2.2", "hexo-safego": "^2.3.0",
"hexo-server": "^3.0.0", "hexo-server": "^3.0.0",
"hexo-spoiler": "^1.7.4", "hexo-spoiler": "^1.7.4",
"hexo-wordcount": "^6.0.1", "hexo-wordcount": "^6.0.1",
"moment": "^2.30.1", "moment": "^2.30.1",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
"p-limit": "^7.3.0", "p-limit": "^7.3.0",
"typesense": "^3.0.1", "typesense": "^3.0.5",
"vite-plugin-require-transform": "^1.0.21", "vite-plugin-require-transform": "^1.0.21",
"xml2js": "^0.6.2" "xml2js": "^0.6.2"
} }
@@ -119,9 +119,9 @@
} }
}, },
"node_modules/@babel/parser": { "node_modules/@babel/parser": {
"version": "7.29.0", "version": "7.29.2",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz",
"integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", "integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/types": "^7.29.0" "@babel/types": "^7.29.0"
@@ -134,9 +134,9 @@
} }
}, },
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.28.6", "version": "7.29.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz",
"integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==", "integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@@ -363,9 +363,9 @@
"optional": true "optional": true
}, },
"node_modules/@xmldom/xmldom": { "node_modules/@xmldom/xmldom": {
"version": "0.9.8", "version": "0.9.9",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.8.tgz", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.9.tgz",
"integrity": "sha512-p96FSY54r+WJ50FIOsCOjyj/wavs8921hG5+kVMmZgKcvIKxMXHTrjNJvRgWa/zuX3B6t2lijLNFaOyuxUH+2A==", "integrity": "sha512-qycIHAucxy/LXAYIjmLmtQ8q9GPnMbnjG1KXhWm9o5sCr6pOYDATkMPiTNa6/v8eELyqOQ2FsEqeoFYmgv/gJg==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=14.6" "node": ">=14.6"
@@ -463,14 +463,14 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/axios": { "node_modules/axios": {
"version": "1.13.6", "version": "1.15.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.6.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-1.15.0.tgz",
"integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==", "integrity": "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"follow-redirects": "^1.15.11", "follow-redirects": "^1.15.11",
"form-data": "^4.0.5", "form-data": "^4.0.5",
"proxy-from-env": "^1.1.0" "proxy-from-env": "^2.1.0"
} }
}, },
"node_modules/babel-walk": { "node_modules/babel-walk": {
@@ -534,9 +534,9 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.3.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "integrity": "sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0" "balanced-match": "^1.0.0"
@@ -1149,9 +1149,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/fast-xml-builder": { "node_modules/fast-xml-builder": {
"version": "1.1.3", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.3.tgz", "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.4.tgz",
"integrity": "sha512-1o60KoFw2+LWKQu3IdcfcFlGTW4dpqEWmjhYec6H82AYZU2TVBXep6tMl8Z1Y+wM+ZrzCwe3BZ9Vyd9N2rIvmg==", "integrity": "sha512-f2jhpN4Eccy0/Uz9csxh3Nu6q4ErKxf0XIsasomfOihuSUa3/xw6w8dnOtCDgEItQFJG8KyXPzQXzcODDrrbOg==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -1164,9 +1164,9 @@
} }
}, },
"node_modules/fast-xml-parser": { "node_modules/fast-xml-parser": {
"version": "5.5.5", "version": "5.5.11",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.5.tgz", "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.11.tgz",
"integrity": "sha512-NLY+V5NNbdmiEszx9n14mZBseJTC50bRq1VHsaxOmR72JDuZt+5J1Co+dC/4JPnyq+WrIHNM69r0sqf7BMb3Mg==", "integrity": "sha512-QL0eb0YbSTVWF6tTf1+LEMSgtCEjBYPpnAjoLC8SscESlAjXEIRJ7cHtLG0pLeDFaZLa4VKZLArtA/60ZS7vyA==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -1175,9 +1175,9 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fast-xml-builder": "^1.1.3", "fast-xml-builder": "^1.1.4",
"path-expression-matcher": "^1.1.3", "path-expression-matcher": "^1.4.0",
"strnum": "^2.1.2" "strnum": "^2.2.3"
}, },
"bin": { "bin": {
"fxparser": "src/cli/cli.js" "fxparser": "src/cli/cli.js"
@@ -1424,9 +1424,9 @@
} }
}, },
"node_modules/glob/node_modules/brace-expansion": { "node_modules/glob/node_modules/brace-expansion": {
"version": "1.1.12", "version": "1.1.13",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
@@ -3867,9 +3867,9 @@
} }
}, },
"node_modules/path-expression-matcher": { "node_modules/path-expression-matcher": {
"version": "1.1.3", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.1.3.tgz", "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz",
"integrity": "sha512-qdVgY8KXmVdJZRSS1JdEPOKPdTiEK/pi0RkcT2sw1RhXxohdujUlJFPuS1TSkevZ9vzd3ZlL7ULl1MHGTApKzQ==", "integrity": "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -3912,9 +3912,9 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/picomatch": { "node_modules/picomatch": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=8.6" "node": ">=8.6"
@@ -3951,10 +3951,13 @@
} }
}, },
"node_modules/proxy-from-env": { "node_modules/proxy-from-env": {
"version": "1.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==",
"license": "MIT" "license": "MIT",
"engines": {
"node": ">=10"
}
}, },
"node_modules/pug": { "node_modules/pug": {
"version": "3.0.4", "version": "3.0.4",
@@ -4368,12 +4371,12 @@
} }
}, },
"node_modules/speech-rule-engine": { "node_modules/speech-rule-engine": {
"version": "4.1.2", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/speech-rule-engine/-/speech-rule-engine-4.1.2.tgz", "resolved": "https://registry.npmjs.org/speech-rule-engine/-/speech-rule-engine-4.1.3.tgz",
"integrity": "sha512-S6ji+flMEga+1QU79NDbwZ8Ivf0S/MpupQQiIC0rTpU/ZTKgcajijJJb1OcByBQDjrXCN1/DJtGz4ZJeBMPGJw==", "integrity": "sha512-SBMgkuJYvP4F62daRfBNwYC2nXTEhNXAfsBZ/BB7Ly85/KnbnjmKM7/45ZrFbH6jIMiAliDUDPSZFUuXDvcg6A==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@xmldom/xmldom": "0.9.8", "@xmldom/xmldom": "0.9.9",
"commander": "13.1.0", "commander": "13.1.0",
"wicked-good-xpath": "1.3.0" "wicked-good-xpath": "1.3.0"
}, },
@@ -4442,9 +4445,9 @@
} }
}, },
"node_modules/strnum": { "node_modules/strnum": {
"version": "2.2.0", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.0.tgz", "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.3.tgz",
"integrity": "sha512-Y7Bj8XyJxnPAORMZj/xltsfo55uOiyHcU2tnAVzHUnSJR/KsEX+9RoDeXEnsXtl/CX4fAcrt64gZ13aGaWPeBg==", "integrity": "sha512-oKx6RUCuHfT3oyVjtnrmn19H1SiCqgJSg+54XqURKp5aCMbrXrhLjRN9TjuwMjiYstZ0MzDrHqkGZ5dFTKd+zg==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -4619,12 +4622,12 @@
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/typesense": { "node_modules/typesense": {
"version": "3.0.3", "version": "3.0.5",
"resolved": "https://registry.npmjs.org/typesense/-/typesense-3.0.3.tgz", "resolved": "https://registry.npmjs.org/typesense/-/typesense-3.0.5.tgz",
"integrity": "sha512-Cue72Hbz0Aj7DMNXzHIuitBKHWK12GprIFC/7AQ8kR73vJ4iNaKz4eUPICJmQOdWhblEeBv8Am4f9wqEDFd66A==", "integrity": "sha512-Pw/yWosbqEOFMM/wQDsnS8FA6r3Qp5ilxuqZTMBoUc95SGCEBflMd39kvDEZZFoTORzNDxCLiiQ+LfYJTl1ulQ==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"axios": "^1.13.5", "axios": "1.13.5",
"loglevel": "^1.9.2", "loglevel": "^1.9.2",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
@@ -4635,10 +4638,27 @@
"@babel/runtime": "^7.23.2" "@babel/runtime": "^7.23.2"
} }
}, },
"node_modules/typesense/node_modules/axios": {
"version": "1.13.5",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz",
"integrity": "sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.11",
"form-data": "^4.0.5",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/typesense/node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
"node_modules/undici": { "node_modules/undici": {
"version": "7.24.3", "version": "7.24.7",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.24.3.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-7.24.7.tgz",
"integrity": "sha512-eJdUmK/Wrx2d+mnWWmwwLRyA7OQCkLap60sk3dOK4ViZR7DKwwptwuIvFBg2HaiP9ESaEdhtpSymQPvytpmkCA==", "integrity": "sha512-H/nlJ/h0ggGC+uRL3ovD+G0i4bqhvsDOpbDv7At5eFLlj2b41L8QliGbnl2H7SnDiYhENphh1tQFJZf+MyfLsQ==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=20.18.1" "node": ">=20.18.1"
@@ -4825,9 +4845,9 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "8.19.0", "version": "8.20.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", "integrity": "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"

View File

@@ -12,11 +12,11 @@
"version": "8.1.1" "version": "8.1.1"
}, },
"dependencies": { "dependencies": {
"axios": "^1.13.5", "axios": "^1.15.0",
"cheerio": "^1.2.0", "cheerio": "^1.2.0",
"hexo": "^8.1.1", "hexo": "^8.1.1",
"hexo-abbrlink": "^2.2.1", "hexo-abbrlink": "^2.2.1",
"hexo-ai-summary-liushen": "^1.3.1", "hexo-ai-summary-liushen": "^2.0.0",
"hexo-butterfly-swiper-lyx": "^1.0.2", "hexo-butterfly-swiper-lyx": "^1.0.2",
"hexo-deployer-git": "^4.0.0", "hexo-deployer-git": "^4.0.0",
"hexo-douban": "^2.3.6", "hexo-douban": "^2.3.6",
@@ -34,14 +34,14 @@
"hexo-renderer-marked": "^7.0.1", "hexo-renderer-marked": "^7.0.1",
"hexo-renderer-pug": "^3.0.0", "hexo-renderer-pug": "^3.0.0",
"hexo-renderer-stylus": "^3.0.1", "hexo-renderer-stylus": "^3.0.1",
"hexo-safego": "^2.2.2", "hexo-safego": "^2.3.0",
"hexo-server": "^3.0.0", "hexo-server": "^3.0.0",
"hexo-spoiler": "^1.7.4", "hexo-spoiler": "^1.7.4",
"hexo-wordcount": "^6.0.1", "hexo-wordcount": "^6.0.1",
"moment": "^2.30.1", "moment": "^2.30.1",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
"p-limit": "^7.3.0", "p-limit": "^7.3.0",
"typesense": "^3.0.1", "typesense": "^3.0.5",
"vite-plugin-require-transform": "^1.0.21", "vite-plugin-require-transform": "^1.0.21",
"xml2js": "^0.6.2" "xml2js": "^0.6.2"
} }

View File

@@ -10,5 +10,9 @@
"ignorePaths": [ "ignorePaths": [
"themes/**", "themes/**",
".gitea/**" ".gitea/**"
] ],
"rangeStrategy": "bump",
"prHourlyLimit": 0,
"prConcurrentLimit": 0,
"dependencyDashboard": false
} }

View File

@@ -1,5 +1,5 @@
--- ---
title: opencv基础操作 title: opencv应用-基础操作
categories: categories:
- 技术 - 技术
series: opencv series: opencv

View File

@@ -0,0 +1,70 @@
---
title: opencv应用-算术运算
categories:
- 技术
series: opencv
tags:
- opencv
abbrlink: b559997d
summary: >-
这篇文章介绍了如何使用OpenCV进行图像的加法运算。首先通过包含OpenCV和iostream头文件并使用std命名空间开始编写代码。主函数中读取两张图片检查是否成功加载并确保它们的尺寸相同。如果尺寸不同将第二张图片调整为与第一张相同的大小。然后调用add函数对两幅图片进行加法运算并将结果存储在result矩阵中。最后显示原始图片和加法运算的结果并等待按键关闭窗口。代码已上传至自建的git仓库。
date: 2026-03-17 13:13:08
---
opencv对图像的算数运算感觉都大同小异分为以下几种加减乘除和位运算。
| 函数 | 功能 | 应用场景 |
|-------------------|--------|------------|
| cv2.bitwise_and() | 按位与操作 | 掩码操作、图像分割 |
| cv2.bitwise_or() | 按位或操作 | 图像叠加 |
| cv2.bitwise_not() | 按位取反操作 | 图像反色 |
| cv2.bitwise_xor() | 按位异或操作 | 图像差异检测 |
因为感觉都差不多,所以只把加法运算代码搬过来
```cpp
// 加法
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
string path1 = "../img/2.jpg";
string path2 = "../img/3.jpg";
Mat img1 = imread(path1);
Mat img2 = imread(path2);
if (img1.empty() || img2.empty())
{
cout << "无法读取图片,请检查路径!" << endl;
return -1;
}
if (img1.size() != img2.size())
{
cout << "尺寸不一致,正在自动调整 img2 的尺寸..." << endl;
// 将 img2 缩放到与 img1 相同的尺寸
resize(img2, img2, img1.size());
}
Mat result;
add(img1, img2, result);
imshow("Original Image 1", img1);
imshow("Original Image 2", img2);
imshow("Add Result", result);
// 等待按键后关闭窗口
waitKey(0);
destroyAllWindows();
return 0;
}
```
另外把代码上传到了自建的git中
{% link opencv-learning,opencv-learning,https://git.biss.click/biss/opencv-learning/src/branch/master/Arithmetic%20operations %}

View File

@@ -0,0 +1,130 @@
---
title: 配置OpenGL环境
cover: https://pic.biss.click/image/d19b9e03-9442-4b85-94a0-a3780b9f4440.webp
categories:
- 技术
- 学习
series: OpenGL
tags: OpenGL
abbrlink: c4477b0c
summary: >-
这篇文章详细介绍了配置OpenGL环境所需步骤包括安装Visual
Studio、CMake和GLFW等关键组件并提供了具体的配置方法和测试代码旨在帮助读者顺利开始计算机图形学的学习之旅。
date: 2026-04-02 04:52:16
---
最近要学计算机图形学,所以会用到`OpenGL`,配置环境有点繁琐,记录了下来。
# 安装Visual Studio
现在我们先来安装`Visual Studio`[visual studio](https://visualstudio.microsoft.com/zh-hans/vs/),下载后安装即可|在安装时选择“使用C++的桌面开发”这样安装时就会安装C++的编译器了。
![](https://pic.biss.click/image/2d3be78a-320f-41de-8773-e2fd7a2af66e.webp)
# 安装 Cmake
这个可选,因为我们可以使用`Visual Studio`的编译器`MSVC`来编译项目。
`Cmake`是一个开源的跨平台软件构建工具,它可以生成不同系统的构建文件,比如`Makefile``Ninja``VS`项目文件等等。
我们可以下载`Cmake`[cmake](https://cmake.org/download/),下载后安装即可。
# 安装GLFW
OpenGL有许多工具比如GLFWGLEW等等这里我们安装GLFW。
|工具|类别|主要职责|特点|
|----|----|----|----|
|GLUT|窗口管理 + 工具库|创建窗口、处理鼠标键盘、提供内置渲染循环。|古老、简单。使用“固定管线”(老旧技术),适合教学。|
|GLFW|窗口管理库|创建窗口、处理输入、管理多个上下文。|现代、轻量。只管窗口和输入,不负责渲染逻辑,是目前的主流。|
|GLAD|配置/加载库|加载 OpenGL 函数指针(连接驱动)。|底层必备。因为 OpenGL 函数在显卡驱动里,需要它来“找”函数地址。|
## 下载GLFW 和 glad
`GLFW`是一个开源的跨平台`C/C++`窗口管理库,它可以创建窗口、处理输入、管理多个上下文。
下载`GLFW`[glfw](https://www.glfw.org/download.html),下载后解压即可。
## 创建项目与配置
`Visual Studio`创建一个空的`C++`项目然后添加GLFW的目录到项目中。
在项目属性中添加GLFW的目录到“C/C++->General->Additional Include Directories”中。
如图所示:
![](https://pic.biss.click/image/0097e9f0-d0ab-4bd1-b9de-c774cee0d4ef.webp)
## 测试
创建一个`main.cpp`文件,内容如下:
```cpp
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <iostream>
// 顶点着色器源码
const char* vertexShaderSource = "#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"void main() {\n"
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"}\0";
// 片段着色器源码
const char* fragmentShaderSource = "#version 330 core\n"
"out vec4 FragColor;\n"
"void main() {\n"
" FragColor = vec4(1.0f, 1.0f, 1.0f, 1.0f);\n" // 白色
"}\n\0";
int main() {
// 1. 初始化 GLFW
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// 2. 创建窗口
GLFWwindow* window = glfwCreateWindow(800, 600, "Simple OpenGL", NULL, NULL);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
// 3. 编译着色器
unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
glCompileShader(vertexShader);
unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
glCompileShader(fragmentShader);
unsigned int shaderProgram = glCreateProgram();
glAttachShader(shaderProgram, vertexShader);
glAttachShader(shaderProgram, fragmentShader);
glLinkProgram(shaderProgram);
// 4. 定义三角形顶点数据
float vertices[] = {
-0.5f, -0.5f, 0.0f, // 左下
0.5f, -0.5f, 0.0f, // 右下
0.0f, 0.5f, 0.0f // 顶部
};
unsigned int VBO, VAO;
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
// 5. 渲染循环
while (!glfwWindowShouldClose(window)) {
glClearColor(0.2f, 0.3f, 0.3f, 1.0f); // 深青色背景
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(shaderProgram);
glBindVertexArray(VAO);
glDrawArrays(GL_TRIANGLES, 0, 3);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
```
如果能运行成功应该就没问题了。

View File

@@ -0,0 +1,131 @@
---
title: OpenGL-基础程序
cover: https://pic.biss.click/image/2fcb9566-f7f6-4132-81cb-4cd646967519.webp
categories:
- 技术
- 学习
series: OpenGL
tags: OpenGL
abbrlink: 437a5198
summary: >-
这篇文章详细介绍了OpenGL的基础程序包括代码展示和代码解释两部分。代码展示部分呈现了一个简单的OpenGL程序涵盖了初始化与窗口管理、状态设置与缓冲区操作、矩阵与坐标变换以及几何图形绘制等关键步骤。代码解释则将这些步骤按照功能类别进行了归纳帮助读者更好地理解OpenGL的渲染流程。通过这个示例读者可以初步掌握OpenGL的基本操作和概念。
date: 2026-04-11 18:20:34
---
# 代码展示
我们先从基本的OpenGL程序开始吧这是一个简单的OpenGL程序
```cpp
#include<GL/glut.h>
using namespace std;
// 回调函数
void myDisplay()
{
// 清除缓冲区
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
// 正交模式
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, 500.0, 0.0, 500.0);
glColor4f(0.0, 1.0, 0.0, 0.0);
glRectf(50.0, 50.0, 400.0, 400.0);
// 划线
glColor3f(1.0, 1.0, 0.0);
glBegin(GL_LINES);
glVertex2f(50.0, 50.0);
glVertex2f(400.0, 400.0);
glVertex2f(400.0, 50.0);
glVertex2f(50.0, 400.0);
glEnd();
// 画点
glColor3f(1.0, 0.0, 0.0);
glPointSize(20.0);
glBegin(GL_POINTS);
glVertex2f(15.0, 15.0);
glEnd();
// 画三角形
glBegin(GL_TRIANGLES);
glColor3f(0.0, 0.0, 1.0);
glVertex2i(200, 300);
glVertex2i(100, 100);
glVertex2i(300, 100);
glEnd();
glFlush();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(100, 100);
glutInitWindowSize(500, 500);
glutCreateWindow("");
glutDisplayFunc(&myDisplay);
glutMainLoop();
return 0;
}
```
这是运行结果图:
![第一个OpenGL程序](https://pic.biss.click/image/0ef5fbe7-0338-4cd0-94c7-1874273461f7.png)
# 代码解释
这段代码展示了经典的 OpenGL (GLUT) 固定渲染管线基本操作。为了方便理解,我将这些函数按照 **初始化与窗口管理**、**状态设置**、**坐标变换** 以及 **图形绘制** 四个类别进行了整理。
## 1. 窗口管理与初始化 (GLUT 库)
这类函数主要用于配置窗口系统和处理程序的运行流程。
| 函数名称 | 功能描述 | 核心参数说明 |
| :--- | :--- | :--- |
| `glutInit` | 初始化 GLUT 库 | 接收 `main` 函数的命令行参数 |
| `glutInitDisplayMode` | 设置显示模式 | `GLUT_RGB` (使用颜色模式), `GLUT_SINGLE` (单缓冲区) |
| `glutInitWindowPosition` | 设置窗口在屏幕上的初始位置 | 窗口左上角坐标 $(x, y)$ |
| `glutInitWindowSize` | 设置窗口的宽度和高度 | 像素值 (Width, Height) |
| `glutCreateWindow` | 创建窗口 | 字符串参数作为窗口标题 |
| `glutDisplayFunc` | 注册显示回调函数 | 传入负责绘图的函数指针 |
| `glutMainLoop` | 进入 GLUT 事件处理循环 | 让程序持续运行,等待重绘或交互 |
---
## 2. 状态设置与缓冲区操作
这些函数用于配置 OpenGL 的全局状态(如颜色、点大小)或清理画布。
| 函数名称 | 功能描述 | 核心参数说明 |
| :--- | :--- | :--- |
| `glClearColor` | 设置清除颜色(背景色) | RGBA 值 (0.0~1.0),此处设为黑色 |
| `glClear` | 清除指定的缓冲区 | `GL_COLOR_BUFFER_BIT` 表示清除颜色缓存 |
| `glColor4f` | 设置当前的绘制颜色 (带透明度) | RGBA 分量 |
| `glColor3f` | 设置当前的绘制颜色 (不带透明度) | RGB 分量 |
| `glPointSize` | 设置点的像素大小 | 浮点数,数值越大点越粗 |
| `glFlush` | 强制刷新缓冲区 | 确保绘图命令立即执行并输出到显示设备 |
---
## 3. 矩阵与坐标变换
用于定义物体是如何投影到屏幕上的。
| 函数名称 | 功能描述 | 核心参数说明 |
| :--- | :--- | :--- |
| `glMatrixMode` | 设置当前矩阵模式 | `GL_PROJECTION` 切换到投影矩阵堆栈 |
| `gluOrtho2D` | 定义二维正交投影裁剪区域 | 定义视野的左、右、下、上边界范围 |
---
## 4. 几何图形绘制
OpenGL 的核心绘图逻辑,通过指定顶点来构建形状。
| 函数名称 | 功能描述 | 核心参数说明 |
| :--- | :--- | :--- |
| `glRectf` | 绘制一个实心矩形 | 传入左下角坐标和右上角坐标 $(x1, y1, x2, y2)$ |
| `glBegin` | 标记图元绘制的开始 | `GL_LINES` (线), `GL_POINTS` (点), `GL_TRIANGLES` (三角形) |
| `glVertex2f` | 指定一个二维顶点 (浮点型) | 坐标 $(x, y)$ |
| `glVertex2i` | 指定一个二维顶点 (整型) | 坐标 $(x, y)$ |
| `glEnd` | 标记图元绘制的结束 | 必须与 `glBegin` 成对出现 |
---

View File

@@ -0,0 +1,279 @@
---
title: OpenGL-直线的扫描转换
cover: https://pic.biss.click/image/c5457adc-214c-4a18-9aa6-43fbc0bfc2f4.webp
categories:
- 技术
- 学习
series: OpenGL
tags: OpenGL
abbrlink: 7207243b
summary: >-
这篇文章介绍了三种直线扫描转换算法DDA算法、中点画线算法和Bresenham算法。
DDA算法通过计算直线起点和终点的坐标差值来确定步数和增量依次绘制直线上的点。算法实现简单适用于任意直线但精度较低。
中点画线算法仅适用于斜率为0或1的直线通过计算中点和斜率来确定直线上的像素点效率较高。
Bresenham算法根据直线的斜率和误差项来确定像素点的位置适用于任意直线且精度高但实现稍复杂。
date: 2026-04-11 19:01:02
---
这篇文章来介绍直线扫描转换算法
# DDA数值微分线段算法
## 算法简介
数值微分法即DDA法(Digital Differential Analyzer),是一种基于微分方程来生成直线的方法。在计算机图形学中,并没有线段的概念,而是一个个像素点组成了线段。
DDA法生成线段的步骤一般如下
1. 有了起始点($x_1y_1$)和终点($x_ny_n$
2. $$\Delta x =|x_n-x_1|, \Delta y=|y_n-y_1|$$
3. 比较$\Delta x$和$\Delta y$的大小;
steps=$\Delta x$和$\Delta y$中较大者;
4. $$step_x=\frac{\Delta x}{steps}step_y=\frac{\Delta y}{steps}$$
## 算法实现
DDA算法实现如下
```cpp
#include <cmath>
#include <iostream>
#include <GL/glut.h>
// 窗口宽度和高度
const int WIDTH = 640;
const int HEIGHT = 480;
void drawDDALine(int x1, int y1, int x2, int y2) {
float x = x1;
float y = y1;
// 计算差值
int dx = x2 - x1;
int dy = y2 - y1;
// 确定步数,取 dx 和 dy 中绝对值较大的那个
int steps = std::abs(dx) > std::abs(dy) ? std::abs(dx) : std::abs(dy); //三元表达式
// 计算每一步的增量
float xIncrement = (float)dx / steps;
float yIncrement = (float)dy / steps;
// 开始绘制点
glBegin(GL_POINTS);
glVertex2i((int)round(x), (int)round(y)); // 绘制起点
for (int k = 0; k < steps; k++) {
x += xIncrement;
y += yIncrement;
// 将浮点坐标四舍五入取整转换为整数像素坐标
std::cout << (int)round(x) << ", " << (int)round(y)<<"\n";
glVertex2i((int)round(x), (int)round(y));
}
glEnd();
}
// 显示回调函数
void display() {
drawDDALine(0, 0, 50, 20);
glFlush();
}
// 初始化 OpenGL 设置
void init() {
// 设置背景颜色为白色
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
// 设置投影矩阵为 2D 正交投影
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// 定义可视区域,左下角(0,0),右上角(WIDTH, HEIGHT)
gluOrtho2D(0.0, WIDTH, 0.0, HEIGHT);
}
int main(int argc, char** argv) {
// 初始化 GLUT
glutInit(&argc, argv);
// 设置显示模式单缓冲、RGB 颜色模式
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
// 设置窗口大小和位置
glutInitWindowSize(WIDTH, HEIGHT);
glutInitWindowPosition(100, 100);
// 创建窗口
glutCreateWindow("DDA算法");
// 注册回调函数
glutDisplayFunc(display);
// 初始化设置
init();
// 进入主循环
glutMainLoop();
return 0;
}
```
# 中点画线算法
## 算法简介
只考虑当直线的斜率$|k|< 1$时的情况,假设现在有一条直线$(x_1,y_1,x_2,y_2)$,那么第一个点一定是$(x_1,y_1)$无疑,下一个点的$x$坐标为$x_1+1$,$y$坐标要么为$y1$要么为$y1+1$。关键在于每次取下一个点时,是取前一个的$y1$呢,还是$y1+1$,这时一定是取直线上点最靠近的那个了,而判断取哪个点就用到了中点,我们将中点代入直线中 $d=F(x_1+1,y_1+0.5)=a \cdot (x_1+1)+b \cdot (y_1+0.5)+c$。
1. 如果直线$d>=0$,则取下边的点也就是$(x_1+1,y_1)$。
2. 如果直线$d<0$,则取上边的点也就是$(x_1+1,y_1+1)$。
它的实际过程就是这样每次根据前边的点判断下一个点在哪,然后进行打亮,但这样每次判断的时候都得代入直线方程计算太麻烦了,我们将这俩种情况分别代入直线方程中可以找出规律:
1. 当直线$d>=0$时,经过化解得$d_1=d+a$;
2. 当直线$d<0$时,经过化解得$d_2=d+a+b$;
3. 初始值$d_0=a+0.5b$。
也就是说每次的增量要么为$a$,要么为$a+b$,那么这样判断的时候就简单多了因为我们每次只是判断它的正负。所以给等式同时乘2将其中浮点数0.5化为整数,这样硬件操作时无疑更快了。
## 算法实现
```cpp
#include <GL/freeglut.h>
#include <iostream>
#include <cmath>
// 中点画线算法函数 (仅针对斜率 0 <= k <= 1 的情况进行演示,其它象限需类比处理)
void drawLineMidpoint(int x0, int y0, int x1, int y1) {
int a = y0 - y1;
int b = x1 - x0;
int d = 2 * a + b;
int d1 = 2 * a;
int d2 = 2 * (a + b);
int x = x0, y = y0;
glBegin(GL_POINTS);
glVertex2i(x, y); // 画起点
while (x < x1) {
if (d < 0) {
x++;
y++;
d += d2;
} else {
x++;
d += d1;
}
glVertex2i(x, y);
}
glEnd();
}
// 渲染回调函数
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0); // 设置画笔颜色为白色
// 调用算法画一条直线 (x0, y0) 到 (x1, y1)
// 注意:此处的坐标对应屏幕像素坐标
drawLineMidpoint(50, 50, 450, 300);
glFlush();
}
// 初始化设置
void init() {
glClearColor(0.0, 0.0, 0.0, 1.0); // 背景设为黑色
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// 设置正交投影矩阵,使坐标系与窗口像素对应
gluOrtho2D(0, 500, 0, 500);
}
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("Midpoint Line Algorithm - FreeGLUT");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
```
# Bresenham算法
## 算法简介
假设我们需要由$(x_0, y_0)$这一点,绘画一直线至右下角的另一点$(x_1, y_1)$x,y分别代表其水平及垂直坐标并且$x_1 - x_0 > y_1 - y_0$。在此我们使用电脑系统常用的坐标系,即$x$坐标值沿$x$轴向右增长,$y$坐标值沿$y$轴向下增长。
因此x及y之值分别向右及向下增加而两点之水平距离为$x_{1}-x_{0}$且垂直距离为$y_{1}-y_{0}$。由此得之,该线的斜率必定介乎于$0$至$1$之间。而此算法之目的,就是找出在$x_{0}$与$x_{1}$之间,第$x$行相对应的第$y$列,从而得出一像素点,使得该像素点的位置最接近原本的线。
对于由$(x_0, y_0)$及$(x_1, y_1)$两点所组成之直线,公式如下:
$$y-y_{0}={\frac {y_{1}-y_{0}}{x_{1}-x_{0}}}(x-x_{0})$$
因此对于每一点的x其y的值是
$${\frac {y_{1}-y_{0}}{x_{1}-x_{0}}}(x-x_{0})+y_{0}$$
因为$x$及$y$皆为整数,但并非每一点$x$所对应的$y$皆为整数故此没有必要去计算每一点x所对应之$y$值。反之由于此线之斜率介乎于$1$至$0$之间,故此我们只需要找出当$x$到达那一个数值时,会使$y$上升$1$,若$x$尚未到此值,则$y$不变。至于如何找出相关的$x$值,则需依靠斜率。斜率之计算方法为$m=(y_{1}-y_{0})/(x_{1}-x_{0})$。由于此值不变,故可于运算前预先计算,减少运算次数。
要实行此算法,我们需计算每一像素点与该线之间的误差。于上述例子中,误差应为每一点$x$中,其相对的像素点之$y$值与该线实际之$y$值的差距。每当$y$的值增加$1$,误差的值就会增加$m$。每当误差的值超出$0.5$,线就会比较靠近下一个映像点,因此$y$的值便会加$1$,且误差减$1$。
## 算法实现
```cpp
#include <GL/freeglut.h>
#include <iostream>
#include <cmath>
// 通用 Bresenham 画线算法
void drawLineBresenham(int x0, int y0, int x1, int y1) {
int dx = abs(x1 - x0);
int dy = abs(y1 - y0);
int sx = (x0 < x1) ? 1 : -1; // X 方向步进
int sy = (y0 < y1) ? 1 : -1; // Y 方向步进
int err = dx - dy; // 初始误差项
glBegin(GL_POINTS);
while (true) {
glVertex2i(x0, y0); // 绘制当前点
if (x0 == x1 && y0 == y1) break; // 到达终点
int e2 = 2 * err;
// 判断是否在 X 方向步进
if (e2 > -dy) {
err -= dy;
x0 += sx;
}
// 判断是否在 Y 方向步进
if (e2 < dx) {
err += dx;
y0 += sy;
}
}
glEnd();
}
// 渲染回调
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0f, 0.8f, 0.4f); // 设置一个好看的绿色(类似你图中的图标颜色)
// 绘制几条不同方向的线来测试算法的健壮性
drawLineBresenham(50, 50, 450, 400); // 第一象限
drawLineBresenham(50, 400, 450, 50); // 第四象限
drawLineBresenham(250, 50, 250, 450); // 垂直线
drawLineBresenham(50, 250, 450, 250); // 水平线
glFlush();
}
void init() {
glClearColor(0.1f, 0.1f, 0.1f, 1.0f); // 深色背景
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 500, 0, 500); // 建立 500x500 的直角坐标系
}
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(600, 600);
glutCreateWindow("Bresenham Line Algorithm");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
```

View File

@@ -9,21 +9,20 @@ nav#nav
.ls-grid .ls-grid
a(href="/") #[i.fas.fa-rss] 个人博客 a(href="/") #[i.fas.fa-rss] 个人博客
a(href="https://github.com/bishshi") #[i.fab.fa-github] Github a(href="https://github.com/bishshi") #[i.fab.fa-github] Github
a(href="https://space.bilibili.com/20665809") #[i.fab.fa-bilibili] 哔哩哔哩
.ls-section .ls-section
.ls-title 😎 常用服务 .ls-title 😎 常用服务
.ls-grid .ls-grid
a(href="https://git.biss.click/biss") #[i.fas.fa-code] 代码仓库 a(href="https://git.biss.click/biss") #[i.fas.fa-code] 代码仓库
a(href="https://mm.biss.click") #[i.fas.fa-pen-nib] 日常yy a(href="https://mm.biss.click") #[i.fas.fa-pen-nib] 日常说说
a(href="https://statstic.biss.click") #[i.fas.fa-users] 访客统计
a(href="https://pic.biss.click") #[i.fas.fa-image] 图床 a(href="https://pic.biss.click") #[i.fas.fa-image] 图床
a(href="https://chat.biss.click") #[i.fas.fa-robot] AI网站
a(href="https://git.biss.click") #[i.fas.fa-code-branch] 代码仓库 a(href="https://git.biss.click") #[i.fas.fa-code-branch] 代码仓库
.ls-section .ls-section
.ls-title 🛸 实用工具 .ls-title 🛸 实用工具
.ls-grid .ls-grid
a(href="https://cover.biss.click") #[i.fas.fa-palette] 封面设计 a(href="https://cover.biss.click") #[i.fas.fa-palette] 封面设计
a(href="https://doc.biss.click") #[i.fas.fa-file] 文档服务 a(href="https://doc.biss.click") #[i.fas.fa-file] 文档服务
a(href="https://doc.biss.click") #[i.fas.fa-server]服务监测 a(href="https://status.biss.click") #[i.fas.fa-server] 服务监测
a(href="https://typesense.biss.click") #[i.fas.fa-magnifying-glass] 搜索后端 a(href="https://typesense.biss.click") #[i.fas.fa-magnifying-glass] 搜索后端
a.nav-site-title(href=url_for('/')) a.nav-site-title(href=url_for('/'))

View File

@@ -95,7 +95,7 @@ fontawesome:
name: '@fortawesome/fontawesome-free' name: '@fortawesome/fontawesome-free'
file: css/all.min.css file: css/all.min.css
other_name: font-awesome other_name: font-awesome
version: 7.1.0 version: 7.2.0
gitalk: gitalk:
name: gitalk name: gitalk
file: dist/gitalk.min.js file: dist/gitalk.min.js
@@ -112,12 +112,12 @@ katex:
name: katex name: katex
file: dist/katex.min.css file: dist/katex.min.css
other_name: KaTeX other_name: KaTeX
version: 0.16.28 version: 0.16.45
katex_copytex: katex_copytex:
name: katex name: katex
file: dist/contrib/copy-tex.min.js file: dist/contrib/copy-tex.min.js
other_name: KaTeX other_name: KaTeX
version: 0.16.28 version: 0.16.45
lazyload: lazyload:
name: vanilla-lazyload name: vanilla-lazyload
file: dist/lazyload.iife.min.js file: dist/lazyload.iife.min.js
@@ -137,7 +137,7 @@ mermaid:
meting_js: meting_js:
name: butterfly-extsrc name: butterfly-extsrc
file: metingjs/dist/Meting.min.js file: metingjs/dist/Meting.min.js
version: 1.1.6 version: 2.0.2
pace_default_css: pace_default_css:
name: pace-js name: pace-js
other_name: pace other_name: pace
@@ -185,8 +185,8 @@ snackbar_css:
version: 0.1.16 version: 0.1.16
twikoo: twikoo:
name: twikoo name: twikoo
file: dist/twikoo.all.min.js file: dist/twikoo.min.js
version: 1.6.44 version: 1.7.7
typed: typed:
name: typed.js name: typed.js
file: dist/typed.umd.js file: dist/typed.umd.js

View File

@@ -697,3 +697,90 @@
[data-theme='dark'] .my-footer-social-amoeba-path { [data-theme='dark'] .my-footer-social-amoeba-path {
fill: #2b3f49; fill: #2b3f49;
} }
/* 仿照 Liushen & Butterfly 逻辑的高级表格美化 */
/* 1. 表格容器处理 - 关键响应式滚动层 */
#article-container .table-wrap,
#article-container > table {
background: var(--liushen-card-bg);
border: var(--liushen-card-border);
border-radius: 12px;
box-shadow: var(--card-box-shadow);
margin: 20px 0;
backdrop-filter: blur(10px);
/* 开启横向滚动逻辑 */
width: 100%;
overflow-x: auto; /* 小屏幕自动开启滚动 */
display: block; /* 必须设为 block 滚动才生效 */
}
/* 2. 针对数据表格的结构重置(排除代码块 .highlight */
#article-container :not(.highlight) > table {
display: table; /* 容器内部恢复为 table 模式 */
border-collapse: separate;
border-spacing: 0;
border: none !important;
width: 100%;
min-width: 500px; /* 强制表格在窄屏下不收缩过猛,从而触发容器滚动 */
}
/* 3. 表头美化 - 渐变风格 */
#article-container :not(.highlight) > table thead {
background: linear-gradient(-45deg, #3eb8be, #6ecad0);
}
#article-container :not(.highlight) > table th {
color: #fff !important;
font-weight: 700;
padding: 12px 16px;
border: none !important;
text-align: left;
}
/* 4. 单元格美化 */
#article-container :not(.highlight) > table td {
padding: 10px 16px;
color: var(--liushen-text);
/* 仅保留底部细线,模仿 Liushen 的极简风格 */
border-bottom: 1px solid rgba(128, 128, 128, 0.1) !important;
border-right: none !important;
border-top: none !important;
border-left: none !important;
transition: background 0.3s;
}
/* 5. 隔行变色 */
#article-container :not(.highlight) > table tbody tr:nth-child(even) {
background: rgba(153, 169, 191, 0.05);
}
/* 6. 悬停高亮 */
#article-container :not(.highlight) > table tbody tr:hover td {
background: rgba(62, 184, 190, 0.1);
}
/* 7. 滚动条美化 (仿照你代码中的蓝色滚动条) */
#article-container .table-wrap::-webkit-scrollbar {
height: 4px; /* 横向滚动条高度 */
}
#article-container .table-wrap::-webkit-scrollbar-thumb {
background: var(--scrollbar-color, #2679cc);
border-radius: 10px;
}
/* 8. 黑夜模式适配 */
[data-theme='dark'] #article-container .table-wrap,
[data-theme='dark'] #article-container > table {
background: var(--liushen-card-secondbg);
}
[data-theme='dark'] #article-container :not(.highlight) > table thead {
background: linear-gradient(-45deg, #1f4a4d, #3eb8be);
}
[data-theme='dark'] #article-container :not(.highlight) > table td {
border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
color: rgba(255, 255, 255, 0.7);
}

View File

@@ -5,7 +5,7 @@
// 配置区域 - 请根据实际情况修改 // 配置区域 - 请根据实际情况修改
// ============================================================================ // ============================================================================
const CONFIG = { const CONFIG = {
apiKey: "VramSTWKUAggeZ5viQw8SlCwXQqmGCmA", // ⚠️ 建议使用 Search-Only API Key apiKey: "2uxQzk7eD2GBCljdSmIiuU3ause7UK9n", // ⚠️ 建议使用 Search-Only API Key
server: { server: {
host: "typesense.biss.click", host: "typesense.biss.click",
port: "443", port: "443",

View File

@@ -1,11 +0,0 @@
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://statistic.biss.click/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();