Created
September 18, 2020 18:29
-
-
Save basuke/53f8b3be5bc49b3dbe48719d06304794 to your computer and use it in GitHub Desktop.
JPEG rotation. Copy piano.jpg from `examples/commodetto/docs/piano.jpg`
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
import JPEG from "commodetto/readJPEG"; | |
import Poco from "commodetto/Poco"; | |
import Resource from "Resource"; | |
import config from "mc/config"; | |
let poco = new Poco(screen, {rotation: config.rotation}); | |
let gray = poco.makeColor(128, 128, 128); | |
poco.begin() | |
poco.fillRectangle(gray, 0, 0, poco.width, poco.height); | |
poco.end(); | |
let jpeg = new JPEG(new Resource("piano.jpg")); | |
let block; | |
while (block = jpeg.read()) { | |
poco.begin(block.x, block.y, block.width, block.height); | |
poco.drawBitmap(block, block.x, block.y); | |
poco.end(); | |
} |
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
{ | |
"include": [ | |
"$(MODDABLE)/examples/manifest_base.json", | |
"$(MODDABLE)/examples/manifest_commodetto.json" | |
], | |
"modules": { | |
"*": [ | |
"./main" | |
], | |
"commodetto/readJPEG": "$(COMMODETTO)/commodettoReadJPEG" | |
}, | |
"data": { | |
"*": [ | |
"./piano" | |
] | |
}, | |
"config": { | |
"rotation": 270 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment