Skip to content

Instantly share code, notes, and snippets.

@anastasiia-kornilova
Created July 28, 2019 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anastasiia-kornilova/b692ce0afa196e15f80d217d2da45bba to your computer and use it in GitHub Desktop.
Save anastasiia-kornilova/b692ce0afa196e15f80d217d2da45bba to your computer and use it in GitHub Desktop.
"Show" method examples.
//rgb32
var photo = getPhoto();
brick.display().show(photo, 160, 120, "rgb32");
script.wait(5000);
//rgb888
pic = []
photo = getPhoto();
l = photo.length;
for (i = 0; i < l; i++) {
var p = photo[i];
pic.push((p&0xff0000)>>16);
pic.push((p&0xff00)>>8);
pic.push((p&0xff));
}
brick.display().show(pic, 160, 120, "rgb888");
script.wait(5000);
//grayscale8
pic = []
photo = getPhoto();
l = photo.length;
for (i = 0; i < l; i++) {
var p = photo[i];
pic.push(((p&0xff0000)>>18) + ((p&0xff00)>>10) + ((p&0xff)>>2));
}
brick.display().show(pic, 160, 120, "grayscale8");
script.wait(5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment