From f2f55859f571fd7feded046f5dc8c9ac267af499 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 27 Jun 2023 01:42:01 -0700 Subject: [PATCH 01/32] Adjust spell check tool configuration to avoid false positive The repository's CI system includes a check for commonly misspelled words. The latest version of the codespell tool dependency used for this spell check is always used. This means that the results of the spell check can change as new versions of the tool are released. The recent codespell release introduced a false positive result. This is corrected by adding the word to the ignore list in the codespell configuration file. --- .codespellrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codespellrc b/.codespellrc index 101edae..33d69d0 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,7 +1,7 @@ # See: https://github.com/codespell-project/codespell#using-a-config-file [codespell] # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: -ignore-words-list = , +ignore-words-list = mis check-filenames = check-hidden = skip = ./.git From 33e287df351c52513d96186a4a0d675863724235 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 05:58:26 +0200 Subject: [PATCH 02/32] Bump actions/checkout from 3 to 4 (#32) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check-arduino.yml | 2 +- .github/workflows/compile-examples.yml | 2 +- .github/workflows/spell-check.yml | 2 +- .github/workflows/sync-labels.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-arduino.yml b/.github/workflows/check-arduino.yml index 3e0d26c..adb330f 100644 --- a/.github/workflows/check-arduino.yml +++ b/.github/workflows/check-arduino.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Arduino Lint uses: arduino/arduino-lint-action@v1 diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 326b00a..643b064 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -45,7 +45,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile examples uses: arduino/compile-sketches@v1 diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 3f6b03f..ef7d894 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Spell check uses: codespell-project/actions-codespell@master diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 94938f3..9cde1ac 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download JSON schema for labels configuration file id: download-schema @@ -105,7 +105,7 @@ jobs: echo "::set-output name=flag::--dry-run" - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download configuration files artifact uses: actions/download-artifact@v3 From b8b2c9b53e4dbbe8297fc4c919a500a8eb23d7e8 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 11 Jan 2024 06:47:09 +0100 Subject: [PATCH 03/32] Fix: Clear up artefacts after when using scrolling text. (#36) This fixes #27. --- .gitignore | 1 + src/ArduinoGraphics.cpp | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 15fe1ad..3590eec 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -436,7 +436,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX - i, _textY); + int const text_x = _textX - i; + text(_textBuffer, text_x, _textY); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height); endDraw(); delay(_textScrollSpeed); @@ -446,7 +448,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX - (scrollLength - i - 1), _textY); + int const text_x = _textX - (scrollLength - i - 1); + text(_textBuffer, text_x, _textY); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height); endDraw(); delay(_textScrollSpeed); @@ -456,7 +460,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX, _textY - i); + int const text_y = _textY - i; + text(_textBuffer, _textX, text_y); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1); endDraw(); delay(_textScrollSpeed); @@ -466,7 +472,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX, _textY - (scrollLength - i - 1)); + int const text_y = _textY - (scrollLength - i - 1); + text(_textBuffer, _textX, text_y); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1); endDraw(); delay(_textScrollSpeed); From e9e081a63bc50adfabdfe3c2103118d47ca8a79a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:09:16 +0100 Subject: [PATCH 04/32] Bump actions/download-artifact from 3 to 4 (#33) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 9cde1ac..885a8ac 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -108,7 +108,7 @@ jobs: uses: actions/checkout@v4 - name: Download configuration files artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} path: ${{ env.CONFIGURATIONS_FOLDER }} From 184849da937f0e6e15b3b4e4b449b09119be6487 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:09:35 +0100 Subject: [PATCH 05/32] Bump actions/upload-artifact from 3 to 4 (#34) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/compile-examples.yml | 2 +- .github/workflows/sync-labels.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 643b064..6a642b5 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -64,7 +64,7 @@ jobs: sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} - name: Save sketches report as workflow artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error path: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 885a8ac..2e1d6e0 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -70,7 +70,7 @@ jobs: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} - name: Pass configuration files to next job via workflow artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: | *.yaml From 2eaeb4cae057e0181a4e54449ac745f3bd929fdf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:10:01 +0100 Subject: [PATCH 06/32] Bump geekyeggo/delete-artifact from 2 to 4 (#35) Bumps [geekyeggo/delete-artifact](https://github.com/geekyeggo/delete-artifact) from 2 to 4. - [Release notes](https://github.com/geekyeggo/delete-artifact/releases) - [Changelog](https://github.com/GeekyEggo/delete-artifact/blob/main/CHANGELOG.md) - [Commits](https://github.com/geekyeggo/delete-artifact/compare/v2...v4) --- updated-dependencies: - dependency-name: geekyeggo/delete-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 2e1d6e0..47ac50a 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -114,7 +114,7 @@ jobs: path: ${{ env.CONFIGURATIONS_FOLDER }} - name: Remove unneeded artifact - uses: geekyeggo/delete-artifact@v2 + uses: geekyeggo/delete-artifact@v4 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} From 3a67d0b929e6dbaff122d43d26894e6ba22f5838 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 14 Feb 2024 11:18:09 +0100 Subject: [PATCH 07/32] Fix regression concerning report-size-deltas (#37) * Fix regression concerning report-size-deltas For more information see here: https://github.com/arduino/report-size-deltas/blob/main/docs/FAQ.md#size-deltas-report-workflow-triggered-by-schedule-event . * Fix: erroneous constant used for path. --- .github/workflows/compile-examples.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 6a642b5..d80f79f 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -36,12 +36,15 @@ jobs: - fqbn: arduino:samd:arduino_zero_edbg platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-arduino_zero_edbg - fqbn: arduino:samd:mkrzero platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrzero - fqbn: arduino:samd:nano_33_iot platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-nano_33_iot steps: - name: Checkout repository @@ -67,5 +70,5 @@ jobs: uses: actions/upload-artifact@v4 with: if-no-files-found: error + name: sketches-report-${{ matrix.board.artifact-name-suffix }} path: ${{ env.SKETCHES_REPORTS_PATH }} - name: ${{ env.SKETCHES_REPORTS_PATH }} From 01ac2e5ef2394b66490b738d732dc9126f205afe Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 14 Feb 2024 11:18:33 +0100 Subject: [PATCH 08/32] Release v1.1.1. --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 7933150..b896c9a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ArduinoGraphics -version=1.1.0 +version=1.1.1 author=Arduino maintainer=Arduino sentence=Core graphics library for Arduino. From cac25edced590e38cc6e4867dadff514e185e69a Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 21 Feb 2024 06:56:45 +0100 Subject: [PATCH 09/32] Fix regression: report size delta size on PR. (#39) The necessary steps have in fact been documented here: https://github.com/arduino/report-size-deltas/blob/main/docs/FAQ.md#workflow-triggered-by-pull_request-event but I have overlooked them when I fixed the upload issue. With this PR the size deltas are - once again - reported within the PR. --- .github/workflows/compile-examples.yml | 27 ++++++++++++++++++++---- .github/workflows/report-size-deltas.yml | 24 --------------------- 2 files changed, 23 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/report-size-deltas.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index d80f79f..13d1e0f 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -20,14 +20,15 @@ on: workflow_dispatch: repository_dispatch: +env: + # It's convenient to set variables for values used multiple times in the workflow. + SKETCHES_REPORTS_PATH: sketches-reports + jobs: - build: + compile: name: ${{ matrix.board.fqbn }} runs-on: ubuntu-latest - env: - SKETCHES_REPORTS_PATH: sketches-reports - strategy: fail-fast: false @@ -72,3 +73,21 @@ jobs: if-no-files-found: error name: sketches-report-${{ matrix.board.artifact-name-suffix }} path: ${{ env.SKETCHES_REPORTS_PATH }} + + # When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report + report: + needs: compile # Wait for the compile job to finish to get the data for the report + if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request + runs-on: ubuntu-latest + + steps: + # This step is needed to get the size data produced by the compile jobs + - name: Download sketches reports artifacts + uses: actions/download-artifact@v4 + with: + # All workflow artifacts will be downloaded to this location. + path: ${{ env.SKETCHES_REPORTS_PATH }} + + - uses: arduino/report-size-deltas@v1 + with: + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml deleted file mode 100644 index 652be5d..0000000 --- a/.github/workflows/report-size-deltas.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Report Size Deltas - -# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows -on: - push: - paths: - - ".github/workflows/report-size-deltas.yml" - schedule: - # Run at the minimum interval allowed by GitHub Actions. - # Note: GitHub Actions periodically has outages which result in workflow failures. - # In this event, the workflows will start passing again once the service recovers. - - cron: "*/5 * * * *" - workflow_dispatch: - repository_dispatch: - -jobs: - report: - runs-on: ubuntu-latest - steps: - - name: Comment size deltas reports to PRs - uses: arduino/report-size-deltas@v1 - with: - # The name of the workflow artifact created by the sketch compilation workflow - sketches-reports-source: sketches-reports From ab427be6d27fb22de28e96db4f435f1f3fcfe8c4 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 21 Feb 2024 18:55:39 +0100 Subject: [PATCH 10/32] Revert "Fix regression: report size delta size on PR. (#39)" This reverts commit cac25edced590e38cc6e4867dadff514e185e69a. --- .github/workflows/compile-examples.yml | 27 ++++-------------------- .github/workflows/report-size-deltas.yml | 24 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/report-size-deltas.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 13d1e0f..d80f79f 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -20,15 +20,14 @@ on: workflow_dispatch: repository_dispatch: -env: - # It's convenient to set variables for values used multiple times in the workflow. - SKETCHES_REPORTS_PATH: sketches-reports - jobs: - compile: + build: name: ${{ matrix.board.fqbn }} runs-on: ubuntu-latest + env: + SKETCHES_REPORTS_PATH: sketches-reports + strategy: fail-fast: false @@ -73,21 +72,3 @@ jobs: if-no-files-found: error name: sketches-report-${{ matrix.board.artifact-name-suffix }} path: ${{ env.SKETCHES_REPORTS_PATH }} - - # When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report - report: - needs: compile # Wait for the compile job to finish to get the data for the report - if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request - runs-on: ubuntu-latest - - steps: - # This step is needed to get the size data produced by the compile jobs - - name: Download sketches reports artifacts - uses: actions/download-artifact@v4 - with: - # All workflow artifacts will be downloaded to this location. - path: ${{ env.SKETCHES_REPORTS_PATH }} - - - uses: arduino/report-size-deltas@v1 - with: - sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml new file mode 100644 index 0000000..652be5d --- /dev/null +++ b/.github/workflows/report-size-deltas.yml @@ -0,0 +1,24 @@ +name: Report Size Deltas + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/report-size-deltas.yml" + schedule: + # Run at the minimum interval allowed by GitHub Actions. + # Note: GitHub Actions periodically has outages which result in workflow failures. + # In this event, the workflows will start passing again once the service recovers. + - cron: "*/5 * * * *" + workflow_dispatch: + repository_dispatch: + +jobs: + report: + runs-on: ubuntu-latest + steps: + - name: Comment size deltas reports to PRs + uses: arduino/report-size-deltas@v1 + with: + # The name of the workflow artifact created by the sketch compilation workflow + sketches-reports-source: sketches-reports From c9ec0e44178f5788319edd9706e90533286e44ca Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 21 Feb 2024 18:56:12 +0100 Subject: [PATCH 11/32] Correct workflow artifact name pattern in size deltas report workflow The "sketches-reports-source" input of the "arduino/report-size-deltas" GitHub Actions action defines the regular expression that matches the names of the sketches report workflow artifacts produced by the "Compile Examples" workflow. The key string in the names of these artifacts was set to "sketches-report" when the "Compile Examples" workflow was adjusted for compatibility with the breaking changes introduced by updating to version 4.x of the workflow's "actions/upload-artifact" GitHub Actions action dependency. The pattern set in the size deltas report workflow was "sketches-reports". The "s" at the end of that pattern caused it to no longer match against the key string in the artifact names after that adjustment of the "Compile Examples" workflow, resulting in size deltas reports no longer being generated by the workflow. Although a minimal fix would be to simply remove the "s" from the end of the pattern, the decision was made to use a more strict regular expression. This will make it easier for maintainers and contributors to understand that this value is a regular expression and the exact nature of how that regular expression functio --- .github/workflows/report-size-deltas.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index 652be5d..39e2a0a 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -20,5 +20,5 @@ jobs: - name: Comment size deltas reports to PRs uses: arduino/report-size-deltas@v1 with: - # The name of the workflow artifact created by the sketch compilation workflow - sketches-reports-source: sketches-reports + # Regex matching the names of the workflow artifacts created by the "Compile Examples" workflow + sketches-reports-source: ^sketches-report-.+ From 72388e28e8ad2e44211917dfffc7d3571f609513 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 22 Feb 2024 10:12:03 +0100 Subject: [PATCH 12/32] Fix: do not crash on ASCII chars with a numeric value exceeding 127. (#41) --- src/ArduinoGraphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 3590eec..b47c2b5 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -238,7 +238,7 @@ void ArduinoGraphics::text(const char* str, int x, int y) } while (*str) { - int c = *str++; + uint8_t const c = (uint8_t)*str++; if (c == '\n') { y += _font->height; From 7c067b602e9c449bb67d2743ea6f50fa54f12c20 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 22 Feb 2024 10:43:13 +0100 Subject: [PATCH 13/32] Update font generator script to work with python 3.x --- extras/generate_font.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/extras/generate_font.py b/extras/generate_font.py index de786e5..016f634 100755 --- a/extras/generate_font.py +++ b/extras/generate_font.py @@ -60,22 +60,27 @@ out = open(output, "w") -print >> out, "#include \"Font.h\"" -print >> out -print >> out, "const struct Font %s = {" % ( name ) -print >> out, " %d," % ( fontWidth ) -print >> out, " %d," % ( fontHeight ) -print >> out, " (const uint8_t*[]){" +out.write("#include \"Font.h\"\n") +out.write("\n") +out.write("const struct Font %s = {" % ( name )) +out.write("\n") +out.write(" %d," % ( fontWidth )) +out.write("\n") +out.write(" %d," % ( fontHeight )) +out.write("\n") +out.write(" (const uint8_t*[]){\n") for c in range (0, 255): if None == fontCharacters[c]: - print >> out, " NULL," + out.write(" NULL,\n") else: - print >> out, " // %s" % (fontCharacterNames[c]) - print >> out, " (const uint8_t[]){" + out.write(" // %s" % (fontCharacterNames[c])) + out.write("\n") + out.write(" (const uint8_t[]){\n") for i in range(0, fontHeight): - print >> out, " 0b%s," % ('{0:08b}'.format(fontCharacters[c][i])) - print >> out, " }," -print >> out, " }" -print >> out, "};" + out.write(" 0b%s," % ('{0:08b}'.format(fontCharacters[c][i]))) + out.write("\n") + out.write(" },\n") +out.write(" }\n") +out.write("};\n") out.close() From 8d32f4edf46d335a289c33c184480830a5695255 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 22 Feb 2024 10:45:33 +0100 Subject: [PATCH 14/32] Add minimum documentation on how to generate a font bitmap. --- README.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.adoc b/README.adoc index a77a80e..eeee79b 100644 --- a/README.adoc +++ b/README.adoc @@ -28,3 +28,10 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +== How-to generate bitmaps from the fonts == +[source,bash] +---- +cd extra +./generate_font.py 5x7.bdf Font_5x7.c Font_5x7 +---- From e9fdae19160c260609f0ff3e1d462cc24eb7ba90 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Thu, 22 Feb 2024 12:25:55 +0100 Subject: [PATCH 15/32] Release v1.1.2. --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index b896c9a..3ee6369 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ArduinoGraphics -version=1.1.1 +version=1.1.2 author=Arduino maintainer=Arduino sentence=Core graphics library for Arduino. From e0928dab86af9feeaa91448093b3650766c3a013 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 14:47:56 +0100 Subject: [PATCH 16/32] Bump geekyeggo/delete-artifact from 4 to 5 (#43) Bumps [geekyeggo/delete-artifact](https://github.com/geekyeggo/delete-artifact) from 4 to 5. - [Release notes](https://github.com/geekyeggo/delete-artifact/releases) - [Changelog](https://github.com/GeekyEggo/delete-artifact/blob/main/CHANGELOG.md) - [Commits](https://github.com/geekyeggo/delete-artifact/compare/v4...v5) --- updated-dependencies: - dependency-name: geekyeggo/delete-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 47ac50a..53a9f54 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -114,7 +114,7 @@ jobs: path: ${{ env.CONFIGURATIONS_FOLDER }} - name: Remove unneeded artifact - uses: geekyeggo/delete-artifact@v4 + uses: geekyeggo/delete-artifact@v5 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} From bdfd5040817575e5f46399be34b4ac3616443aa6 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 28 May 2024 02:26:51 -0700 Subject: [PATCH 17/32] Remove superfluous blank lines from documentation Previously, the documentation contained a large number of unnecessary blank lines. Since these serve no purpose and give the source content an unprofessional and sloppy appearance, they are removed. --- docs/api.md | 137 ---------------------------------------------------- 1 file changed, 137 deletions(-) diff --git a/docs/api.md b/docs/api.md index a870920..6940ae4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -6,7 +6,6 @@ #### Description - Initializes the graphics device. #### Syntax @@ -15,7 +14,6 @@ Initializes the graphics device. YourScreen.begin() ``` - #### Parameters None @@ -33,8 +31,6 @@ if (!YourScreen.begin() { } ``` - - ### `end()` #### Description @@ -45,16 +41,12 @@ Stops the graphics device. ``` YourScreen.end() - ``` - #### Parameters - None - #### Returns Nothing @@ -65,26 +57,20 @@ Nothing YourScreen.end(); ``` - - ### `width()` #### Description - Returns the pixel width of the graphics device. #### Syntax ``` YourScreen.width() - ``` - #### Parameters - None #### Returns @@ -97,25 +83,20 @@ Returns the pixel width of the graphics device. int w = YourScreen.width(); ``` - ### `height()` #### Description - Returns the pixel height of the graphics device. #### Syntax ``` YourScreen.height() - ``` - #### Parameters - None #### Returns @@ -128,62 +109,48 @@ Returns the pixel height of the graphics device. int h = YourScreen.height(); ``` - ### `beginDraw()` #### Description - Begins a drawing operation. #### Syntax ``` YourScreen.beginDraw() - ``` - #### Parameters - None - #### Returns Nothing #### Example - YourScreen.beginDraw(); YourScreen.set(0, 0, 255, 0, 0); YourScreen.endDraw(); - - ### `endDraw()` #### Description - Ends a drawing operation, any drawing operations after beginDraw() is called will be displayed to the screen. #### Syntax ``` YourScreen.endDraw() - ``` - #### Parameters - None - #### Returns Nothing @@ -196,12 +163,10 @@ YourScreen.set(0, 0, 255, 0, 0); YourScreen.endDraw(); ``` - ### `background()` #### Description - Set the background color of drawing operations. Used when calling clear() or drawing text. #### Syntax @@ -209,13 +174,10 @@ Set the background color of drawing operations. Used when calling clear() or dra ``` YourScreen.background(r, g, b) YourScreen.background(color) - ``` - #### Parameters - - r: red color value (0 - 255) - g: green color value (0 - 255) - b: blue color value (0 - 255) @@ -234,28 +196,22 @@ YourScreen.clear(); YourScreen.endDraw(); ``` - ### `clear()` #### Description - Set clear the screen contents, uses the background colour set in background(). #### Syntax ``` YourScreen.clear() - ``` - #### Parameters - None - #### Returns Nothing @@ -269,13 +225,10 @@ YourScreen.clear(); YourScreen.endDraw(); ``` - - ### `fill()` #### Description - Set the fill color of drawing operations. #### Syntax @@ -283,13 +236,10 @@ Set the fill color of drawing operations. ``` YourScreen.fill(r, g, b) YourScreen.fill(color) - ``` - #### Parameters - - r: red color value (0 - 255) - g: green color value (0 - 255) - b: blue color value (0 - 255) @@ -310,28 +260,22 @@ YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height()); YourScreen.endDraw(); ``` - ### `noFill()` #### Description - Clears the fill color of drawing operations. #### Syntax ``` YourScreen.noFill() - ``` - #### Parameters - None - #### Returns Nothing @@ -347,12 +291,10 @@ YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height()); YourScreen.endDraw(); ``` - ### `stroke()` #### Description - Set the stroke color of drawing operations. #### Syntax @@ -360,13 +302,10 @@ Set the stroke color of drawing operations. ``` YourScreen.stroke(r, g, b) YourScreen.stroke(color) - ``` - #### Parameters - - r: red color value (0 - 255) - g: green color value (0 - 255) - b: blue color value (0 - 255) @@ -387,29 +326,22 @@ YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height()); YourScreen.endDraw(); ``` - - ### `noStroke()` #### Description - Clears the stroke color of drawing operations. #### Syntax ``` YourScreen.noStroke() - ``` - #### Parameters - None - #### Returns Nothing @@ -425,25 +357,20 @@ YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height()); YourScreen.endDraw(); ``` - ### `line()` #### Description - Stroke a line, uses the stroke color set in stroke(). #### Syntax ``` YourScreen.line(x1, y1, x2, y2) - ``` - #### Parameters - - x1: x position of the starting point of the line - y1: y position of the starting point of the line - x2: x position of the end point of the line @@ -463,25 +390,20 @@ YourScreen.line(0, 0, YourScreen.width() - 1, YourScreen.height() - 1); YourScreen.endDraw(); ``` - ### `point()` #### Description - Stroke a point, uses the stroke color set in stroke(). #### Syntax ``` YourScreen.point(x, y) - ``` - #### Parameters - x: x position of the point y: y position of the point @@ -499,25 +421,20 @@ YourScreen.point(1, 1); YourScreen.endDraw(); ``` - ### `rect()` #### Description - Stroke and fill a rectangle, uses the stroke color set in stroke() and the fill color set in fill(). #### Syntax ``` YourScreen.rect(x, y, width, height) - ``` - #### Parameters - - x: x position of the rectangle - y: y position of the rectangle - width: width of the rectangle @@ -538,25 +455,20 @@ YourScreen.rect(0, 0, YourScreen.width(), YourScreen.height()); YourScreen.endDraw(); ``` - ### `circle()` #### Description - Stroke and fill a circle, uses the stroke color set in stroke() and the fill color set in fill(). #### Syntax ``` YourScreen.circle(x, y, diameter) - ``` - #### Parameters - - x: x center position of the circle - y: y center position of the circle - diameter: diameter of the circle @@ -576,25 +488,20 @@ YourScreen.circle(YourScreen.width()/2, YourScreen.height()/2, YourScreen.height YourScreen.endDraw(); ``` - ### `ellipse()` #### Description - Stroke and fill an ellipse, uses the stroke color set in stroke() and the fill color set in fill(). #### Syntax ``` YourScreen.ellipse(x, y, width, height) - ``` - #### Parameters - - x: x center position of the ellipse - y: y center position of the ellipse - width: width of the ellipse @@ -615,12 +522,10 @@ YourScreen.ellipse(YourScreen.width()/2, YourScreen.height()/2, YourScreen.width YourScreen.endDraw(); ``` - ### `text()` #### Description - Draw some text, uses the stroke color set in stroke() and the background color set in background(). #### Syntax @@ -628,13 +533,10 @@ Draw some text, uses the stroke color set in stroke() and the background color s ``` YourScreen.text(string) YourScreen.text(string, x, y) - ``` - #### Parameters - - string: string to draw - x: x position for the start of the text - y: y position for the start of the text @@ -653,28 +555,22 @@ YourScreen.text("abc", 0, 1); YourScreen.endDraw(); ``` - ### `textFont()` #### Description - Sets the font uses for text. The library current has the Font_4x6 and Font_5x7 built in. #### Syntax ``` YourScreen.textFont(font) - ``` - #### Parameters - font: font to set - #### Returns Nothing @@ -690,12 +586,10 @@ YourScreen.text("abc", 0, 1); YourScreen.endDraw(); ``` - ### `textFontWidth()` #### Description - Returns the width, in pixels, of the current font. #### Syntax @@ -705,13 +599,10 @@ YourScreen.textFontWidth() ``` - #### Parameters - None - #### Returns Nothing @@ -722,28 +613,22 @@ Nothing int w = YourScreen.textFontWidth(); ``` - ### `textFontHeight()` #### Description - Returns the height, in pixels, of the current font. #### Syntax ``` YourScreen.textFontHeight() - ``` - #### Parameters - None - #### Returns Nothing @@ -754,12 +639,10 @@ Nothing int h = YourScreen.textFontHeight(); ``` - ### `set()` #### Description - Set a pixel’s color value. #### Syntax @@ -767,13 +650,10 @@ Set a pixel’s color value. ``` YourScreen.set(x, y, r, g, b) YourScreen.set(x, y, color) - ``` - #### Parameters - x: x position of the pixel y: y position of the pixel r: red color value (0 - 255) @@ -793,12 +673,10 @@ YourScreen.point(1, 1, 0, 255, 0); YourScreen.endDraw(); ``` - ### `beginText()` #### Description - Start the process of displaying and optionally scrolling text. The Print interface can be used to set the text. #### Syntax @@ -807,13 +685,10 @@ Start the process of displaying and optionally scrolling text. The Print interfa YourScreen.beginText() YourScreen.beginText(x, y, r, g, b) YourScreen.beginText(x, y, color) - ``` - #### Parameters - x: x position of the text y: y position of the text r: red color value (0 - 255) @@ -833,12 +708,10 @@ YourScreen.print("Hi"); YourScreen.endText(); ``` - ### `endText()` #### Description - End the process of displaying and optionally scrolling text. #### Syntax @@ -846,13 +719,10 @@ End the process of displaying and optionally scrolling text. ``` YourScreen.endText() YourScreen.endText(scrollDirection) - ``` - #### Parameters - scrollDirection: (optional) the direction to scroll, defaults to NO_SCROLL if not provided. Valid options are NO_SCROLL, SCROLL_LEFT, SCROLL_RIGHT, SCROLL_UP, SCROLL_DOWN #### Returns @@ -867,28 +737,22 @@ YourScreen.print("Hi"); YourScreen.endText(); ``` - ### `textScrollSpeed()` #### Description - Sets the text scrolling speed, the speed controls the delay in milliseconds between scrolling each pixel. #### Syntax ``` YourScreen.textScrollSpeed(speed) - ``` - #### Parameters - speed: scroll speed - #### Returns Nothing @@ -901,4 +765,3 @@ YourScreen.textScrollSpeed(500); YourScreen.print("Hello There!"); YourScreen.endText(true); ``` - From df7a773e51f43ff8c39929b0e268cfc60c46a8f7 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 28 May 2024 02:28:38 -0700 Subject: [PATCH 18/32] Correct syntax errors in documentation code snippet --- docs/api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api.md b/docs/api.md index 6940ae4..f4d9b59 100644 --- a/docs/api.md +++ b/docs/api.md @@ -25,8 +25,8 @@ None #### Example ``` -if (!YourScreen.begin() { - Serial.println(“Failed to initialize the display!”); +if (!YourScreen.begin()) { + Serial.println("Failed to initialize the display!"); while (1); } ``` From 96b58bb28fc38e68e6c2cde76687642e82c20269 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 28 May 2024 02:35:13 -0700 Subject: [PATCH 19/32] Add missing markup to API documentation --- docs/api.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api.md b/docs/api.md index f4d9b59..cc2e698 100644 --- a/docs/api.md +++ b/docs/api.md @@ -131,9 +131,11 @@ Nothing #### Example +``` YourScreen.beginDraw(); YourScreen.set(0, 0, 255, 0, 0); YourScreen.endDraw(); +``` ### `endDraw()` From a3e7f1eb86f15b1e6aa090a8ee2c15e2305d8cdf Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 28 May 2024 02:35:45 -0700 Subject: [PATCH 20/32] Fix typos in documentation --- README.adoc | 2 +- docs/api.md | 4 ++-- docs/readme.md | 2 +- extras/generate_font.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.adoc b/README.adoc index eeee79b..83baac9 100644 --- a/README.adoc +++ b/README.adoc @@ -32,6 +32,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA == How-to generate bitmaps from the fonts == [source,bash] ---- -cd extra +cd extras ./generate_font.py 5x7.bdf Font_5x7.c Font_5x7 ---- diff --git a/docs/api.md b/docs/api.md index cc2e698..db063a3 100644 --- a/docs/api.md +++ b/docs/api.md @@ -202,7 +202,7 @@ YourScreen.endDraw(); #### Description -Set clear the screen contents, uses the background colour set in background(). +Clear the screen contents, uses the background colour set in background(). #### Syntax @@ -561,7 +561,7 @@ YourScreen.endDraw(); #### Description -Sets the font uses for text. The library current has the Font_4x6 and Font_5x7 built in. +Sets the font used for text. The library current has the Font_4x6 and Font_5x7 built in. #### Syntax diff --git a/docs/readme.md b/docs/readme.md index 92ff8db..4260bca 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,6 +1,6 @@ # Arduino Graphics Library -This is a library that allows you to draw and write on screens with graphical primitives; it requires a specific hardware interfacce library to drive the screen you are using, therefore every screen type should have its own hardware specific library. +This is a library that allows you to draw and write on screens with graphical primitives; it requires a specific hardware interface library to drive the screen you are using, therefore every screen type should have its own hardware specific library. To use this library diff --git a/extras/generate_font.py b/extras/generate_font.py index 016f634..48efb84 100755 --- a/extras/generate_font.py +++ b/extras/generate_font.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# This file is part of the MKRRGBMatrix library. +# This file is part of the ArduinoGraphics library. # Copyright (c) 2018 Arduino SA. All rights reserved. # # This library is free software; you can redistribute it and/or From 0ea3666b05e5573ad9ae8148050dc62b560716eb Mon Sep 17 00:00:00 2001 From: kurte Date: Sun, 11 Aug 2024 16:58:55 -0700 Subject: [PATCH 21/32] Allow the fixed fonts to be scaled up. On larger displays, the two built in fonts are almost invisible. One possible solution is to supply some larger fonts. Another approach is to do, like several TFT display drivers do and allow you to scale the system fixed fonts up to a larger size. Decided this was the easiest approach, and did a quick implementation of it. Like the Adafruit displays, I allowed you to set different scale factors for X and Y. I added a scaledBitmap function which is a modified version of the current bitmap function. I also changed all of the text functions to use it. I left the unscalled version of the API, although I have it simply call the scaled version with scales 1 and 1, as since these methods are virtual, potentially some other subclasses might use and/or implement their own version. Updated the textFontWidth and textFontHeight to multiply the height * the scale as the one example sketch here needs it. I also updated the sketch to scale the canvas to take the font size into account. This appears to work with the changes and I have not used or tested the scroll code. Its sizing should be updated teh same way the test sketch was with the changes with the textFontWidth and textFontHeight changes Update api.md Forgot to update the AsciiDraw example sketch Code Review requested changes _textsize_x -> _textSizeX (ditto for y) setTextSize() -> textSize() scaledBitmap -> bitmap with the extra parameters with defaults --- docs/api.md | 35 ++++++++++++++++++++ examples/ASCIIDraw/ASCIIDraw.ino | 6 ++-- src/ArduinoGraphics.cpp | 57 ++++++++++++++++++++------------ src/ArduinoGraphics.h | 7 +++- 4 files changed, 81 insertions(+), 24 deletions(-) diff --git a/docs/api.md b/docs/api.md index db063a3..8827301 100644 --- a/docs/api.md +++ b/docs/api.md @@ -641,6 +641,41 @@ Nothing int h = YourScreen.textFontHeight(); ``` +### `textSize()` + +#### Description + +Set a text scale factor + +#### Syntax + +``` +YourScreen.textSize(scale) +YourScreen.textSize(scaleX, scaleY) +``` + +#### Parameters + +scale: scale factor used for both x and y +scaleX: x scale factor +scaleY: y scale factor + +#### Returns + +Nothing + +#### Example + +``` +YourScreen.beginDraw(); +YourScreen.clear(); +YourScreen.stroke(255, 255, 255); +YourScreen.textFont(Font_5x7); +YourScreen.textSize(5); +YourScreen.text("abc", 0, 1); +YourScreen.endDraw(); +``` + ### `set()` #### Description diff --git a/examples/ASCIIDraw/ASCIIDraw.ino b/examples/ASCIIDraw/ASCIIDraw.ino index 398a40d..dfb6bb3 100644 --- a/examples/ASCIIDraw/ASCIIDraw.ino +++ b/examples/ASCIIDraw/ASCIIDraw.ino @@ -14,8 +14,9 @@ #include -const byte canvasWidth = 61; -const byte canvasHeight = 27; +const byte fontSize = 3; +const byte canvasWidth = fontSize * (5 * 7) + 26; +const byte canvasHeight = fontSize * 7 + 20; class ASCIIDrawClass : public ArduinoGraphics { public: @@ -85,6 +86,7 @@ void setup() { ASCIIDraw.stroke('@', 0, 0); const char text[] = "ARDUINO"; ASCIIDraw.textFont(Font_5x7); + ASCIIDraw.textSize(fontSize); const byte textWidth = strlen(text) * ASCIIDraw.textFontWidth(); const byte textHeight = ASCIIDraw.textFontHeight(); const byte textX = (canvasWidth - textWidth) / 2; diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index b47c2b5..8ed68a0 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -26,7 +26,9 @@ ArduinoGraphics::ArduinoGraphics(int width, int height) : _width(width), _height(height), - _font(NULL) + _font(NULL), + _textSizeX(1), + _textSizeY(1) { } @@ -241,7 +243,7 @@ void ArduinoGraphics::text(const char* str, int x, int y) uint8_t const c = (uint8_t)*str++; if (c == '\n') { - y += _font->height; + y += _font->height * _textSizeY; } else if (c == '\r') { x = 0; } else if (c == 0xc2 || c == 0xc3) { @@ -254,10 +256,10 @@ void ArduinoGraphics::text(const char* str, int x, int y) } if (b) { - bitmap(b, x, y, _font->width, _font->height); + bitmap(b, x, y, _font->width, _font->height, _textSizeX, _textSizeY); } - x += _font->width; + x += _font->width * _textSizeX; } } } @@ -269,38 +271,51 @@ void ArduinoGraphics::textFont(const Font& which) int ArduinoGraphics::textFontWidth() const { - return (_font ? _font->width : 0); + return (_font ? _font->width * _textSizeX : 0); } int ArduinoGraphics::textFontHeight() const { - return (_font ? _font->height : 0); + return (_font ? _font->height* _textSizeY : 0); } -void ArduinoGraphics::bitmap(const uint8_t* data, int x, int y, int width, int height) +void ArduinoGraphics::textSize(uint8_t sx, uint8_t sy) { - if (!_stroke) { + _textSizeX = (sx > 0)? sx : 1; + _textSizeY = (sy > 0)? sy : 1; +} + + +void ArduinoGraphics::bitmap(const uint8_t* data, int x, int y, int w, int h, uint8_t scale_x, uint8_t scale_y) { + if (!_stroke || !scale_x || !scale_y) { return; } - if ((data == NULL) || ((x + width) < 0) || ((y + height) < 0) || (x > _width) || (y > _height)) { + if ((data == nullptr) || ((x + (w * scale_x) < 0)) || ((y + (h * scale_y) < 0)) || (x > _width) || (y > _height)) { // offscreen return; } - for (int j = 0; j < height; j++) { + int xStart = x; + for (int j = 0; j < h; j++) { uint8_t b = data[j]; - - for (int i = 0; i < width; i++) { - if (b & (1 << (7 - i))) { - set(x + i, y + j, _strokeR, _strokeG, _strokeB); - } else { - set(x + i, y + j, _backgroundR, _backgroundG, _backgroundB); + for (uint8_t ys = 0; ys < scale_y; ys++) { + if (ys >= _height) return; + x = xStart; // reset for each row + for (int i = 0; i < w; i++) { + if (b & (1 << (7 - i))) { + for (uint8_t xs = 0; xs < scale_x; xs++) set(x++, y, _strokeR, _strokeG, _strokeB); + } else { + for (uint8_t xs = 0; xs < scale_x; xs++) set(x++, y, _backgroundR, _backgroundG, _backgroundB); + } + if (x >= _width) break; } + y++; } } } + void ArduinoGraphics::imageRGB(const Image& img, int x, int y, int width, int height) { const uint8_t* data = img.data(); @@ -359,7 +374,7 @@ void ArduinoGraphics::image(const Image& img, int x, int y) void ArduinoGraphics::image(const Image& img, int x, int y, int width, int height) { - if (!img || ((x + width) < 0) || ((y + height) < 0) || (x > _width) || (y > height)) { + if (!img || ((x + width) < 0) || ((y + height) < 0) || (x > _width) || (y > _height)) { // offscreen return; } @@ -438,7 +453,7 @@ void ArduinoGraphics::endText(int scrollDirection) beginDraw(); int const text_x = _textX - i; text(_textBuffer, text_x, _textY); - bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height, _textSizeX, _textSizeY); endDraw(); delay(_textScrollSpeed); @@ -450,7 +465,7 @@ void ArduinoGraphics::endText(int scrollDirection) beginDraw(); int const text_x = _textX - (scrollLength - i - 1); text(_textBuffer, text_x, _textY); - bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height, _textSizeX, _textSizeY); endDraw(); delay(_textScrollSpeed); @@ -462,7 +477,7 @@ void ArduinoGraphics::endText(int scrollDirection) beginDraw(); int const text_y = _textY - i; text(_textBuffer, _textX, text_y); - bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1, _textSizeX, _textSizeY); endDraw(); delay(_textScrollSpeed); @@ -474,7 +489,7 @@ void ArduinoGraphics::endText(int scrollDirection) beginDraw(); int const text_y = _textY - (scrollLength - i - 1); text(_textBuffer, _textX, text_y); - bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1, _textSizeX, _textSizeY); endDraw(); delay(_textScrollSpeed); diff --git a/src/ArduinoGraphics.h b/src/ArduinoGraphics.h index 1f1c914..3386dfa 100644 --- a/src/ArduinoGraphics.h +++ b/src/ArduinoGraphics.h @@ -70,6 +70,8 @@ class ArduinoGraphics : public Print { virtual void text(const char* str, int x = 0, int y = 0); virtual void text(const String& str, int x = 0, int y = 0) { text(str.c_str(), x, y); } virtual void textFont(const Font& which); + virtual void textSize(uint8_t s) {textSize(s, s);} + virtual void textSize(uint8_t sx, uint8_t sy); virtual int textFontWidth() const; virtual int textFontHeight() const; @@ -91,7 +93,8 @@ class ArduinoGraphics : public Print { virtual void textScrollSpeed(unsigned long speed = 150); protected: - virtual void bitmap(const uint8_t* data, int x, int y, int width, int height); + virtual void bitmap(const uint8_t* data, int x, int y, int w, int h, uint8_t scale_x = 1, + uint8_t scale_y = 1); virtual void imageRGB(const Image& img, int x, int y, int width, int height); virtual void imageRGB24(const Image& img, int x, int y, int width, int height); virtual void imageRGB16(const Image& img, int x, int y, int width, int height); @@ -114,6 +117,8 @@ class ArduinoGraphics : public Print { uint8_t _textR, _textG, _textB; int _textX; int _textY; + uint8_t _textSizeX; + uint8_t _textSizeY; unsigned long _textScrollSpeed; }; From 676f83ca7a9a766d246a98be7d8d2f232a259d8e Mon Sep 17 00:00:00 2001 From: Omar Ali Hassan <36759605+OmarAli3@users.noreply.github.com> Date: Mon, 30 Mar 2020 12:17:59 +0200 Subject: [PATCH 22/32] add function to clear specific point --- src/ArduinoGraphics.cpp | 5 +++++ src/ArduinoGraphics.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 8ed68a0..852c273 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -96,6 +96,11 @@ void ArduinoGraphics::clear() } } +void ArduinoGraphics::clear(int x, int y) +{ + set(x, y, _backgroundR, _backgroundB, _backgroundG); +} + void ArduinoGraphics::fill(uint8_t r, uint8_t g, uint8_t b) { _fill = true; diff --git a/src/ArduinoGraphics.h b/src/ArduinoGraphics.h index 3386dfa..69166e6 100644 --- a/src/ArduinoGraphics.h +++ b/src/ArduinoGraphics.h @@ -51,6 +51,7 @@ class ArduinoGraphics : public Print { void background(uint8_t r, uint8_t g, uint8_t b); void background(uint32_t color); void clear(); + void clear(int x, int y); //clear specific point void fill(uint8_t r, uint8_t g, uint8_t b); void fill(uint32_t color); void noFill(); From 04aa61b5a337a6a13143fe1d8af1b5c36acb1e20 Mon Sep 17 00:00:00 2001 From: Omar Ali Hassan Date: Wed, 4 Sep 2024 09:38:09 -0700 Subject: [PATCH 23/32] Update src/ArduinoGraphics.h to remove unnecessary comment Co-authored-by: Leonardo Cavagnis <45899760+leonardocavagnis@users.noreply.github.com> --- src/ArduinoGraphics.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ArduinoGraphics.h b/src/ArduinoGraphics.h index 69166e6..6776f86 100644 --- a/src/ArduinoGraphics.h +++ b/src/ArduinoGraphics.h @@ -51,7 +51,7 @@ class ArduinoGraphics : public Print { void background(uint8_t r, uint8_t g, uint8_t b); void background(uint32_t color); void clear(); - void clear(int x, int y); //clear specific point + void clear(int x, int y); void fill(uint8_t r, uint8_t g, uint8_t b); void fill(uint32_t color); void noFill(); From 4572a10257e34de1e5e60b2ea306336e23212eaf Mon Sep 17 00:00:00 2001 From: Omar Ali Date: Wed, 4 Sep 2024 20:00:52 +0300 Subject: [PATCH 24/32] Update API documentation for clear() method --- docs/api.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/api.md b/docs/api.md index 8827301..004b2b6 100644 --- a/docs/api.md +++ b/docs/api.md @@ -202,17 +202,19 @@ YourScreen.endDraw(); #### Description -Clear the screen contents, uses the background colour set in background(). +Clear the screen contents or a specific pixel, uses the background colour set in background(). #### Syntax ``` YourScreen.clear() +YourScreen.clear(x, y) ``` #### Parameters -None +- x: x position of the pixel to clear +- y: y position of the pixel to clear #### Returns From 5696697fabd30e2d60679d1c2856180ff8911864 Mon Sep 17 00:00:00 2001 From: Leonardo Cavagnis <45899760+leonardocavagnis@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:37:29 +0200 Subject: [PATCH 25/32] Update library.properties Release v1.1.3. --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 3ee6369..8378e06 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ArduinoGraphics -version=1.1.2 +version=1.1.3 author=Arduino maintainer=Arduino sentence=Core graphics library for Arduino. From 206c7269b637bc963b0d1a2170fc7071264a6694 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 02:47:02 +0000 Subject: [PATCH 26/32] Bump arduino/arduino-lint-action from 1 to 2 Bumps [arduino/arduino-lint-action](https://github.com/arduino/arduino-lint-action) from 1 to 2. - [Release notes](https://github.com/arduino/arduino-lint-action/releases) - [Commits](https://github.com/arduino/arduino-lint-action/compare/v1...v2) --- updated-dependencies: - dependency-name: arduino/arduino-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/check-arduino.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-arduino.yml b/.github/workflows/check-arduino.yml index adb330f..e818685 100644 --- a/.github/workflows/check-arduino.yml +++ b/.github/workflows/check-arduino.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v4 - name: Arduino Lint - uses: arduino/arduino-lint-action@v1 + uses: arduino/arduino-lint-action@v2 with: compliance: specification library-manager: update From 9b2d4143b83f088b06e084b057b5a7fb8db73883 Mon Sep 17 00:00:00 2001 From: seaxwi <71350948+seaxwi@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:03:29 +0100 Subject: [PATCH 27/32] Declare compatibility with renesas_uno architecture --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 8378e06..0495428 100644 --- a/library.properties +++ b/library.properties @@ -6,5 +6,5 @@ sentence=Core graphics library for Arduino. paragraph=Based on the Processing API. category=Display url=http://github.com/arduino-libraries/ArduinoGraphics -architectures=samd +architectures=samd,renesas_uno includes=ArduinoGraphics.h From e0415f19cf540edd901bce76ba37f52e54440898 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 11 Feb 2025 21:50:42 -0800 Subject: [PATCH 28/32] Correct scroll length for left and up directions Previously, the calculation for the distance of leftward and upward scrolling resulted in the text bitmap not being scrolled completely off the display. For leftward scrolling, this would be noticeable in the case where the bitmap of the last character in the string had populated pixels on the rightmost column. For upward scrolling, this would be noticeable in the case where the bitmap of any character in the string had populated pixels on the bottom row. --- src/ArduinoGraphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 852c273..eef26da 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -452,7 +452,7 @@ void ArduinoGraphics::endText(int scrollDirection) stroke(_textR, _textG, _textB); if (scrollDirection == SCROLL_LEFT) { - int scrollLength = _textBuffer.length() * textFontWidth() + _textX; + int scrollLength = _textBuffer.length() * textFontWidth() + _textX + 1; for (int i = 0; i < scrollLength; i++) { beginDraw(); @@ -476,7 +476,7 @@ void ArduinoGraphics::endText(int scrollDirection) delay(_textScrollSpeed); } } else if (scrollDirection == SCROLL_UP) { - int scrollLength = textFontHeight() + _textY; + int scrollLength = textFontHeight() + _textY + 1; for (int i = 0; i < scrollLength; i++) { beginDraw(); From ce5ac8ec6497ceffc0c2e91432d8b15fd4bdd0bc Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 10 Feb 2025 19:12:43 -0800 Subject: [PATCH 29/32] Correct text scroll trail clearing coordinates calculation for left and up directions The `endText` function has the capability to scroll the printed text. In order to ensure artifacts are not left behind on the display while scrolling, the library must clear the pixels at the previous location of the text after each frame of the scrolling animation. Previously, the code to handle this clearing incorrectly calculated the clearing coordinates for the leftwards (`SCROLL_LEFT`) and upwards (`SCROLL_UP`) scroll directions, having two separate problems: * The offset was subtracted rather than added. * An offset of 1 was used, which did not consider the width/height of the text. This bug might not be immediately apparent to the user because many character bitmaps do not populate any pixels on the rightmost column or bottom row of the grid, and thus those characters provide incidental self scroll trail clearing. However, this is not the case for all characters and those would cause a trail of artifacts to be left behind on the display when scrolled. The clearing coordinates calculation code is hereby corrected. NOTE: The coordinates calculation will still be incorrect for multi-line strings. However, this is not a regression because it was also incorrect before this change. The scroll trail clearing code has never had any provisions for handling multi-line strings so addition of such support is out of scope for this commit. In addition, the text scrolling code (not the scroll trail clearing code) has never correctly handled horizontal scrolling of multi-line strings, so until that is fixed it is only the lack of correct scroll trail clearing for vertical scrolling that is impactful to users. --- src/ArduinoGraphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 852c273..06f61da 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -458,7 +458,7 @@ void ArduinoGraphics::endText(int scrollDirection) beginDraw(); int const text_x = _textX - i; text(_textBuffer, text_x, _textY); - bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height, _textSizeX, _textSizeY); + bitmap(_font->data[0x20], text_x + _textBuffer.length() * _font->width, _textY, 1, _font->height, _textSizeX, _textSizeY); endDraw(); delay(_textScrollSpeed); @@ -482,7 +482,7 @@ void ArduinoGraphics::endText(int scrollDirection) beginDraw(); int const text_y = _textY - i; text(_textBuffer, _textX, text_y); - bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1, _textSizeX, _textSizeY); + bitmap(_font->data[0x20], _textX, text_y + _font->height, _font->width, 1, _textSizeX, _textSizeY); endDraw(); delay(_textScrollSpeed); From 83d6df0c238e9b39b40c3835f74897d62eba2409 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 10 Feb 2025 21:18:11 -0800 Subject: [PATCH 30/32] Clear trail for full string width when scrolling text vertically The `endText` function has the capability to scroll the printed text. In order to ensure artifacts are not left behind on the display while scrolling, the library must clear the pixels at the previous location of the text after each frame of the scrolling animation. Previously, the code to handle this clearing for vertical scrolling only cleared a single character's width. This meant that scroll trail clearing was only done for the first character in the string. This bug might not be immediately apparent to the user because many character bitmaps do not populate any pixels on the top or bottom row of the grid, and thus those characters provide incidental self scroll trail clearing. However, this is not the case for all characters and those would cause a trail of artifacts to be left behind on the display when scrolled. The vertical scroll trail clearing code is hereby corrected to cover the full width of the string. Previously the `ArduinoGraphics::bitmap` function was used by the clearing code. That approach was reasonable for clearing the scroll trail of a single character, but due to the function's eight pixel width limitation, it is not suitable to use with strings. In this application where a line of arbitrary length, but only one pixel thick is needed, the `ArduinoGraphics::line` function is the suitable tool. So the code is ported to using `ArduinoGraphics::line`. NOTE: The calculations of the length of the clearing line will still be incorrect for multi-line strings. However, this is not a regression because it was also incorrect before this change. The scroll trail clearing code has never had any provisions for handling multi-line strings so adding such support is out of scope for this commit. In addition, the text scrolling code (not the scroll trail clearing code) has never correctly handled horizontal scrolling of multi-line strings, so until that is fixed it is only the lack of correct scroll trail clearing for vertical scrolling that is impactful to users. --- .codespellrc | 2 +- src/ArduinoGraphics.cpp | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.codespellrc b/.codespellrc index 33d69d0..a41b93c 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,7 +1,7 @@ # See: https://github.com/codespell-project/codespell#using-a-config-file [codespell] # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: -ignore-words-list = mis +ignore-words-list = cleary,mis check-filenames = check-hidden = skip = ./.git diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 06f61da..89083c0 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -448,17 +448,21 @@ void ArduinoGraphics::endText(int scrollDirection) uint8_t strokeG = _strokeG; uint8_t strokeB = _strokeB; - - stroke(_textR, _textG, _textB); - if (scrollDirection == SCROLL_LEFT) { int scrollLength = _textBuffer.length() * textFontWidth() + _textX; for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_x = _textX - i; + stroke(_textR, _textG, _textB); text(_textBuffer, text_x, _textY); - bitmap(_font->data[0x20], text_x + _textBuffer.length() * _font->width, _textY, 1, _font->height, _textSizeX, _textSizeY); + + // clear previous position + const int clearX = text_x + _textBuffer.length() * _font->width; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(clearX, _textY, clearX, _textY + _font->height - 1); + endDraw(); delay(_textScrollSpeed); @@ -468,9 +472,18 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_x = _textX - (scrollLength - i - 1); + stroke(_textR, _textG, _textB); text(_textBuffer, text_x, _textY); + + // clear previous position + const int clearX = text_x - 1; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(clearX, _textY, clearX, _textY + _font->height - 1); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height, _textSizeX, _textSizeY); + endDraw(); delay(_textScrollSpeed); @@ -480,9 +493,16 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_y = _textY - i; + stroke(_textR, _textG, _textB); text(_textBuffer, _textX, text_y); - bitmap(_font->data[0x20], _textX, text_y + _font->height, _font->width, 1, _textSizeX, _textSizeY); + + // clear previous position + const int clearY = text_y + _font->height; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(_textX, clearY, _textX + (_font->width * _textBuffer.length()) - 1, clearY); + endDraw(); delay(_textScrollSpeed); @@ -492,8 +512,16 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_y = _textY - (scrollLength - i - 1); + stroke(_textR, _textG, _textB); text(_textBuffer, _textX, text_y); + + // clear previous position + const int clearY = text_y - 1; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(_textX, clearY, _textX + (_font->width * _textBuffer.length()) - 1, clearY); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1, _textSizeX, _textSizeY); endDraw(); @@ -501,6 +529,7 @@ void ArduinoGraphics::endText(int scrollDirection) } } else { beginDraw(); + stroke(_textR, _textG, _textB); text(_textBuffer, _textX, _textY); endDraw(); } From a6eecc7c84cd7835323e635f44bd11ab6ec929e1 Mon Sep 17 00:00:00 2001 From: Leonardo Cavagnis <45899760+leonardocavagnis@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:41:31 +0200 Subject: [PATCH 31/32] Fix license to MPL-2.0 (#53) * update license to MPL-2.0 * Update README.md --- LICENSE | 373 ++++++++++++++++++++++++++++++++++++++++ README.adoc | 37 ---- README.md | 9 + docs/readme.md | 9 +- src/ArduinoGraphics.cpp | 16 +- src/ArduinoGraphics.h | 16 +- src/Font.h | 16 +- src/Font_4x6.c | 16 +- src/Font_5x7.c | 16 +- src/Image.cpp | 16 +- src/Image.h | 16 +- 11 files changed, 397 insertions(+), 143 deletions(-) create mode 100644 LICENSE delete mode 100644 README.adoc create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a612ad9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/README.adoc b/README.adoc deleted file mode 100644 index 83baac9..0000000 --- a/README.adoc +++ /dev/null @@ -1,37 +0,0 @@ -:repository-owner: arduino-libraries -:repository-name: ArduinoGraphics - -= {repository-name} Library for Arduino = - -image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml/badge.svg["Check Arduino status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml"] -image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml/badge.svg["Compile Examples status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml"] -image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml/badge.svg["Spell Check status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml"] - -Core graphics library for Arduino. Based on the Processing API. - -For more information about this library please visit us at https://www.arduino.cc/en/Reference/ArduinoGraphics - -== License == - -Copyright (c) 2019 Arduino SA. All rights reserved. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -== How-to generate bitmaps from the fonts == -[source,bash] ----- -cd extras -./generate_font.py 5x7.bdf Font_5x7.c Font_5x7 ----- diff --git a/README.md b/README.md new file mode 100644 index 0000000..b4f164f --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# ArduinoGraphics Library for Arduino + +![Check Arduino status](https://github.com/arduino-libraries/ArduinoGraphics/actions/workflows/check-arduino.yml/badge.svg) +![Compile Examples status](https://github.com/arduino-libraries/ArduinoGraphics/actions/workflows/compile-examples.yml/badge.svg) +![Spell Check status](https://github.com/arduino-libraries/ArduinoGraphics/actions/workflows/spell-check.yml/badge.svg) + +Core graphics library for Arduino. Based on the Processing API. + +📖 For more information about this library please read the documentation [here](./docs/) or visit us at [https://www.arduino.cc/en/Reference/ArduinoGraphics](https://www.arduino.cc/en/Reference/ArduinoGraphics) diff --git a/docs/readme.md b/docs/readme.md index 4260bca..0dd9764 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -10,4 +10,11 @@ To use this library To let you easily understand the usage of the graphics primitives, we are using a dummy screen object named YourScreen that should be substituted with the real one, Eg. MATRIX, OLED, TFT and so on. Refer to the hardware interfacing library of your screen to get more details. -The style and syntax of this library is inspired by [Processing 3](https://processing.org/) and we believe that learning Processing is very helpful to develop complex applications that combine the versatility of Arduino driven hardware with the power of a pc based graphical interface. \ No newline at end of file +The style and syntax of this library is inspired by [Processing 3](https://processing.org/) and we believe that learning Processing is very helpful to develop complex applications that combine the versatility of Arduino driven hardware with the power of a pc based graphical interface. + +## How-to generate bitmaps from the fonts + +```bash +cd extras +./generate_font.py 5x7.bdf Font_5x7.c Font_5x7 +``` \ No newline at end of file diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 5469905..2a62a3a 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -1,20 +1,6 @@ /* This file is part of the ArduinoGraphics library. - Copyright (c) 2019 Arduino SA. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (c) 2025 Arduino SA. All rights reserved. */ #include "ArduinoGraphics.h" diff --git a/src/ArduinoGraphics.h b/src/ArduinoGraphics.h index 6776f86..c409796 100644 --- a/src/ArduinoGraphics.h +++ b/src/ArduinoGraphics.h @@ -1,20 +1,6 @@ /* This file is part of the ArduinoGraphics library. - Copyright (c) 2019 Arduino SA. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (c) 2025 Arduino SA. All rights reserved. */ #ifndef _ARDUINO_GRAPHICS_H diff --git a/src/Font.h b/src/Font.h index f44f9b5..c1d7f46 100644 --- a/src/Font.h +++ b/src/Font.h @@ -1,20 +1,6 @@ /* This file is part of the ArduinoGraphics library. - Copyright (c) 2019 Arduino SA. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (c) 2025 Arduino SA. All rights reserved. */ #ifndef _FONT_H diff --git a/src/Font_4x6.c b/src/Font_4x6.c index 257ef73..407527b 100644 --- a/src/Font_4x6.c +++ b/src/Font_4x6.c @@ -1,20 +1,6 @@ /* This file is part of the ArduinoGraphics library. - Copyright (c) 2019 Arduino SA. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (c) 2025 Arduino SA. All rights reserved. */ #include "Font.h" diff --git a/src/Font_5x7.c b/src/Font_5x7.c index 3c9a31b..a4ee951 100644 --- a/src/Font_5x7.c +++ b/src/Font_5x7.c @@ -1,20 +1,6 @@ /* This file is part of the ArduinoGraphics library. - Copyright (c) 2019 Arduino SA. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (c) 2025 Arduino SA. All rights reserved. */ #include "Font.h" diff --git a/src/Image.cpp b/src/Image.cpp index e7ad1a2..a010491 100644 --- a/src/Image.cpp +++ b/src/Image.cpp @@ -1,20 +1,6 @@ /* This file is part of the ArduinoGraphics library. - Copyright (c) 2019 Arduino SA. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (c) 2025 Arduino SA. All rights reserved. */ #include diff --git a/src/Image.h b/src/Image.h index 0483e8e..c8f478f 100644 --- a/src/Image.h +++ b/src/Image.h @@ -1,20 +1,6 @@ /* This file is part of the ArduinoGraphics library. - Copyright (c) 2019 Arduino SA. All rights reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (c) 2025 Arduino SA. All rights reserved. */ #ifndef _IMAGE_H From 389562f65b48519d3705e985a949a6b61a67ecd2 Mon Sep 17 00:00:00 2001 From: Leonardo Cavagnis <45899760+leonardocavagnis@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:42:43 +0200 Subject: [PATCH 32/32] Update library version to 1.1.4 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 0495428..a6a1080 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ArduinoGraphics -version=1.1.3 +version=1.1.4 author=Arduino maintainer=Arduino sentence=Core graphics library for Arduino.