Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. import javax.imageio.ImageIO;
  2. import java.awt.*;
  3. import java.awt.image.BufferedImage;
  4. import java.io.File;
  5. import java.io.IOException;
  6. import java.nio.file.Path;
  7. import java.util.Date;
  8.  
  9. public class Printeroo {
  10. File path = new File("C:\\imaker\\");
  11. File path2;
  12. String basename= "";
  13. String folder= "";
  14.  
  15.  
  16.  
  17. public Printeroo(){
  18. System.out.println(path);
  19. this.basename=basename+".png";
  20. this.folder= new Date().getTime()+"pic";
  21. this.path2 = new File("C:\\imaker\\"+folder);
  22. path2.mkdir();
  23.  
  24. }
  25.  
  26. public void print(int a) throws IOException {
  27.  
  28. int aCopy = a;
  29.  
  30.  
  31.  
  32. a = Integer.parseInt(Integer.toBinaryString(a));
  33. System.out.println(a);
  34. BufferedImage image = ImageIO.read(new File(path, "base.png"));
  35. BufferedImage p1 = ImageIO.read(new File(path, "1.png"));
  36. BufferedImage p2 = ImageIO.read(new File(path, "2.png"));
  37. BufferedImage p3 = ImageIO.read(new File(path, "3.png"));
  38. BufferedImage p4 = ImageIO.read(new File(path, "4.png"));
  39. BufferedImage p5 = ImageIO.read(new File(path, "5.png"));
  40. BufferedImage p6 = ImageIO.read(new File(path, "6.png"));
  41. BufferedImage p7 = ImageIO.read(new File(path, "7.png"));
  42. BufferedImage p8 = ImageIO.read(new File(path, "8.png"));
  43.  
  44. int w = Math.max(image.getWidth(), image.getWidth());
  45. int h = Math.max(image.getHeight(), image.getHeight());
  46. BufferedImage combined = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
  47. Graphics g = combined.getGraphics();
  48. g.drawImage(image, 0, 0, null);
  49. BufferedImage pp ;
  50. String name = "";
  51.  
  52. int tt = a;
  53. int arco = 1;
  54. System.out.println(tt);
  55. while (tt>0){
  56.  
  57. int c= tt%10;
  58. System.out.println("c"+c);
  59. System.out.println("tt"+tt);
  60. if(c==1){
  61.  
  62. System.out.println(tt+" "+a);
  63. System.out.println(" I DO"+arco);
  64. BufferedImage p = ImageIO.read(new File(path, arco+".png"));
  65. g.drawImage(p,0,0,null);
  66. name = name + arco;
  67. }
  68. arco++;
  69. tt/=10;
  70. }
  71.  
  72.  
  73. if(name.equals("")){
  74. name="0";
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
  81. ImageIO.write(combined, "PNG", new File(path2, name+".png"));
  82. //System.out.println(name);
  83.  
  84.  
  85. }
  86.  
  87.  
  88.  
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement