-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Erik Corry
committed
Nov 10, 2023
1 parent
9d43b32
commit 244e5f8
Showing
25 changed files
with
252 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (C) 2023 Toitware ApS. | ||
// Use of this source code is governed by a Zero-Clause BSD license that can | ||
// be found in the TESTS_LICENSE file. | ||
// Tests for Label that the change box is smaller when we only | ||
// change part of the text. | ||
import bitmap show * | ||
import expect show * | ||
import font | ||
|
||
import host.file | ||
import pixel_display show * | ||
import pixel_display.element show * | ||
import .png_visualizer | ||
|
||
SANS := font.Font.get "sans10" | ||
|
||
main args: | ||
if args.size != 1: | ||
print "Usage: script.toit png-basename" | ||
exit 1 | ||
|
||
basename := args[0] | ||
|
||
driver := TrueColorPngVisualizer 440 240 basename --outline=0xffffff | ||
display := TrueColorPixelDisplay driver | ||
display.background = 0xe0e080 | ||
|
||
heater := file.read_content "tests/third_party/pictogrammers/heater.png" | ||
heater-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-uncompressed.png" | ||
heater-4-bit := file.read_content "tests/third_party/pictogrammers/heater-4-bit.png" | ||
heater-4-bit-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-4-bit-uncompressed.png" | ||
heater-2-bit := file.read_content "tests/third_party/pictogrammers/heater-2-bit.png" | ||
heater-2-bit-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-2-bit-uncompressed.png" | ||
heater-bw := file.read_content "tests/third_party/pictogrammers/heater-bw.png" | ||
heater-bw-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-bw-uncompressed.png" | ||
heater-white-bg := file.read_content "tests/third_party/pictogrammers/heater-white-bg.png" | ||
heater-white-bg-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-white-bg-uncompressed.png" | ||
|
||
display.add (PngElement --x=16 --y=32 heater) | ||
display.add (PngElement --x=100 --y=32 heater-4-bit) | ||
display.add (PngElement --x=184 --y=32 heater-2-bit) | ||
display.add (PngElement --x=268 --y=32 heater-bw) | ||
display.add (PngElement --x=358 --y=32 heater-white-bg) | ||
|
||
display.add (PngElement --x=16 --y=120 heater-uncompressed) | ||
display.add (PngElement --x=100 --y=120 heater-4-bit-uncompressed) | ||
display.add (PngElement --x=184 --y=120 heater-2-bit-uncompressed) | ||
display.add (PngElement --x=268 --y=120 heater-bw-uncompressed) | ||
display.add (PngElement --x=358 --y=120 heater-white-bg-uncompressed) | ||
|
||
display.draw | ||
|
||
driver.write_png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (C) 2023 Toitware ApS. | ||
// Use of this source code is governed by a Zero-Clause BSD license that can | ||
// be found in the TESTS_LICENSE file. | ||
// Tests for Label that the change box is smaller when we only | ||
// change part of the text. | ||
import bitmap show * | ||
import expect show * | ||
import font | ||
|
||
import host.file | ||
import pixel_display show * | ||
import pixel_display.element show * | ||
import .png_visualizer | ||
|
||
SANS := font.Font.get "sans10" | ||
|
||
main args: | ||
if args.size != 1: | ||
print "Usage: script.toit png-basename" | ||
exit 1 | ||
|
||
do args[0] 340 320 | ||
do "$args[0]-rotated" 320 340 | ||
|
||
do basename/string w/int h/int: | ||
driver := TrueColorPngVisualizer w h basename --outline=0xc0c0ff | ||
display := TrueColorPixelDisplay driver | ||
display.background = 0x808080 | ||
|
||
// A 1-bit PNG file that is uncompressed, so we can use the PngRandomAccess | ||
// class to display it straight from flash. | ||
purifier := file.read_content "tests/third_party/pictogrammers/air-purifier-bit-unzip.png" | ||
// A 1-bit PNG file that is compressed, so it takes less flash, but we have | ||
// to decompress it to display it. This file also has an almost-transparent | ||
// background, so we test the code path where we display a 1-bit image with | ||
// a real alpha channel (and it has a gray background in the output). | ||
purifier-compressed := file.read_content "tests/third_party/pictogrammers/air-purifier-bit.png" | ||
|
||
gradient := GradientElement --x=0 --y=0 --angle=160 --w=340 --h=320 --specifiers=[ | ||
GradientSpecifier --color=0xe0e0ff 10, | ||
GradientSpecifier --color=0x8080c0 90, | ||
] | ||
display.add gradient | ||
|
||
display.draw | ||
|
||
label := Label --x=44 --y=44 --label="UP ^" --font=SANS --color=0 | ||
display.add label | ||
png-element := PngElement --x=36 --y=32 purifier | ||
display.add png-element | ||
display.draw | ||
|
||
display.remove png-element | ||
png-element = PngElement --x=36 --y=32 purifier-compressed | ||
display.add png-element | ||
display.draw | ||
|
||
driver.write_png |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Pictogrammers Free License | ||
-------------------------- | ||
|
||
Last Updated: February 1st, 2023 | ||
|
||
This package is released as free, open-source, and GPL friendly by | ||
the [Pictogrammers](https://pictogrammers.com/). You may use it | ||
for commercial projects, open-source projects, or anything really. | ||
|
||
# Icons: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) | ||
Some of the icons are redistributed under the Apache 2.0 license. All other | ||
icons are either redistributed under their respective licenses or are | ||
distributed under the Apache 2.0 license. | ||
|
||
# Fonts: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) | ||
All web and desktop fonts are distributed under the Apache 2.0 license. Web | ||
and desktop fonts contain some icons that are redistributed under the Apache | ||
2.0 license. All other icons are either redistributed under their respective | ||
licenses or are distributed under the Apache 2.0 license. | ||
|
||
# Code: MIT (https://opensource.org/licenses/MIT) | ||
The MIT license applies to all non-font and non-icon files. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.