From 67e286005721b6a7e05233c6a3821707fd0ee0e1 Mon Sep 17 00:00:00 2001 From: galaxyoyo Date: Wed, 7 Jan 2015 19:49:09 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=C3=A9=20code=20pour=20l'=C3=A9diteur=20(p?= =?UTF-8?q?as=20encore=20au=20point)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- img.png | Bin 975 -> 104 bytes .../galaxyoyo/unknown/client/main/Main.java | 8 ++++++ .../java/galaxyoyo/unknown/editor/Editor.java | 25 ++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 src/main/java/galaxyoyo/unknown/editor/Editor.java diff --git a/img.png b/img.png index 1b41e9c0be332efe7a76cc63e0a9a2344caf9ac1..67eb141b9ff5abe582d6adfe90af793045371950 100644 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^u0Slr!2~3mQd$gwl)k5nV@SoVx92x>&3CEox5 literal 975 zcmeAS@N?(olHy`uVBq!ia0y~yU=##l4kn<;xE85o$SdAc};RNQ)dTak}JfrsVb zzyFsXTn`mmR(D2qcEXIpbGh$z_#NxiW;qI+Rp>|)a53gsB*}8I=PHcF)0DyHXws}O zYoip5+arVW#7^ z2kfLZZ3?-^ET5m3Y^s>82y@|TIE&>X#D&SGFc#3Q5ZnJ)7N47M%<|F98Rj>j6Oet0 z#oa((ZjpRG$3C6oQEnU9AYiBfoj@RbfVO{pe#Wx?oWPOWJTPyg2LLdH(A*6SwM%Jp zivP_~?AR^|3tpsvhPf8a-M~;gGT-?5A4_L}d}Elm(E|XByH_iE%pQ$6XcC7f8~R7w bw{k{19-S*U1*UiaGb)3ptDnm{r-UW|x++?z diff --git a/src/main/java/galaxyoyo/unknown/client/main/Main.java b/src/main/java/galaxyoyo/unknown/client/main/Main.java index 10dad62..9f19699 100644 --- a/src/main/java/galaxyoyo/unknown/client/main/Main.java +++ b/src/main/java/galaxyoyo/unknown/client/main/Main.java @@ -3,6 +3,7 @@ */ package galaxyoyo.unknown.client.main; +import galaxyoyo.unknown.editor.Editor; import galaxyoyo.unknown.frame.MainFrame; import java.awt.Color; @@ -184,6 +185,13 @@ public class Main g.drawLine(0, y, width, y); } + Byte[] bytes = Editor.toBytes(baseWidth, baseHeight); + + for (byte b : bytes) + { + System.err.print(b); + } + try { ImageIO.write(image, "png", new File("img.png")); diff --git a/src/main/java/galaxyoyo/unknown/editor/Editor.java b/src/main/java/galaxyoyo/unknown/editor/Editor.java new file mode 100644 index 0000000..6c8ed10 --- /dev/null +++ b/src/main/java/galaxyoyo/unknown/editor/Editor.java @@ -0,0 +1,25 @@ +package galaxyoyo.unknown.editor; + +import java.util.ArrayList; +import java.util.List; + +public class Editor +{ + public static Byte[] toBytes(int width, int height) + { + List bytes = new ArrayList(); + + for (int x = 1; x < width; x += 16) + { + for (int y = 1; y < height; y += 16) + { + bytes.add((byte) 0); + } + bytes.add(Byte.MIN_VALUE); + } + + bytes.remove(bytes.lastIndexOf(Byte.MIN_VALUE)); + + return bytes.toArray(new Byte[0]); + } +}