Ubuntu16.04 安装Processing

下载

https://processing.org/ 上下载最新的linux 64bit版本gzip文件, 当前是 http://download.processing.org/processing-3.3.7-linux64.tgz .

安装

解压后移动到 /opt/ 目录

添加快捷方式

在 /usr/share/applications下新建新文件 processing-pde.desktop, 内容如下

[Desktop Entry]
Version=3.3.
Type=Application
Name=Processing IDE
Icon=/opt/processing-3.3./lib/icons/pde-.png
Exec=/opt/processing-3.3./processing
Comment=Processing IDE
Categories=Development;IDE;
Terminal=false

附: 用于从图片中提取LCD单色数组的代码

// THIS IS NOT ARDUINO CODE!  Runs in Processing IDE (www.processing.org).
// Convert image to C header file suitable for the Adafruit_Thermal library. void setup() {
// Select and load image
selectInput("Select image file to convert:", "processImage");
} void processImage(File image) {
String filename, basename;
PImage img;
PrintWriter output;
int pixelNum, byteNum, bytesOnLine = ,
x, y, b, rowBytes, totalBytes, lastBit, sum;
println("Loading image...");
filename = image.getPath();
img = loadImage(image.getPath()); // Morph filename into output filename and base name for data
x = filename.lastIndexOf('.');
if(x > ) filename = filename.substring(, x); // Strip current extension
x = filename.lastIndexOf('/');
if(x > ) basename = filename.substring(x + ); // Strip path
else basename = filename;
filename += ".h"; // Append '.h' to output filename
println("Writing output to " + filename); // Calculate output size
rowBytes = (img.width + ) / ;
totalBytes = rowBytes * img.height;
// Convert image to B&W, make pixels readable
img.filter(THRESHOLD);
img.loadPixels(); // Open header file for output (NOTE: WILL CLOBBER EXISTING .H FILE, if any)
output = createWriter(filename); // Write image dimensions and beginning of array
output.println("#ifndef _" + basename + "_h_");
output.println("#define _" + basename + "_h_");
output.println();
output.println("#define " + basename + "_width " + img.width);
output.println("#define " + basename + "_height " + img.height);
output.println();
output.print("static const uint8_t PROGMEM " + basename + "_data[] = {"); // Generate body of array
for(pixelNum=byteNum=y=; y<img.height; y++) { // Each row...
for(x=; x<rowBytes; x++) { // Each 8-pixel block within row...
lastBit = (x < rowBytes - ) ? : ( << (rowBytes * - img.width));
sum = ; // Clear accumulated 8 bits
for(b=; b>=lastBit; b >>= ) { // Each pixel within block...
if((img.pixels[pixelNum++] & ) == ) sum |= b; // If black pixel, set bit
}
if(++bytesOnLine >= ) { // Wrap nicely
output.print("\n ");
bytesOnLine = ;
}
output.format(" 0x%02X", sum); // Write accumulated bits
if(++byteNum < totalBytes) output.print(',');
}
} // End array, close file, exit program
output.println();
output.println("};");
output.println();
output.println("#endif // _" + basename + "_h_");
output.flush();
output.close();
println("Done!");
exit();
}

.

上一篇:java.lang.IllegalStateException: The specified child already has a parent. You must call removeView


下一篇:关于sql server的一种简单用法——在上面写查询语句,即可在下面修改数据