Ajouté code pour l'éditeur (pas encore au point)

This commit is contained in:
galaxyoyo 2015-01-07 19:49:09 +01:00
parent 86bd11fc16
commit 67e2860057
3 changed files with 33 additions and 0 deletions

BIN
img.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 975 B

After

Width:  |  Height:  |  Size: 104 B

View File

@ -3,6 +3,7 @@
*/ */
package galaxyoyo.unknown.client.main; package galaxyoyo.unknown.client.main;
import galaxyoyo.unknown.editor.Editor;
import galaxyoyo.unknown.frame.MainFrame; import galaxyoyo.unknown.frame.MainFrame;
import java.awt.Color; import java.awt.Color;
@ -184,6 +185,13 @@ public class Main
g.drawLine(0, y, width, y); g.drawLine(0, y, width, y);
} }
Byte[] bytes = Editor.toBytes(baseWidth, baseHeight);
for (byte b : bytes)
{
System.err.print(b);
}
try try
{ {
ImageIO.write(image, "png", new File("img.png")); ImageIO.write(image, "png", new File("img.png"));

View File

@ -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<Byte> bytes = new ArrayList<Byte>();
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]);
}
}