This file contains hidden or 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
/** | |
* Load a JPG image and convert it into a "binary digit mosaic" | |
* | |
* Author: Mario Gianota, September 2020 | |
*/ | |
PImage img; // Declare variable of type PImage | |
boolean once = false; | |
PFont myFont; | |
int x; |
This file contains hidden or 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
/** | |
* Open the system's native web browser to display a URL. | |
*/ | |
import java.awt.Desktop; | |
import java.io.IOException; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
public class BrowserOpen { |
This file contains hidden or 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 java.text.NumberFormat; | |
public class Hex2Dec { | |
public static int hexToDec(String hex) { | |
String hexStr = hex.toUpperCase(); | |
if( hexStr.startsWith(("0x"))) | |
hexStr = hexStr.substring(2,hexStr.length()-1); |
This file contains hidden or 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
/** | |
* Grabs a shot of the screen and saves it out as a PNG file. | |
*/ | |
import java.awt.Dimension; | |
import java.awt.Rectangle; | |
import java.awt.Robot; | |
import java.awt.AWTException; | |
import java.awt.Toolkit; | |
import java.awt.image.BufferedImage; | |
import javax.imageio.ImageIO; |
This file contains hidden or 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
/** | |
* A Java program that converts a wavelength of light in nanometers to an RGB colour. See the main method for example | |
* usage. | |
* | |
* It uses linear interpolation over the "CIE 1964 standard observer" table and sRGB matrix + gamma correction | |
* to do the conversion. | |
* | |
*/ | |
public class Wavelength2RGB { | |
static int |