====== Bitmap Maker ====== [[wiki:projets:arduino_game|<< Retour au projet Arduino Game]] Exemple d'entrée : {{:wiki:projets:arduino_game:pmclogo.png?200|}} Exemple de sortie : #ifndef PMCLOGO_H #define PMCLOGO_H #include PROGMEM const unsigned char pmclogo[] = { 96,20, 0xFF,0xF8,0x1,0xE0,0x0,0xF0,0x0,0xFF,0xC0,0x0,0x0,0x0, 0xFF,0xFE,0x7,0xFC,0x3,0xFC,0x3,0xFF,0xC0,0x0,0x0,0x0, 0xFF,0xFF,0x7,0xFC,0x3,0xFC,0x7,0xFF,0xC0,0x0,0x0,0x0, 0xFF,0xFF,0xF,0xBE,0x7,0xFE,0xF,0x80,0x0,0x0,0x0,0x0, 0x0,0x7,0x8F,0x3E,0x7,0x9E,0x1E,0x0,0x0,0x0,0x0,0x0, 0x0,0x7,0x8E,0x3E,0x7,0x1E,0x1C,0x0,0x0,0x0,0x0,0x0, 0x0,0x7,0x9E,0x3E,0xF,0x1E,0x1C,0x0,0x0,0x0,0x0,0x0, 0x0,0x7,0x9E,0x3E,0xF,0x1E,0x1C,0x0,0x0,0x0,0x0,0x0, 0x1F,0xFF,0x1C,0x3E,0xE,0x1E,0x3C,0x0,0x0,0x0,0x0,0x0, 0x7F,0xFE,0x3C,0x3E,0x1E,0x1E,0x3C,0x0,0x1,0x80,0x20,0x7E, 0x7F,0xFC,0x3C,0x3E,0x1E,0x1E,0x3C,0x0,0x1,0x80,0x60,0x43, 0x7F,0xFC,0x3C,0x3E,0x1E,0x1E,0x3C,0x0,0x1,0x80,0x60,0x43, 0xF0,0x0,0x38,0x3E,0x1C,0x1E,0x1C,0x0,0x1,0x80,0x50,0x41, 0xF0,0x0,0x78,0x3E,0x3C,0x1E,0x1C,0x0,0x1,0x80,0x50,0x41, 0xF0,0x0,0x70,0x3E,0x3C,0x1E,0x1C,0x0,0x1,0x80,0x98,0x7E, 0xF0,0x0,0x70,0x3E,0x38,0x1E,0x1E,0x0,0x1,0x80,0x88,0x67, 0xF0,0x0,0xF0,0x3E,0x78,0x1E,0x1F,0x0,0x1,0x80,0x88,0x41, 0xF0,0x0,0xF0,0x1F,0xF8,0x1E,0xF,0xFF,0xC1,0x81,0xFC,0x41, 0xF0,0x1,0xE0,0x1F,0xF0,0x1E,0x7,0xFF,0xC1,0x81,0x4,0x41, 0xF0,0x1,0xE0,0x3,0xE0,0x1E,0x0,0xFF,0xC1,0xFF,0x4,0x7E }; #endif Code de l'outil : package fr.karang.TFTFontMaker; import java.awt.image.BufferedImage; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import javax.imageio.ImageIO; public class BitmapMaker { private final BufferedImage image; private final int MAX_BYTE_PER_LINE = 12; public BitmapMaker(String in, String out, String bitmapname) throws IOException { image = ImageIO.read(new File(in)); System.out.println("Image loaded : ("+image.getWidth()+", "+image.getHeight()+")"); if ((image.getWidth()%8)!=0) { System.out.println("La largeur doit être un multiple de 8."); return; } File file = new File(out); if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write("#ifndef "+bitmapname.toUpperCase()+"_H\n"); bw.write("#define "+bitmapname.toUpperCase()+"_H\n\n"); bw.write("#include \n\n"); bw.write("PROGMEM const unsigned char "+bitmapname+"[] = {\n"); bw.write(image.getWidth()+","+image.getHeight()+",\n"); int i=0; for (int y=0 ; y [[wiki:projets:arduino_game|<< Retour au projet Arduino Game]]