Removed crappy headless graphic engine implementations

This commit is contained in:
Cavallium 2018-09-27 17:41:31 +02:00
parent 9f394258cd
commit 5aa703c0cf
30 changed files with 17694 additions and 2440 deletions

View File

@ -34,7 +34,6 @@ public class Boot {
public static StartupArguments parseStartupArguments(final String[] a) {
final StartupArgumentsImpl args = new StartupArgumentsImpl();
Arrays.asList(a).stream().parallel().map(String::toLowerCase).forEach(arg -> Boot.parseArgument(args, arg));
args.setHeadlessEngineForced(args.isHeadlessEngineForced() || args.isHeadless8EngineForced() || args.isHeadless256EngineForced() || args.isHeadless24bitEngineForced());
return args;
}
@ -55,18 +54,6 @@ public class Boot {
case "ms-dos":
args.setMSDOSModeEnabled(true);
break;
case "headless-8":
args.setHeadless8EngineForced(true);
break;
case "headless-256":
args.setHeadless256EngineForced(true);
break;
case "headless-24bit":
args.setHeadless24bitEngineForced(true);
break;
case "-headless":
args.setHeadlessEngineForced(true);
break;
case "html":
args.setHTMLEngineForced(true);
break;

View File

@ -5,14 +5,6 @@ public interface StartupArguments {
boolean isZoomed();
boolean isHeadlessEngineForced();
boolean isHeadless8EngineForced();
boolean isHeadless256EngineForced();
boolean isHeadless24bitEngineForced();
boolean isCPUEngineForced();
boolean isGPUEngineForced();

View File

@ -8,10 +8,6 @@ public class StartupArgumentsImpl implements StartupArguments {
private boolean isRaspberryModeAllowed;
private boolean isZoomed;
private boolean isHeadlessEngineForced;
private boolean isHeadless8EngineForced;
private boolean isHeadless256EngineForced;
private boolean isHeadless24bitEngineForced;
private boolean isCPUEngineForced;
private boolean isGPUEngineForced;
private boolean isFrameBufferEngineForced;
@ -32,26 +28,6 @@ public class StartupArgumentsImpl implements StartupArguments {
return isZoomed;
}
@Override
public boolean isHeadlessEngineForced() {
return isHeadlessEngineForced || isHeadless8EngineForced || isHeadless256EngineForced || isHeadless24bitEngineForced;
}
@Override
public boolean isHeadless8EngineForced() {
return isHeadless8EngineForced;
}
@Override
public boolean isHeadless256EngineForced() {
return isHeadless256EngineForced;
}
@Override
public boolean isHeadless24bitEngineForced() {
return isHeadless24bitEngineForced;
}
@Override
public boolean isCPUEngineForced() {
return isCPUEngineForced;
@ -99,7 +75,7 @@ public class StartupArgumentsImpl implements StartupArguments {
@Override
public boolean isEngineForced() {
return isCPUEngineForced || isFrameBufferEngineForced || isGPUEngineForced || isHeadless24bitEngineForced || isHeadless256EngineForced || isHeadless8EngineForced || isHTMLEngineForced || isNoGUIEngineForced;
return isCPUEngineForced || isFrameBufferEngineForced || isGPUEngineForced || isHTMLEngineForced || isNoGUIEngineForced;
}
void setRaspberryModeAllowed(final boolean isRaspberryModeAllowed) {
@ -109,27 +85,11 @@ public class StartupArgumentsImpl implements StartupArguments {
void setZoomed(final boolean isZoomed) {
this.isZoomed = isZoomed;
}
void setHeadlessEngineForced(final boolean isHeadlessEngineForced) {
this.isHeadlessEngineForced = isHeadlessEngineForced;
}
void setHeadless8EngineForced(final boolean isHeadless8EngineForced) {
this.isHeadless8EngineForced = isHeadless8EngineForced;
}
void setHeadless256EngineForced(final boolean isHeadless256EngineForced) {
this.isHeadless256EngineForced = isHeadless256EngineForced;
}
void setHeadless24bitEngineForced(final boolean isHeadless24bitEngineForced) {
this.isHeadless24bitEngineForced = isHeadless24bitEngineForced;
}
void setCPUEngineForced(final boolean isCPUEngineForced) {
this.isCPUEngineForced = isCPUEngineForced;
}
void setGPUEngineForced(final boolean isGPUEngineForced) {
this.isGPUEngineForced = isGPUEngineForced;
}
@ -164,7 +124,12 @@ public class StartupArgumentsImpl implements StartupArguments {
@Override
public String toString() {
return "StartupArguments = {\n\t\"isRaspberryModeAllowed\": \"" + isRaspberryModeAllowed + "\",\n\tisZoomed\": \"" + isZoomed + "\",\n\tisHeadlessEngineForced\": \"" + isHeadlessEngineForced + "\",\n\tisHeadless8EngineForced\": \"" + isHeadless8EngineForced + "\",\n\tisHeadless256EngineForced\": \"" + isHeadless256EngineForced + "\",\n\tisHeadless24bitEngineForced\": \"" + isHeadless24bitEngineForced + "\",\n\tisCPUEngineForced\": \"" + isCPUEngineForced + "\",\n\tisGPUEngineForced\": \"" + isGPUEngineForced + "\",\n\tisFrameBufferEngineForced\": \"" + isFrameBufferEngineForced + "\",\n\tisNoGUIEngineForced\": \"" + isNoGUIEngineForced + "\",\n\tisHTMLEngineForced\": \"" + isHTMLEngineForced + "\",\n\tisMSDOSModeEnabled\": \"" + isMSDOSModeEnabled + "\",\n\tisVerboseLoggingEnabled\": \"" + isVerboseLoggingEnabled + "\",\n\tisDebugEnabled\": \"" + isDebugEnabled + "\",\n\tisUncached\": \"" + isUncached + "\"\n}";
return "StartupArgumentsImpl [isRaspberryModeAllowed=" + isRaspberryModeAllowed + ", isZoomed=" + isZoomed
+ ", isCPUEngineForced=" + isCPUEngineForced + ", isGPUEngineForced=" + isGPUEngineForced
+ ", isFrameBufferEngineForced=" + isFrameBufferEngineForced + ", isNoGUIEngineForced="
+ isNoGUIEngineForced + ", isHTMLEngineForced=" + isHTMLEngineForced + ", isMSDOSModeEnabled="
+ isMSDOSModeEnabled + ", isVerboseLoggingEnabled=" + isVerboseLoggingEnabled + ", isDebugEnabled="
+ isDebugEnabled + ", isUncached=" + isUncached + "]";
}
}

View File

@ -13,9 +13,6 @@ import org.apache.commons.io.FileUtils;
import it.cavallium.warppi.Engine;
import it.cavallium.warppi.Platform;
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
import it.cavallium.warppi.gui.graphicengine.impl.jansi24bitcolors.JAnsi24bitEngine;
import it.cavallium.warppi.gui.graphicengine.impl.jansi256colors.JAnsi256Engine;
import it.cavallium.warppi.gui.graphicengine.impl.jansi8colors.JAnsi8Engine;
import it.cavallium.warppi.gui.graphicengine.impl.jogl.JOGLEngine;
import it.cavallium.warppi.gui.graphicengine.impl.swing.SwingEngine;
import it.cavallium.warppi.util.CacheUtils;
@ -43,9 +40,6 @@ public class DesktopPlatform implements Platform {
el = new HashMap<>();
el.put("CPU engine", new SwingEngine());
el.put("GPU engine", new JOGLEngine());
el.put("headless 24 bit engine", new JAnsi24bitEngine());
el.put("headless 256 colors engine", new JAnsi256Engine());
el.put("headless 8 colors engine", new JAnsi8Engine());
settings = new DesktopSettings();
}

View File

@ -1,329 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi24bitcolors;
import java.io.IOException;
import java.util.logging.ConsoleHandler;
import org.fusesource.jansi.AnsiConsole;
import org.fusesource.jansi.internal.WindowsSupport;
import it.cavallium.warppi.Engine;
import it.cavallium.warppi.StaticVars;
import it.cavallium.warppi.device.Keyboard;
import it.cavallium.warppi.event.Key;
import it.cavallium.warppi.flow.Observable;
import it.cavallium.warppi.gui.graphicengine.Renderer;
import it.cavallium.warppi.gui.graphicengine.RenderingLoop;
import it.cavallium.warppi.util.Utils;
public class JAnsi24bitEngine implements it.cavallium.warppi.gui.graphicengine.GraphicEngine {
private JAnsi24bitRenderer r;
private boolean stopped = true;
private RenderingLoop renderLoop;
public static final int C_MUL_X = 4;//8;
public static final int C_MUL_Y = 8;//8;
protected static int C_WIDTH;
protected static int C_HEIGHT;
private String title;
private boolean win = false;
private Key precKey = null;
public JAnsi24bitEngine() {}
@Override
public int[] getSize() {
new ConsoleHandler();
return new int[] { r.size[0], r.size[1] };
}
@Override
public boolean isInitialized() {
return !stopped;
}
@Override
public void setTitle(final String title) {
this.title = title;
}
@Override
public void setResizable(final boolean r) {
// TODO Auto-generated method stub
}
@Override
public void setDisplayMode(final int ww, final int wh) {
// TODO Auto-generated method stub
}
@SuppressWarnings("unused")
private long outHandle;
@Override
public void create() {
this.create(null);
}
@Override
public void create(final Runnable onInitialized) {
title = Engine.getPlatform().getSettings().getCalculatorName();
r = new JAnsi24bitRenderer();
JAnsi24bitEngine.C_WIDTH = StaticVars.screenSize[0] / JAnsi24bitEngine.C_MUL_X;
JAnsi24bitEngine.C_HEIGHT = StaticVars.screenSize[1] / JAnsi24bitEngine.C_MUL_Y;
StaticVars.outputLevel = -1;
AnsiConsole.systemInstall();
if (Utils.isWindows() && !StaticVars.startupArguments.isMSDOSModeEnabled()) {
win = true;
WindowsSupport.setConsoleMode(0x0200);
final Thread t = new Thread(() -> {
int ch = -1;
while (true) {
if (precKey != null) {
Keyboard.keyReleased(precKey);
precKey = null;
}
ch = WindowsSupport.readByte();
Key key = null;
switch (ch) {
case 72: { // UP
key = Key.UP;
break;
}
case 80: { // DOWN
key = Key.DOWN;
break;
}
case 77: { // RIGHT
key = Key.RIGHT;
break;
}
case 75: { // LEFT
key = Key.LEFT;
break;
}
case 49: { // 1
key = Key.NUM1;
break;
}
case 50: { // 2
key = Key.NUM2;
break;
}
case 51: { // 3
key = Key.NUM3;
break;
}
case 52: { // 4
key = Key.NUM4;
break;
}
case 53: { // 5
key = Key.NUM5;
break;
}
case 54: { // 6
key = Key.NUM6;
break;
}
default: {
key = Key.NONE;
break;
}
}
if (key != null)
Keyboard.keyPressed(key);
}
});
t.setDaemon(true);
t.start();
}
stopped = false;
if (onInitialized != null)
onInitialized.run();
}
@Override
public Observable<Integer[]> onResize() {
return null;
}
@Override
public int getWidth() {
return r.size[0];
}
@Override
public int getHeight() {
return r.size[1];
}
@Override
public void destroy() {
stopped = true;
}
@Override
public void start(final RenderingLoop d) {
renderLoop = d;
final Thread th = new Thread(() -> {
try {
double extratime = 0;
while (!stopped) {
final long start = System.currentTimeMillis();
repaint();
final long end = System.currentTimeMillis();
final double delta = (end - start) / 1000d;
final int deltaInt = (int) Math.floor(delta);
final int extraTimeInt = (int) Math.floor(extratime);
if (extraTimeInt + deltaInt < 200) {
Thread.sleep(200 - (extraTimeInt + deltaInt));
extratime = 0;
} else
extratime += delta - 200d;
}
} catch (final InterruptedException e) {
e.printStackTrace();
}
});
th.setName("Console rendering thread");
th.setDaemon(true);
th.start();
}
@Override
public void repaint() {
renderLoop.refresh();
r.curColor = new int[] { 0x00, 0x87, 0x00 };
r.glDrawStringCenter(JAnsi24bitEngine.C_WIDTH * JAnsi24bitEngine.C_MUL_X / 2, 0, title);
if (win) {
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "0;0f");
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "?12l");
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "?25l");
} else {
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "0;0f");
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "?12l");
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "?25l");
}
int[] precBgColor = new int[] { -1, -1, -1 };
int[] precFgColor = new int[] { -1, -1, -1 };
int[] curBgColor = new int[] { -1, -1, -1 };
int[] curFgColor = new int[] { -1, -1, -1 };
String out = "";
char outchar = ' ';
for (int y = 0; y < JAnsi24bitEngine.C_HEIGHT; y++)
for (int x = 0; x < JAnsi24bitEngine.C_WIDTH; x++) {
//BG color
int[][] pixs = new int[JAnsi24bitEngine.C_MUL_X * JAnsi24bitEngine.C_MUL_Y][];
for (int paddY = 0; paddY < JAnsi24bitEngine.C_MUL_Y; paddY++)
for (int paddX = 0; paddX < JAnsi24bitEngine.C_MUL_X; paddX++)
pixs[paddX + paddY * JAnsi24bitEngine.C_MUL_X] = r.bgColorMatrixSs[x * JAnsi24bitEngine.C_MUL_X + paddX + (y * JAnsi24bitEngine.C_MUL_Y + paddY) * r.size[0]];
int[] newpix = new int[3];
for (final int[] pix : pixs) {
newpix[0] += pix[0];
newpix[1] += pix[1];
newpix[2] += pix[2];
}
newpix[0] /= pixs.length;
newpix[1] /= pixs.length;
newpix[2] /= pixs.length;
r.bgColorMatrix[x + y * JAnsi24bitEngine.C_WIDTH] = newpix;
//FG color
pixs = new int[JAnsi24bitEngine.C_MUL_X * JAnsi24bitEngine.C_MUL_Y][];
for (int paddY = 0; paddY < JAnsi24bitEngine.C_MUL_Y; paddY++)
for (int paddX = 0; paddX < JAnsi24bitEngine.C_MUL_X; paddX++)
pixs[paddX + paddY * JAnsi24bitEngine.C_MUL_X] = r.fgColorMatrixSs[x * JAnsi24bitEngine.C_MUL_X + paddX + (y * JAnsi24bitEngine.C_MUL_Y + paddY) * r.size[0]];
newpix = new int[3];
for (final int[] pix : pixs) {
newpix[0] += pix[0];
newpix[1] += pix[1];
newpix[2] += pix[2];
}
newpix[0] /= pixs.length;
newpix[1] /= pixs.length;
newpix[2] /= pixs.length;
r.fgColorMatrix[x + y * JAnsi24bitEngine.C_WIDTH] = newpix;
}
for (int y = 0; y < JAnsi24bitEngine.C_HEIGHT; y++) {
for (int x = 0; x < JAnsi24bitEngine.C_WIDTH; x++) {
curBgColor = r.bgColorMatrix[x + y * JAnsi24bitEngine.C_WIDTH];
curFgColor = r.fgColorMatrix[x + y * JAnsi24bitEngine.C_WIDTH];
if (precBgColor != curBgColor) {
out = JAnsi24bitRenderer.ANSI_PREFIX + JAnsi24bitRenderer.ansiBgColorPrefix + curBgColor[0] + ";" + curBgColor[1] + ";" + curBgColor[2] + JAnsi24bitRenderer.ansiColorSuffix;
if (win)
WindowsSupport.writeConsole(out);
else
AnsiConsole.out.print(out);
}
if (precFgColor != curFgColor) {
out = JAnsi24bitRenderer.ANSI_PREFIX + JAnsi24bitRenderer.ansiFgColorPrefix + curFgColor[0] + ";" + curFgColor[1] + ";" + curFgColor[2] + JAnsi24bitRenderer.ansiColorSuffix;
if (win)
WindowsSupport.writeConsole(out);
else
AnsiConsole.out.print(out);
}
outchar = r.charmatrix[x + y * JAnsi24bitEngine.C_WIDTH];
if (win)
WindowsSupport.writeConsole(outchar + "");
else
AnsiConsole.out.print(outchar);
precBgColor = curBgColor;
precFgColor = curFgColor;
}
if (win)
//System.out.println(ch);
WindowsSupport.writeConsole("\r\n");
else
AnsiConsole.out.println();
}
}
@Override
public Renderer getRenderer() {
return r;
}
@Override
public JAnsi24bitFont loadFont(final String file) throws IOException {
return new JAnsi24bitFont();
}
@Override
public JAnsi24bitFont loadFont(final String path, final String file) throws IOException {
return new JAnsi24bitFont();
}
@Override
public JAnsi24bitSkin loadSkin(final String file) throws IOException {
return new JAnsi24bitSkin(file);
}
@Override
public void waitForExit() {
try {
do
Thread.sleep(500);
while (stopped == false);
} catch (final InterruptedException e) {
}
}
@Override
public boolean isSupported() {
if (StaticVars.startupArguments.isMSDOSModeEnabled() || StaticVars.startupArguments.isEngineForced() && StaticVars.startupArguments.isHeadless24bitEngineForced() == false)
return false;
return true;
}
@Override
public boolean doesRefreshPauses() {
return true;
}
}

View File

@ -1,57 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi24bitcolors;
import java.io.IOException;
import it.cavallium.warppi.gui.graphicengine.BinaryFont;
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
public class JAnsi24bitFont implements BinaryFont {
@Override
public void load(final String file) throws IOException {
}
@Override
public void initialize(final GraphicEngine d) {
// TODO Auto-generated method stub
}
@Override
public void use(final GraphicEngine d) {
// TODO Auto-generated method stub
}
@Override
public int getStringWidth(final String text) {
return 5 * text.length();
}
@Override
public int getCharacterWidth() {
return 5;
}
@Override
public int getCharacterHeight() {
return 5;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public int getSkinWidth() {
return 0;
}
@Override
public int getSkinHeight() {
return 0;
}
}

View File

@ -1,289 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi24bitcolors;
import it.cavallium.warppi.gui.graphicengine.Renderer;
public class JAnsi24bitRenderer implements Renderer {
JAnsi24bitFont currentFont;
public int[] size = new int[] { JAnsi24bitEngine.C_WIDTH * JAnsi24bitEngine.C_MUL_X, JAnsi24bitEngine.C_HEIGHT * JAnsi24bitEngine.C_MUL_Y };
protected int[][] fgColorMatrixSs = new int[size[0] * size[1]][3];
protected int[][] bgColorMatrixSs = new int[size[0] * size[1]][3];
protected char[] charmatrix = new char[JAnsi24bitEngine.C_WIDTH * JAnsi24bitEngine.C_HEIGHT];
protected int[][] fgColorMatrix = new int[JAnsi24bitEngine.C_WIDTH * JAnsi24bitEngine.C_HEIGHT][3];
protected int[][] bgColorMatrix = new int[JAnsi24bitEngine.C_WIDTH * JAnsi24bitEngine.C_HEIGHT][3];
protected int[] clearColor = JAnsi24bitRenderer.rgbToIntArray(0xc5, 0xc2, 0xaf);
protected int[] curColor = new int[] { clearColor[0], clearColor[1], clearColor[2] };
public JAnsi24bitSkin currentSkin;
public static final String ANSI_PREFIX = "\u001B[";
public static final String ansiFgColorPrefix = "38;2;";
public static final String ansiBgColorPrefix = "48;2;";
public static final String ansiColorSuffix = "m";
public static final String ANSI_RESET = "\u001B[0m";
public static final char FILL = 0xDB;
public static final int[] TRANSPARENT = new int[] { 0, 0, 0, 1 };
public static int[] rgbToIntArray(final int r_U, final int g_U, final int b_U) {
return new int[] { r_U, g_U, b_U };
}
@Override
public void glColor3i(final int r, final int gg, final int b) {
curColor = JAnsi24bitRenderer.rgbToIntArray(r, gg, b);
}
@Override
public void glColor(final int c) {
curColor = JAnsi24bitRenderer.rgbToIntArray(c >> 16 & 0xFF, c >> 8 & 0xFF, c & 0xFF);
}
@Override
public void glColor4i(final int red, final int green, final int blue, final int alpha) {
curColor = JAnsi24bitRenderer.rgbToIntArray(red, green, blue);
}
@Override
public void glColor3f(final float red, final float green, final float blue) {
curColor = JAnsi24bitRenderer.rgbToIntArray((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public void glColor4f(final float red, final float green, final float blue, final float alpha) {
curColor = JAnsi24bitRenderer.rgbToIntArray((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public void glClearColor4i(final int red, final int green, final int blue, final int alpha) {
clearColor = JAnsi24bitRenderer.rgbToIntArray(red, green, blue);
}
@Override
public void glClearColor4f(final float red, final float green, final float blue, final float alpha) {
clearColor = JAnsi24bitRenderer.rgbToIntArray((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public int glGetClearColor() {
return clearColor[2] << 16 | clearColor[1] << 8 | clearColor[0];
}
@Override
public void glClearColor(final int c) {
clearColor = JAnsi24bitRenderer.rgbToIntArray(c >> 16 & 0xFF, c >> 8 & 0xFF, c & 0xFF);
}
@Override
public void glClear(final int screenWidth, final int screenHeight) {
clearAll();
}
@Override
public void glDrawLine(float x1, float y1, final float x2, final float y2) {
final int dx = (int) Math.abs(x2 - x1);
final int dy = (int) Math.abs(y2 - y1);
final int sx = x1 < x2 ? 1 : -1;
final int sy = y1 < y2 ? 1 : -1;
int err = dx - dy;
while (true) {
if ((int) x1 >= size[0] || (int) y1 >= size[1] || (int) x2 >= size[0] || (int) y2 >= size[1])
break;
bgColorMatrixSs[(int) x1 + (int) y1 * size[0]] = curColor;
charmatrix[(int) x1 / JAnsi24bitEngine.C_MUL_X + (int) y1 / JAnsi24bitEngine.C_MUL_Y * JAnsi24bitEngine.C_WIDTH] = ' ';
if (x1 == x2 && y1 == y2)
break;
final int e2 = 2 * err;
if (e2 > -dy) {
err = err - dy;
x1 = x1 + sx;
}
if (e2 < dx) {
err = err + dx;
y1 = y1 + sy;
}
}
}
@Override
public void glFillRect(final float x, final float y, final float width, final float height, final float uvX,
final float uvY, final float uvWidth, final float uvHeight) {
if (currentSkin != null)
glDrawSkin((int) x, (int) y, (int) uvX, (int) uvY, (int) (uvWidth + uvX), (int) (uvHeight + uvY), true);
else
glFillColor(x, y, width, height);
}
@Override
public void glFillColor(final float x, final float y, final float width, final float height) {
final int ix = (int) x;
final int iy = (int) y;
final int iw = (int) width;
final int ih = (int) height;
int x1 = ix + iw;
int y1 = iy + ih;
if (ix >= size[0] || iy >= size[1])
return;
if (x1 >= size[0])
x1 = size[0];
if (y1 >= size[1])
y1 = size[1];
final int sizeW = size[0];
for (int px = ix; px < x1; px++)
for (int py = iy; py < y1; py++) {
drawPixelAt(' ', curColor, px, py);
bgColorMatrixSs[px + py * sizeW] = curColor;
charmatrix[px / JAnsi24bitEngine.C_MUL_X + py / JAnsi24bitEngine.C_MUL_Y * sizeW / JAnsi24bitEngine.C_MUL_X] = ' ';
}
}
@Override
public void glDrawCharLeft(final int x, final int y, final char ch) {
final int cx = x;
final int cy = y;
if (cx >= size[0] || cy >= size[1])
return;
charmatrix[cx / JAnsi24bitEngine.C_MUL_X + cy / JAnsi24bitEngine.C_MUL_Y * JAnsi24bitEngine.C_WIDTH] = ch;
fgColorMatrixSs[cx + cy * size[0]] = curColor;
}
@Override
public void glDrawCharCenter(final int x, final int y, final char ch) {
glDrawCharLeft(x, y, ch);
}
@Override
public void glDrawCharRight(final int x, final int y, final char ch) {
final int cx = x - 1 * JAnsi24bitEngine.C_MUL_X;
final int cy = y;
if (cx >= size[0] || cy >= size[1])
return;
charmatrix[cx / JAnsi24bitEngine.C_MUL_X + cy / JAnsi24bitEngine.C_MUL_Y * JAnsi24bitEngine.C_WIDTH] = ch;
fgColorMatrixSs[cx + cy * size[0]] = curColor;
}
@Override
public void glDrawStringLeft(final float x, final float y, final String text) {
final int cx = (int) x;
final int cy = (int) y;
int i = 0;
for (final char c : text.toCharArray()) {
if (cx + i >= size[0] || cy >= size[1])
break;
charmatrix[cx / JAnsi24bitEngine.C_MUL_X + i + cy / JAnsi24bitEngine.C_MUL_Y * JAnsi24bitEngine.C_WIDTH] = c;
fgColorMatrixSs[cx + i + cy * size[0]] = curColor;
i++;
}
}
@Override
public void glDrawStringCenter(final float x, final float y, final String text) {
final int cx = (int) x - text.length() / 2 * JAnsi24bitEngine.C_MUL_X;
final int cy = (int) y;
int i = 0;
for (final char c : text.toCharArray()) {
if (cx + i >= size[0] || cy >= size[1])
break;
charmatrix[cx / JAnsi24bitEngine.C_MUL_X + i + cy / JAnsi24bitEngine.C_MUL_Y * JAnsi24bitEngine.C_WIDTH] = c;
fgColorMatrixSs[cx + i + cy * size[0]] = curColor;
i++;
}
}
@Override
public void glDrawStringRight(final float x, final float y, final String text) {
// TODO Auto-generated method stub
}
private void glDrawSkin(int x0, int y0, int s0, int t0, int s1, int t1, final boolean transparent) {
int[] newColor;
final int onex = s0 <= s1 ? 1 : -1;
final int oney = t0 <= t1 ? 1 : -1;
int width = 0;
int height = 0;
if (onex == -1) {
final int s00 = s0;
s0 = s1;
s1 = s00;
width = s1 - s0;
}
if (oney == -1) {
final int t00 = t0;
t0 = t1;
t1 = t00;
height = t1 - t0;
}
if (x0 >= size[0] || y0 >= size[1])
return;
if (x0 + width >= size[0])
s1 = size[0] - x0 + s0;
if (y0 + height >= size[1])
t1 = size[1] - y0 + t0;
if (x0 < 0) {
if (onex == -1) {
width += x0;
s1 += x0 + 1;
} else
s0 -= x0;
x0 = 0;
}
if (y0 < 0) {
if (oney == -1) {
height += y0;
t1 += y0 + 1;
} else
t0 -= y0;
y0 = 0;
}
int pixelX;
int pixelY;
for (int texx = 0; texx < s1 - s0; texx++)
for (int texy = 0; texy < t1 - t0; texy++) {
pixelX = x0 + texx * onex + width;
pixelY = y0 + texy * oney + height;
if (pixelY < size[1])
if (pixelX - pixelX % size[0] == 0) {
newColor = currentSkin.skinData[s0 + texx + (t0 + texy) * currentSkin.skinSize[0]];
if (transparent)
if (newColor.length == 3 || newColor.length == 4 && newColor[3] != 1) {
charmatrix[pixelX / JAnsi24bitEngine.C_MUL_X + pixelY / JAnsi24bitEngine.C_MUL_Y * JAnsi24bitEngine.C_WIDTH] = ' ';
bgColorMatrixSs[pixelX + pixelY * size[0]] = newColor;
}
}
}
}
private void drawPixelAt(final char ch, final int[] color, final double x, final double y) {
}
@Override
public void glClearSkin() {
currentSkin = null;
}
protected void clearAll() {
for (int i = 0; i < JAnsi24bitEngine.C_WIDTH * JAnsi24bitEngine.C_HEIGHT; i++)
charmatrix[i] = ' ';
for (int i = 0; i < size[0] * size[1]; i++) {
bgColorMatrixSs[i] = clearColor;
fgColorMatrixSs[i] = new int[] { 0, 0, 0 };
}
}
@Override
public JAnsi24bitFont getCurrentFont() {
return currentFont;
}
}

View File

@ -1,71 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi24bitcolors;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
import it.cavallium.warppi.gui.graphicengine.Skin;
public class JAnsi24bitSkin implements Skin {
public int[][] skinData;
public int[] skinSize;
JAnsi24bitSkin(final String file) throws IOException {
load(file);
}
@Override
public void load(final String file) throws IOException {
final BufferedImage img = ImageIO.read(this.getClass().getResource("/" + file));
skinData = JAnsi24bitSkin.getMatrixOfImage(img);
skinSize = new int[] { img.getWidth(), img.getHeight() };
}
public static int[][] getMatrixOfImage(final BufferedImage bufferedImage) {
final int width = bufferedImage.getWidth(null);
final int height = bufferedImage.getHeight(null);
final int[][] pixels = new int[width * height][];
for (int i = 0; i < width; i++)
for (int j = 0; j < height; j++) {
final int rgb = bufferedImage.getRGB(i, j);
final int r = rgb >> 16 & 0xFF;
final int g = rgb >> 8 & 0xFF;
final int b = rgb & 0xFF;
final boolean transparent = (rgb >> 24 & 0xFF) <= 128;
final int[] curCol = JAnsi24bitRenderer.rgbToIntArray(r, g, b);
pixels[i + j * width] = new int[] { curCol[0], curCol[1], curCol[2], transparent ? 1 : 0 };
}
return pixels;
}
@Override
public void initialize(final GraphicEngine d) {
}
@Override
public void use(final GraphicEngine d) {
((JAnsi24bitRenderer) d.getRenderer()).currentSkin = this;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public int getSkinWidth() {
return 0;
}
@Override
public int getSkinHeight() {
return 0;
}
}

View File

@ -1,288 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi256colors;
import java.io.IOException;
import java.util.logging.ConsoleHandler;
import org.fusesource.jansi.AnsiConsole;
import org.fusesource.jansi.internal.WindowsSupport;
import it.cavallium.warppi.Engine;
import it.cavallium.warppi.StaticVars;
import it.cavallium.warppi.device.Keyboard;
import it.cavallium.warppi.event.Key;
import it.cavallium.warppi.flow.Observable;
import it.cavallium.warppi.gui.graphicengine.Renderer;
import it.cavallium.warppi.gui.graphicengine.RenderingLoop;
import it.cavallium.warppi.gui.graphicengine.impl.jansi24bitcolors.JAnsi24bitRenderer;
import it.cavallium.warppi.util.Utils;
public class JAnsi256Engine implements it.cavallium.warppi.gui.graphicengine.GraphicEngine {
private JAnsi256Renderer r;
private boolean stopped = true;
private RenderingLoop renderLoop;
public static final int C_MUL_X = 4;//8;
public static final int C_MUL_Y = 8;//8;
protected static int C_WIDTH;
protected static int C_HEIGHT;
private String title;
private boolean win = false;
private Key precKey = null;
@Override
public int[] getSize() {
new ConsoleHandler();
return new int[] { JAnsi256Engine.C_WIDTH, JAnsi256Engine.C_HEIGHT };
}
@Override
public boolean isInitialized() {
return !stopped;
}
@Override
public void setTitle(final String title) {
this.title = title;
}
@Override
public void setResizable(final boolean r) {
// TODO Auto-generated method stub
}
@Override
public void setDisplayMode(final int ww, final int wh) {
// TODO Auto-generated method stub
}
@Override
public void create() {
this.create(null);
}
@Override
public void create(final Runnable onInitialized) {
title = Engine.getPlatform().getSettings().getCalculatorName();
r = new JAnsi256Renderer();
JAnsi256Engine.C_WIDTH = StaticVars.screenSize[0] / JAnsi256Engine.C_MUL_X;//Main.screenSize[0]/2;//;60;
JAnsi256Engine.C_HEIGHT = StaticVars.screenSize[1] / JAnsi256Engine.C_MUL_Y;//Main.screenSize[1]/3;//;40;
StaticVars.outputLevel = -1;
AnsiConsole.systemInstall();
if (Utils.isWindows() && !StaticVars.startupArguments.isMSDOSModeEnabled()) {
win = true;
WindowsSupport.setConsoleMode(0x0200);
final Thread t = new Thread(() -> {
int ch = -1;
while (true) {
if (precKey != null) {
Keyboard.keyReleased(precKey);
precKey = null;
}
ch = WindowsSupport.readByte();
Key key = null;
switch (ch) {
case 72: { // UP
key = Key.UP;
break;
}
case 80: { // DOWN
key = Key.DOWN;
break;
}
case 77: { // RIGHT
key = Key.RIGHT;
break;
}
case 75: { // LEFT
key = Key.LEFT;
break;
}
case 49: { // 1
key = Key.NUM1;
break;
}
case 50: { // 2
key = Key.NUM2;
break;
}
case 51: { // 3
key = Key.NUM3;
break;
}
case 52: { // 4
key = Key.NUM4;
break;
}
case 53: { // 5
key = Key.NUM5;
break;
}
case 54: { // 6
key = Key.NUM6;
break;
}
default: {
key = Key.NONE;
break;
}
}
if (key != null)
Keyboard.keyPressed(key);
}
});
t.setDaemon(true);
t.start();
}
stopped = false;
if (onInitialized != null)
onInitialized.run();
}
@Override
public Observable<Integer[]> onResize() {
return null;
}
@Override
public int getWidth() {
return JAnsi256Engine.C_WIDTH * JAnsi256Engine.C_MUL_X;
}
@Override
public int getHeight() {
return JAnsi256Engine.C_HEIGHT * JAnsi256Engine.C_MUL_Y;
}
@Override
public void destroy() {
stopped = true;
}
@Override
public void start(final RenderingLoop d) {
renderLoop = d;
final Thread th = new Thread(() -> {
try {
double extratime = 0;
while (!stopped) {
final long start = System.currentTimeMillis();
repaint();
final long end = System.currentTimeMillis();
final double delta = (end - start) / 1000d;
final int deltaInt = (int) Math.floor(delta);
final int extraTimeInt = (int) Math.floor(extratime);
if (extraTimeInt + deltaInt < 200) {
Thread.sleep(200 - (extraTimeInt + deltaInt));
extratime = 0;
} else
extratime += delta - 200d;
}
} catch (final InterruptedException e) {
e.printStackTrace();
}
});
th.setName("Console rendering thread");
th.setDaemon(true);
th.start();
}
@Override
public void repaint() {
renderLoop.refresh();
r.curColor = 0x1C;
r.glDrawStringCenter(JAnsi256Engine.C_WIDTH * JAnsi256Engine.C_MUL_X / 2, 0, title);
if (win) {
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "0;0f");
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "?12l");
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "?25l");
} else {
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "0;0f");
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "?12l");
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "?25l");
}
for (int y = 0; y < JAnsi256Engine.C_HEIGHT; y++) {
int precBgColor = -1;
int precFgColor = -1;
int curBgColor = -1;
int curFgColor = -1;
for (int x = 0; x < JAnsi256Engine.C_WIDTH; x++) {
curBgColor = r.bgColorMatrix[x + y * JAnsi256Engine.C_WIDTH];
curFgColor = r.fgColorMatrix[x + y * JAnsi256Engine.C_WIDTH];
if (precBgColor != curBgColor) {
final String str = JAnsi256Renderer.ANSI_PREFIX + JAnsi256Renderer.ansiBgColorPrefix + curBgColor + JAnsi256Renderer.ansiColorSuffix;
if (win)
WindowsSupport.writeConsole(str);
else
AnsiConsole.out.print(str);
}
if (precFgColor != curFgColor) {
final String str = JAnsi256Renderer.ANSI_PREFIX + JAnsi256Renderer.ansiFgColorPrefix + curFgColor + JAnsi256Renderer.ansiColorSuffix;
if (win)
WindowsSupport.writeConsole(str);
else
AnsiConsole.out.print(str);
}
final String stri = r.charmatrix[x + y * JAnsi256Engine.C_WIDTH] + "";
if (win)
WindowsSupport.writeConsole(stri);
else
AnsiConsole.out.print(stri);
precBgColor = curBgColor;
precFgColor = curFgColor;
}
if (win)
WindowsSupport.writeConsole("\r\n");
else
AnsiConsole.out.println();
}
}
@Override
public Renderer getRenderer() {
return r;
}
@Override
public JAnsi256Font loadFont(final String file) throws IOException {
return new JAnsi256Font();
}
@Override
public JAnsi256Font loadFont(final String path, final String file) throws IOException {
return new JAnsi256Font();
}
@Override
public JAnsi256Skin loadSkin(final String file) throws IOException {
return new JAnsi256Skin(file);
}
@Override
public void waitForExit() {
try {
do
Thread.sleep(500);
while (stopped == false);
} catch (final InterruptedException e) {
}
}
@Override
public boolean isSupported() {
if (StaticVars.startupArguments.isMSDOSModeEnabled() || StaticVars.startupArguments.isEngineForced() && StaticVars.startupArguments.isHeadless256EngineForced() == false)
return false;
return true;
}
@Override
public boolean doesRefreshPauses() {
return true;
}
}

View File

@ -1,57 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi256colors;
import java.io.IOException;
import it.cavallium.warppi.gui.graphicengine.BinaryFont;
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
public class JAnsi256Font implements BinaryFont {
@Override
public void load(final String file) throws IOException {
}
@Override
public void initialize(final GraphicEngine d) {
// TODO Auto-generated method stub
}
@Override
public void use(final GraphicEngine d) {
// TODO Auto-generated method stub
}
@Override
public int getStringWidth(final String text) {
return 5 * text.length();
}
@Override
public int getCharacterWidth() {
return 5;
}
@Override
public int getCharacterHeight() {
return 5;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public int getSkinWidth() {
return 0;
}
@Override
public int getSkinHeight() {
return 0;
}
}

View File

@ -1,315 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi256colors;
import it.cavallium.warppi.gui.graphicengine.Renderer;
public class JAnsi256Renderer implements Renderer {
JAnsi256Font currentFont;
protected char[] charmatrix = new char[JAnsi256Engine.C_WIDTH * JAnsi256Engine.C_HEIGHT];
protected int[] fgColorMatrix = new int[JAnsi256Engine.C_WIDTH * JAnsi256Engine.C_HEIGHT];
protected int[] bgColorMatrix = new int[JAnsi256Engine.C_WIDTH * JAnsi256Engine.C_HEIGHT];
protected int clearColor = JAnsi256Renderer.rgbToX256(0xc5, 0xc2, 0xaf);
protected int curColor = clearColor;
public JAnsi256Skin currentSkin;
public static final String ANSI_PREFIX = "\u001B[";
public static final String ansiFgColorPrefix = "38;5;";
public static final String ansiBgColorPrefix = "48;5;";
public static final String ansiColorSuffix = "m";
public static final String ANSI_RESET = "\u001B[0m";
public static final char FILL = 0xDB;
public static final int TRANSPARENT = 0xF0000;
public static int v2ci(final int v_U) {
return v_U < 48 ? 0 : v_U < 115 ? 1 : (v_U - 35) / 40;
}
public static int colorIndex(final int ir, final int ig, final int ib) {
return 36 * ir + 6 * ig + ib;
}
public static int distSquare(final int a, final int b, final int c, final int a_U, final int b_U, final int c_U) {
return (a - a_U) * (a - a_U) + (b - b_U) * (b - b_U) + (c - c_U) * (c - c_U);
}
/**
* Calculate the represented colors back from the index
*/
public static int[] i2cv = { 0, 0x5f, 0x87, 0xaf, 0xd7, 0xff };
public static int rgbToX256(final int r_U, final int g_U, final int b_U) {
// Calculate the nearest 0-based color index at 16 .. 231
final int ir = JAnsi256Renderer.v2ci(r_U), ig = JAnsi256Renderer.v2ci(g_U), ib = JAnsi256Renderer.v2ci(b_U); // 0..5 each
/* 0..215, lazy evaluation */
// Calculate the nearest 0-based gray index at 232 .. 255
final int average = (r_U + g_U + b_U) / 3;
final int grayIndex = average > 238 ? 23 : (average - 3) / 10; // 0..23
final int cr = JAnsi256Renderer.i2cv[ir], cg = JAnsi256Renderer.i2cv[ig], cb = JAnsi256Renderer.i2cv[ib]; // r/g/b, 0..255 each
final int gv = 8 + 10 * grayIndex; // same value for r/g/b, 0..255
// Return the one which is nearer to the original input rgb value
final int colorErr = JAnsi256Renderer.distSquare(cr, cg, cb, r_U, g_U, b_U);
final int grayErr = JAnsi256Renderer.distSquare(gv, gv, gv, r_U, g_U, b_U);
return colorErr <= grayErr ? 16 + JAnsi256Renderer.colorIndex(ir, ig, ib) : 232 + grayIndex;
}
@Override
public void glColor3i(final int r, final int gg, final int b) {
curColor = JAnsi256Renderer.rgbToX256(r, gg, b);
}
@Override
public void glColor(final int c) {
curColor = JAnsi256Renderer.rgbToX256(c >> 16 & 0xFF, c >> 8 & 0xFF, c & 0xFF);
}
@Override
public void glColor4i(final int red, final int green, final int blue, final int alpha) {
curColor = JAnsi256Renderer.rgbToX256(red, green, blue);
}
@Override
public void glColor3f(final float red, final float green, final float blue) {
curColor = JAnsi256Renderer.rgbToX256((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public void glColor4f(final float red, final float green, final float blue, final float alpha) {
curColor = JAnsi256Renderer.rgbToX256((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public void glClearColor4i(final int red, final int green, final int blue, final int alpha) {
clearColor = JAnsi256Renderer.rgbToX256(red, green, blue);
}
@Override
public void glClearColor4f(final float red, final float green, final float blue, final float alpha) {
clearColor = JAnsi256Renderer.rgbToX256((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public int glGetClearColor() {
return clearColor;
}
@Override
public void glClearColor(final int c) {
clearColor = JAnsi256Renderer.rgbToX256(c >> 16 & 0xFF, c >> 8 & 0xFF, c & 0xFF);
}
@Override
public void glClear(final int screenWidth, final int screenHeight) {
clearAll();
}
@Override
public void glDrawLine(float x1, float y1, float x2, float y2) {
x1 /= JAnsi256Engine.C_MUL_X;
x2 /= JAnsi256Engine.C_MUL_X;
y1 /= JAnsi256Engine.C_MUL_Y;
y2 /= JAnsi256Engine.C_MUL_Y;
final int dx = (int) Math.abs(x2 - x1);
final int dy = (int) Math.abs(y2 - y1);
final int sx = x1 < x2 ? 1 : -1;
final int sy = y1 < y2 ? 1 : -1;
int err = dx - dy;
while (true) {
if ((int) x1 >= JAnsi256Engine.C_WIDTH || (int) y1 >= JAnsi256Engine.C_HEIGHT || (int) x2 >= JAnsi256Engine.C_WIDTH || (int) y2 >= JAnsi256Engine.C_HEIGHT)
break;
bgColorMatrix[(int) x1 + (int) y1 * JAnsi256Engine.C_WIDTH] = curColor;
charmatrix[(int) x1 + (int) y1 * JAnsi256Engine.C_WIDTH] = ' ';
if (x1 == x2 && y1 == y2)
break;
final int e2 = 2 * err;
if (e2 > -dy) {
err = err - dy;
x1 = x1 + sx;
}
if (e2 < dx) {
err = err + dx;
y1 = y1 + sy;
}
}
}
@Override
public void glFillRect(final float x, final float y, final float width, final float height, final float uvX,
final float uvY, final float uvWidth, final float uvHeight) {
if (currentSkin != null)
glDrawSkin((int) (x / JAnsi256Engine.C_MUL_X), (int) (y / JAnsi256Engine.C_MUL_Y), (int) (uvX / JAnsi256Engine.C_MUL_X), (int) (uvY / JAnsi256Engine.C_MUL_Y), (int) ((uvWidth + uvX) / JAnsi256Engine.C_MUL_X), (int) ((uvHeight + uvY) / JAnsi256Engine.C_MUL_Y), true);
else
glFillColor(x, y, width, height);
}
@Override
public void glFillColor(final float x, final float y, final float width, final float height) {
final int ix = (int) x / JAnsi256Engine.C_MUL_X;
final int iy = (int) y / JAnsi256Engine.C_MUL_Y;
final int iw = (int) width / JAnsi256Engine.C_MUL_X;
final int ih = (int) height / JAnsi256Engine.C_MUL_Y;
int x1 = ix + iw;
int y1 = iy + ih;
if (ix >= JAnsi256Engine.C_WIDTH || iy >= JAnsi256Engine.C_WIDTH)
return;
if (x1 >= JAnsi256Engine.C_WIDTH)
x1 = JAnsi256Engine.C_WIDTH;
if (y1 >= JAnsi256Engine.C_HEIGHT)
y1 = JAnsi256Engine.C_HEIGHT;
final int sizeW = JAnsi256Engine.C_WIDTH;
for (int px = ix; px < x1; px++)
for (int py = iy; py < y1; py++) {
bgColorMatrix[px + py * sizeW] = curColor;
charmatrix[px + py * sizeW] = ' ';
}
}
@Override
public void glDrawCharLeft(final int x, final int y, final char ch) {
final int cx = x / JAnsi256Engine.C_MUL_X;
final int cy = y / JAnsi256Engine.C_MUL_Y;
if (cx >= JAnsi256Engine.C_WIDTH || cy >= JAnsi256Engine.C_HEIGHT)
return;
charmatrix[cx + cy * JAnsi256Engine.C_WIDTH] = ch;
fgColorMatrix[cx + cy * JAnsi256Engine.C_WIDTH] = curColor;
}
@Override
public void glDrawCharCenter(final int x, final int y, final char ch) {
glDrawCharLeft(x, y, ch);
}
@Override
public void glDrawCharRight(final int x, final int y, final char ch) {
final int cx = x / JAnsi256Engine.C_MUL_X - 1;
final int cy = y / JAnsi256Engine.C_MUL_Y;
if (cx >= JAnsi256Engine.C_WIDTH || cy >= JAnsi256Engine.C_HEIGHT)
return;
charmatrix[cx + cy * JAnsi256Engine.C_WIDTH] = ch;
fgColorMatrix[cx + cy * JAnsi256Engine.C_WIDTH] = curColor;
}
@Override
public void glDrawStringLeft(final float x, final float y, final String text) {
final int cx = (int) x / JAnsi256Engine.C_MUL_X;
final int cy = (int) y / JAnsi256Engine.C_MUL_Y;
int i = 0;
for (final char c : text.toCharArray()) {
if (cx + i >= JAnsi256Engine.C_WIDTH || cy >= JAnsi256Engine.C_HEIGHT)
break;
charmatrix[cx + i + cy * JAnsi256Engine.C_WIDTH] = c;
fgColorMatrix[cx + i + cy * JAnsi256Engine.C_WIDTH] = curColor;
i++;
}
}
@Override
public void glDrawStringCenter(final float x, final float y, final String text) {
final int cx = (int) x / JAnsi256Engine.C_MUL_X - text.length() / 2;
final int cy = (int) y / JAnsi256Engine.C_MUL_Y;
int i = 0;
for (final char c : text.toCharArray()) {
if (cx + i >= JAnsi256Engine.C_WIDTH || cy >= JAnsi256Engine.C_HEIGHT)
break;
charmatrix[cx + i + cy * JAnsi256Engine.C_WIDTH] = c;
fgColorMatrix[cx + i + cy * JAnsi256Engine.C_WIDTH] = curColor;
i++;
}
}
@Override
public void glDrawStringRight(final float x, final float y, final String text) {
// TODO Auto-generated method stub
}
private void glDrawSkin(int x0, int y0, int s0, int t0, int s1, int t1, final boolean transparent) {
int newColor;
final int onex = s0 <= s1 ? 1 : -1;
final int oney = t0 <= t1 ? 1 : -1;
int width = 0;
int height = 0;
if (onex == -1) {
final int s00 = s0;
s0 = s1;
s1 = s00;
width = s1 - s0;
}
if (oney == -1) {
final int t00 = t0;
t0 = t1;
t1 = t00;
height = t1 - t0;
}
if (x0 >= JAnsi256Engine.C_WIDTH || y0 >= JAnsi256Engine.C_WIDTH)
return;
if (x0 + width >= JAnsi256Engine.C_WIDTH)
s1 = JAnsi256Engine.C_WIDTH - x0 + s0;
if (y0 + height >= JAnsi256Engine.C_HEIGHT)
t1 = JAnsi256Engine.C_HEIGHT - y0 + t0;
if (x0 < 0) {
if (onex == -1) {
width += x0;
s1 += x0 + 1;
} else
s0 -= x0;
x0 = 0;
}
if (y0 < 0) {
if (oney == -1) {
height += y0;
t1 += y0 + 1;
} else
t0 -= y0;
y0 = 0;
}
int pixelX;
int pixelY;
for (int texx = 0; texx < s1 - s0; texx++)
for (int texy = 0; texy < t1 - t0; texy++) {
pixelX = x0 + texx * onex + width;
pixelY = y0 + texy * oney + height;
if (pixelY < JAnsi256Engine.C_HEIGHT)
if (pixelX - pixelX % JAnsi256Engine.C_WIDTH == 0) {
newColor = currentSkin.skinData[s0 + texx + (t0 + texy) * currentSkin.skinSize[0]];
if (transparent && !((newColor & JAnsi256Renderer.TRANSPARENT) == JAnsi256Renderer.TRANSPARENT)) {
charmatrix[pixelX + pixelY * JAnsi256Engine.C_WIDTH] = ' ';
bgColorMatrix[pixelX + pixelY * JAnsi256Engine.C_WIDTH] = newColor;
}
}
}
}
@Override
public void glClearSkin() {
currentSkin = null;
}
protected void clearAll() {
for (int i = 0; i < JAnsi256Engine.C_WIDTH * JAnsi256Engine.C_HEIGHT; i++) {
charmatrix[i] = ' ';
bgColorMatrix[i] = clearColor;
fgColorMatrix[i] = 0;
}
}
@Override
public JAnsi256Font getCurrentFont() {
return currentFont;
}
}

View File

@ -1,77 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi256colors;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
import it.cavallium.warppi.gui.graphicengine.Skin;
public class JAnsi256Skin implements Skin {
public int[] skinData;
public int[] skinSize;
JAnsi256Skin(final String file) throws IOException {
load(file);
}
@Override
public void load(final String file) throws IOException {
final BufferedImage img = ImageIO.read(this.getClass().getResource("/" + file));
skinData = JAnsi256Skin.getMatrixOfImage(img);
skinSize = new int[] { img.getWidth(), img.getHeight() };
}
public static int[] getMatrixOfImage(final BufferedImage bufferedImage) {
BufferedImage after = new BufferedImage(bufferedImage.getWidth(null), bufferedImage.getHeight(null), BufferedImage.TYPE_INT_ARGB);
final AffineTransform at = new AffineTransform();
at.scale(1f / JAnsi256Engine.C_MUL_X, 1f / JAnsi256Engine.C_MUL_Y);
final AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
after = scaleOp.filter(bufferedImage, after);
final int width = after.getWidth(null);
final int height = after.getHeight(null);
final int[] pixels = new int[width * height];
for (int i = 0; i < width; i++)
for (int j = 0; j < height; j++) {
final int rgb = after.getRGB(i, j);
final int r = rgb >> 16 & 0xFF;
final int g = rgb >> 8 & 0xFF;
final int b = rgb & 0xFF;
final boolean transparent = (rgb >> 24 & 0xFF) <= 128;
pixels[i + j * width] = JAnsi256Renderer.rgbToX256(r, g, b) | (transparent ? JAnsi256Renderer.TRANSPARENT : 0);
}
return pixels;
}
@Override
public void initialize(final GraphicEngine d) {
}
@Override
public void use(final GraphicEngine d) {
((JAnsi256Renderer) d.getRenderer()).currentSkin = this;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public int getSkinWidth() {
return 0;
}
@Override
public int getSkinHeight() {
return 0;
}
}

View File

@ -1,288 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi8colors;
import java.io.IOException;
import java.util.logging.ConsoleHandler;
import org.fusesource.jansi.AnsiConsole;
import org.fusesource.jansi.internal.WindowsSupport;
import it.cavallium.warppi.Engine;
import it.cavallium.warppi.StaticVars;
import it.cavallium.warppi.device.Keyboard;
import it.cavallium.warppi.event.Key;
import it.cavallium.warppi.flow.Observable;
import it.cavallium.warppi.gui.graphicengine.Renderer;
import it.cavallium.warppi.gui.graphicengine.RenderingLoop;
import it.cavallium.warppi.gui.graphicengine.impl.jansi24bitcolors.JAnsi24bitRenderer;
import it.cavallium.warppi.util.Utils;
public class JAnsi8Engine implements it.cavallium.warppi.gui.graphicengine.GraphicEngine {
private JAnsi8Renderer r;
private boolean stopped = true;
private RenderingLoop renderLoop;
public static final int C_MUL_X = 4;//8;
public static final int C_MUL_Y = 8;//8;
protected static int C_WIDTH;
protected static int C_HEIGHT;
private String title;
private boolean win = false;
private Key precKey = null;
@Override
public int[] getSize() {
new ConsoleHandler();
return new int[] { JAnsi8Engine.C_WIDTH, JAnsi8Engine.C_HEIGHT };
}
@Override
public boolean isInitialized() {
return !stopped;
}
@Override
public void setTitle(final String title) {
this.title = title;
}
@Override
public void setResizable(final boolean r) {
// TODO Auto-generated method stub
}
@Override
public void setDisplayMode(final int ww, final int wh) {
// TODO Auto-generated method stub
}
@Override
public void create() {
this.create(null);
}
@Override
public void create(final Runnable onInitialized) {
title = Engine.getPlatform().getSettings().getCalculatorName();
r = new JAnsi8Renderer();
JAnsi8Engine.C_WIDTH = StaticVars.screenSize[0] / JAnsi8Engine.C_MUL_X;//Main.screenSize[0]/2;//;60;
JAnsi8Engine.C_HEIGHT = StaticVars.screenSize[1] / JAnsi8Engine.C_MUL_Y;//Main.screenSize[1]/3;//;40;
StaticVars.outputLevel = -1;
AnsiConsole.systemInstall();
if (Utils.isWindows() && !StaticVars.startupArguments.isMSDOSModeEnabled()) {
win = true;
WindowsSupport.setConsoleMode(0x0200);
final Thread t = new Thread(() -> {
int ch = -1;
while (true) {
if (precKey != null) {
Keyboard.keyReleased(precKey);
precKey = null;
}
ch = WindowsSupport.readByte();
Key key = null;
switch (ch) {
case 72: { // UP
key = Key.UP;
break;
}
case 80: { // DOWN
key = Key.DOWN;
break;
}
case 77: { // RIGHT
key = Key.RIGHT;
break;
}
case 75: { // LEFT
key = Key.LEFT;
break;
}
case 49: { // 1
key = Key.NUM1;
break;
}
case 50: { // 2
key = Key.NUM2;
break;
}
case 51: { // 3
key = Key.NUM3;
break;
}
case 52: { // 4
key = Key.NUM4;
break;
}
case 53: { // 5
key = Key.NUM5;
break;
}
case 54: { // 6
key = Key.NUM6;
break;
}
default: {
key = Key.NONE;
break;
}
}
if (key != null)
Keyboard.keyPressed(key);
}
});
t.setDaemon(true);
t.start();
}
stopped = false;
if (onInitialized != null)
onInitialized.run();
}
@Override
public Observable<Integer[]> onResize() {
return null;
}
@Override
public int getWidth() {
return JAnsi8Engine.C_WIDTH * JAnsi8Engine.C_MUL_X;
}
@Override
public int getHeight() {
return JAnsi8Engine.C_HEIGHT * JAnsi8Engine.C_MUL_Y;
}
@Override
public void destroy() {
stopped = true;
}
@Override
public void start(final RenderingLoop d) {
renderLoop = d;
final Thread th = new Thread(() -> {
try {
double extratime = 0;
while (!stopped) {
final long start = System.currentTimeMillis();
repaint();
final long end = System.currentTimeMillis();
final double delta = (end - start) / 1000d;
final int deltaInt = (int) Math.floor(delta);
final int extraTimeInt = (int) Math.floor(extratime);
if (extraTimeInt + deltaInt < 200) {
Thread.sleep(200 - (extraTimeInt + deltaInt));
extratime = 0;
} else
extratime += delta - 200d;
}
} catch (final InterruptedException e) {
e.printStackTrace();
}
});
th.setName("Console rendering thread");
th.setDaemon(true);
th.start();
}
@Override
public void repaint() {
renderLoop.refresh();
r.curColor = 0x1C;
r.glDrawStringCenter(JAnsi8Engine.C_WIDTH * JAnsi8Engine.C_MUL_X / 2, 0, title);
if (win) {
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "0;0f");
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "?12l");
WindowsSupport.writeConsole(JAnsi24bitRenderer.ANSI_PREFIX + "?25l");
} else {
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "0;0f");
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "?12l");
AnsiConsole.out.print(JAnsi24bitRenderer.ANSI_PREFIX + "?25l");
}
for (int y = 0; y < JAnsi8Engine.C_HEIGHT; y++) {
int precBgColor = -1;
int precFgColor = -1;
int curBgColor = -1;
int curFgColor = -1;
for (int x = 0; x < JAnsi8Engine.C_WIDTH; x++) {
curBgColor = (r.colorMatrix[x + y * JAnsi8Engine.C_WIDTH] & 0xF0) >> 4;
curFgColor = r.colorMatrix[x + y * JAnsi8Engine.C_WIDTH] & 0x0F;
if (precBgColor != curBgColor) {
final String str = JAnsi8Renderer.ANSI_PREFIX + JAnsi8Renderer.ansiBgColorPrefix + JAnsi8Renderer.colorANSI[curBgColor] + JAnsi8Renderer.ansiColorSuffix;
if (win)
WindowsSupport.writeConsole(str);
else
AnsiConsole.out.print(str);
}
if (precFgColor != curFgColor) {
final String str = JAnsi8Renderer.ANSI_PREFIX + JAnsi8Renderer.ansiFgColorPrefix + JAnsi8Renderer.colorANSI[curFgColor] + JAnsi8Renderer.ansiColorSuffix;
if (win)
WindowsSupport.writeConsole(str);
else
AnsiConsole.out.print(str);
}
final String stri = r.charmatrix[x + y * JAnsi8Engine.C_WIDTH] + "";
if (win)
WindowsSupport.writeConsole(stri);
else
AnsiConsole.out.print(stri);
precBgColor = curBgColor;
precFgColor = curFgColor;
}
if (win)
WindowsSupport.writeConsole("\r\n");
else
AnsiConsole.out.println();
}
}
@Override
public Renderer getRenderer() {
return r;
}
@Override
public JAnsi8Font loadFont(final String file) throws IOException {
return new JAnsi8Font();
}
@Override
public JAnsi8Font loadFont(final String path, final String file) throws IOException {
return new JAnsi8Font();
}
@Override
public JAnsi8Skin loadSkin(final String file) throws IOException {
return new JAnsi8Skin(file);
}
@Override
public void waitForExit() {
try {
do
Thread.sleep(500);
while (stopped == false);
} catch (final InterruptedException e) {
}
}
@Override
public boolean isSupported() {
if (StaticVars.startupArguments.isMSDOSModeEnabled() || StaticVars.startupArguments.isEngineForced() && StaticVars.startupArguments.isHeadless8EngineForced() == false)
return false;
return true;
}
@Override
public boolean doesRefreshPauses() {
return true;
}
}

View File

@ -1,57 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi8colors;
import java.io.IOException;
import it.cavallium.warppi.gui.graphicengine.BinaryFont;
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
public class JAnsi8Font implements BinaryFont {
@Override
public void load(final String file) throws IOException {
}
@Override
public void initialize(final GraphicEngine d) {
// TODO Auto-generated method stub
}
@Override
public void use(final GraphicEngine d) {
// TODO Auto-generated method stub
}
@Override
public int getStringWidth(final String text) {
return 5 * text.length();
}
@Override
public int getCharacterWidth() {
return 5;
}
@Override
public int getCharacterHeight() {
return 5;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public int getSkinWidth() {
return 0;
}
@Override
public int getSkinHeight() {
return 0;
}
}

View File

@ -1,464 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi8colors;
import it.cavallium.warppi.StaticVars;
import it.cavallium.warppi.gui.graphicengine.Renderer;
public class JAnsi8Renderer implements Renderer {
JAnsi8Font currentFont;
protected char[] charmatrix = new char[JAnsi8Engine.C_WIDTH * JAnsi8Engine.C_HEIGHT];
protected int[] colorMatrix = new int[JAnsi8Engine.C_WIDTH * JAnsi8Engine.C_HEIGHT];
protected int clearColor = hexColor(0xc5, 0xc2, 0xaf);
protected int curColor = clearColor;
public JAnsi8Skin currentSkin;
public static final String ANSI_PREFIX = "\u001B[";
public static final String ansiFgColorPrefix = "3";
public static final String ansiBgColorPrefix = "4";
public static final String ansiColorSuffix = "m";
public static final String[] colorANSI = new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "0;1", "1;1", "2;1", "3;1", "4;1", "5;1", "6;1", "7;1" };
public static final String ANSI_RESET = "\u001B[0m";
public static char FILL;
private int hexColor(final int red, final int green, final int blue) {
final int r1 = red;
int r2;
final int g1 = green;
int g2;
final int b1 = blue;
int b2;
final float[] match = new float[16];
// COLOR
r2 = 0;
g2 = 0;
b2 = 0;
match[0] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 205;
g2 = 0;
b2 = 0;
match[1] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 0;
g2 = 205;
b2 = 0;
match[2] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 205;
g2 = 205;
b2 = 0;
match[3] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 0;
g2 = 0;
b2 = 238;
match[4] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 205;
g2 = 0;
b2 = 205;
match[5] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 0;
g2 = 205;
b2 = 205;
match[6] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 229;
g2 = 229;
b2 = 229;
match[7] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 127;
g2 = 127;
b2 = 127;
match[8] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 255;
g2 = 0;
b2 = 0;
match[9] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 0;
g2 = 255;
b2 = 0;
match[0xa] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 255;
g2 = 255;
b2 = 0;
match[0xb] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 92;
g2 = 92;
b2 = 255;
match[0xc] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 255;
g2 = 0;
b2 = 255;
match[0xd] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 0;
g2 = 255;
b2 = 255;
match[0xe] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
// COLOR
r2 = 255;
g2 = 255;
b2 = 255;
match[0xf] = (r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1);
int minIndex = 0;
for (int i = 1; i < match.length; i++) {
final float newnumber = match[i];
if (newnumber < match[minIndex])
minIndex = i;
}
return minIndex;
}
private int[] hexColorReverse(final int i) {
switch (i) {
case 0x0:
return new int[] { 0, 0, 0 };
case 0x1:
return new int[] { 205, 0, 0 };
case 0x2:
return new int[] { 0, 205, 0 };
case 0x3:
return new int[] { 205, 205, 0 };
case 0x4:
return new int[] { 0, 0, 238 };
case 0x5:
return new int[] { 205, 0, 205 };
case 0x6:
return new int[] { 0, 205, 205 };
case 0x7:
return new int[] { 229, 229, 229 };
case 0x8:
return new int[] { 127, 127, 127 };
case 0x9:
return new int[] { 255, 0, 0 };
case 0xa:
return new int[] { 0, 255, 0 };
case 0xb:
return new int[] { 255, 255, 0 };
case 0xc:
return new int[] { 92, 92, 255 };
case 0xd:
return new int[] { 255, 0, 255 };
case 0xe:
return new int[] { 0, 255, 255 };
default:
return new int[] { 255, 255, 255 };
}
}
private int colorUnion(final int[] col) {
return 0xFF << 24 | col[0] << 16 | col[1] << 8 | col[2];
}
@Override
public void glColor3i(final int r, final int gg, final int b) {
curColor = hexColor(r, gg, b);
}
@Override
public void glColor(final int c) {
curColor = hexColor(c >> 16 & 0xFF, c >> 8 & 0xFF, c & 0xFF);
}
@Override
public void glColor4i(final int red, final int green, final int blue, final int alpha) {
curColor = hexColor(red, green, blue);
}
@Override
public void glColor3f(final float red, final float green, final float blue) {
curColor = hexColor((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public void glColor4f(final float red, final float green, final float blue, final float alpha) {
curColor = hexColor((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public void glClearColor4i(final int red, final int green, final int blue, final int alpha) {
clearColor = hexColor(red, green, blue);
}
@Override
public void glClearColor4f(final float red, final float green, final float blue, final float alpha) {
clearColor = hexColor((int) (red * 255), (int) (green * 255), (int) (blue * 255));
}
@Override
public int glGetClearColor() {
return clearColor;
}
@Override
public void glClearColor(final int c) {
clearColor = hexColor(c >> 16 & 0xFF, c >> 8 & 0xFF, c & 0xFF);
}
@Override
public void glClear(final int screenWidth, final int screenHeight) {
clearAll();
}
@Override
public void glDrawLine(float x1, float y1, float x2, float y2) {
x1 /= JAnsi8Engine.C_MUL_X;
x2 /= JAnsi8Engine.C_MUL_X;
y1 /= JAnsi8Engine.C_MUL_Y;
y2 /= JAnsi8Engine.C_MUL_Y;
final int dx = (int) Math.abs(x2 - x1);
final int dy = (int) Math.abs(y2 - y1);
final int sx = x1 < x2 ? 1 : -1;
final int sy = y1 < y2 ? 1 : -1;
int err = dx - dy;
while (true) {
if ((int) x1 >= JAnsi8Engine.C_WIDTH || (int) y1 >= JAnsi8Engine.C_HEIGHT || (int) x2 >= JAnsi8Engine.C_WIDTH || (int) y2 >= JAnsi8Engine.C_HEIGHT)
break;
final int precBG = colorMatrix[(int) x1 + (int) y1 * JAnsi8Engine.C_WIDTH] & 0xF0;
colorMatrix[(int) x1 + (int) y1 * JAnsi8Engine.C_WIDTH] = precBG | curColor;
if (JAnsi8Renderer.FILL == 0)
initFill();
charmatrix[(int) x1 + (int) y1 * JAnsi8Engine.C_WIDTH] = JAnsi8Renderer.FILL;
if (x1 == x2 && y1 == y2)
break;
final int e2 = 2 * err;
if (e2 > -dy) {
err = err - dy;
x1 = x1 + sx;
}
if (e2 < dx) {
err = err + dx;
y1 = y1 + sy;
}
}
}
private void initFill() {
JAnsi8Renderer.FILL = StaticVars.startupArguments.isMSDOSModeEnabled() ? 0xDB : '█';
}
@Override
public void glFillRect(final float x, final float y, final float width, final float height, final float uvX,
final float uvY, final float uvWidth, final float uvHeight) {
if (currentSkin != null)
glDrawSkin((int) (x / JAnsi8Engine.C_MUL_X), (int) (y / JAnsi8Engine.C_MUL_Y), (int) (uvX / JAnsi8Engine.C_MUL_X), (int) (uvY / JAnsi8Engine.C_MUL_Y), (int) ((uvWidth + uvX) / JAnsi8Engine.C_MUL_X), (int) ((uvHeight + uvY) / JAnsi8Engine.C_MUL_Y), true);
else
glFillColor(x, y, width, height);
}
@Override
public void glFillColor(final float x, final float y, final float width, final float height) {
if (JAnsi8Renderer.FILL == 0)
initFill();
glFillColor(x, y, width, height, JAnsi8Renderer.FILL, curColor);
}
private void glFillColor(final float x, final float y, final float width, final float height, final char character,
final int color) {
final int ix = (int) x / JAnsi8Engine.C_MUL_X;
final int iy = (int) y / JAnsi8Engine.C_MUL_Y;
final int iw = (int) width / JAnsi8Engine.C_MUL_X;
final int ih = (int) height / JAnsi8Engine.C_MUL_Y;
int x1 = ix + iw;
int y1 = iy + ih;
if (ix >= JAnsi8Engine.C_WIDTH || iy >= JAnsi8Engine.C_WIDTH)
return;
if (x1 >= JAnsi8Engine.C_WIDTH)
x1 = JAnsi8Engine.C_WIDTH;
if (y1 >= JAnsi8Engine.C_HEIGHT)
y1 = JAnsi8Engine.C_HEIGHT;
final int sizeW = JAnsi8Engine.C_WIDTH;
for (int px = ix; px < x1; px++)
for (int py = iy; py < y1; py++) {
final int precBG = colorMatrix[px + py * sizeW] & 0xF0;
colorMatrix[px + py * sizeW] = precBG | color;
charmatrix[px + py * sizeW] = character;
}
}
@Override
public void glDrawCharLeft(final int x, final int y, final char ch) {
final int cx = x / JAnsi8Engine.C_MUL_X;
final int cy = y / JAnsi8Engine.C_MUL_Y;
if (cx >= JAnsi8Engine.C_WIDTH || cy >= JAnsi8Engine.C_HEIGHT)
return;
charmatrix[cx + cy * JAnsi8Engine.C_WIDTH] = ch;
final int precBG = colorMatrix[cx + cy * JAnsi8Engine.C_WIDTH] & 0xF0;
colorMatrix[cx + cy * JAnsi8Engine.C_WIDTH] = precBG | curColor;
}
@Override
public void glDrawCharCenter(final int x, final int y, final char ch) {
glDrawCharLeft(x, y, ch);
}
@Override
public void glDrawCharRight(final int x, final int y, final char ch) {
final int cx = x / JAnsi8Engine.C_MUL_X - 1;
final int cy = y / JAnsi8Engine.C_MUL_Y;
if (cx >= JAnsi8Engine.C_WIDTH || cy >= JAnsi8Engine.C_HEIGHT)
return;
charmatrix[cx + cy * JAnsi8Engine.C_WIDTH] = ch;
final int precBG = colorMatrix[cx + cy * JAnsi8Engine.C_WIDTH] & 0xF0;
colorMatrix[cx + cy * JAnsi8Engine.C_WIDTH] = precBG | curColor;
}
@Override
public void glDrawStringLeft(final float x, final float y, final String text) {
final int cx = (int) x / JAnsi8Engine.C_MUL_X;
final int cy = (int) y / JAnsi8Engine.C_MUL_Y;
int i = 0;
for (final char c : text.toCharArray()) {
if (cx + i >= JAnsi8Engine.C_WIDTH || cy >= JAnsi8Engine.C_HEIGHT)
break;
charmatrix[cx + i + cy * JAnsi8Engine.C_WIDTH] = c;
final int precBG = colorMatrix[cx + i + cy * JAnsi8Engine.C_WIDTH] & 0xF0;
colorMatrix[cx + i + cy * JAnsi8Engine.C_WIDTH] = precBG | curColor;
i++;
}
}
@Override
public void glDrawStringCenter(final float x, final float y, final String text) {
final int cx = (int) x / JAnsi8Engine.C_MUL_X - text.length() / 2;
final int cy = (int) y / JAnsi8Engine.C_MUL_Y;
int i = 0;
for (final char c : text.toCharArray()) {
if (cx + i >= JAnsi8Engine.C_WIDTH || cy >= JAnsi8Engine.C_HEIGHT)
break;
charmatrix[cx + i + cy * JAnsi8Engine.C_WIDTH] = c;
final int precBG = colorMatrix[cx + i + cy * JAnsi8Engine.C_WIDTH] & 0xF0;
colorMatrix[cx + i + cy * JAnsi8Engine.C_WIDTH] = precBG | curColor;
i++;
}
}
@Override
public void glDrawStringRight(final float x, final float y, final String text) {
// TODO Auto-generated method stub
}
private void glDrawSkin(int x0, int y0, int s0, int t0, int s1, int t1, final boolean transparent) {
int oldColor;
int newColor;
final int onex = s0 <= s1 ? 1 : -1;
final int oney = t0 <= t1 ? 1 : -1;
int width = 0;
int height = 0;
if (onex == -1) {
final int s00 = s0;
s0 = s1;
s1 = s00;
width = s1 - s0;
}
if (oney == -1) {
final int t00 = t0;
t0 = t1;
t1 = t00;
height = t1 - t0;
}
if (x0 >= JAnsi8Engine.C_WIDTH || y0 >= JAnsi8Engine.C_WIDTH)
return;
if (x0 + width >= JAnsi8Engine.C_WIDTH)
s1 = JAnsi8Engine.C_WIDTH - x0 + s0;
if (y0 + height >= JAnsi8Engine.C_HEIGHT)
t1 = JAnsi8Engine.C_HEIGHT - y0 + t0;
if (x0 < 0) {
if (onex == -1) {
width += x0;
s1 += x0 + 1;
} else
s0 -= x0;
x0 = 0;
}
if (y0 < 0) {
if (oney == -1) {
height += y0;
t1 += y0 + 1;
} else
t0 -= y0;
y0 = 0;
}
int pixelX;
int pixelY;
for (int texx = 0; texx < s1 - s0; texx++)
for (int texy = 0; texy < t1 - t0; texy++) {
pixelX = x0 + texx * onex + width;
pixelY = y0 + texy * oney + height;
if (pixelY < JAnsi8Engine.C_HEIGHT)
if (pixelX - pixelX % JAnsi8Engine.C_WIDTH == 0) {
newColor = currentSkin.skinData[s0 + texx + (t0 + texy) * currentSkin.skinSize[0]];
if (transparent) {
oldColor = colorUnion(hexColorReverse((colorMatrix[pixelX + pixelY * JAnsi8Engine.C_WIDTH] & 0xF0) >> 4));
final float a2 = (newColor >> 24 & 0xFF) / 255f;
final float a1 = 1f - a2;
final int r = (int) ((oldColor >> 16 & 0xFF) * a1 + (newColor >> 16 & 0xFF) * a2);
final int g = (int) ((oldColor >> 8 & 0xFF) * a1 + (newColor >> 8 & 0xFF) * a2);
final int b = (int) ((oldColor & 0xFF) * a1 + (newColor & 0xFF) * a2);
newColor = 0xFF000000 | r << 16 | g << 8 | b;
}
final int bgColor = colorMatrix[pixelX + pixelY * JAnsi8Engine.C_WIDTH] & 0xF0;
colorMatrix[pixelX + pixelY * JAnsi8Engine.C_WIDTH] = bgColor | hexColor(newColor >> 16 & 0xFF, newColor >> 8 & 0xFF, newColor & 0xFF);
if (JAnsi8Renderer.FILL == 0)
initFill();
charmatrix[pixelX + pixelY * JAnsi8Engine.C_WIDTH] = JAnsi8Renderer.FILL;
}
}
}
@Override
public void glClearSkin() {
currentSkin = null;
}
protected void clearAll() {
for (int i = 0; i < JAnsi8Engine.C_WIDTH * JAnsi8Engine.C_HEIGHT; i++) {
charmatrix[i] = ' ';
colorMatrix[i] = clearColor << 4;
}
}
@Override
public JAnsi8Font getCurrentFont() {
return currentFont;
}
}

View File

@ -1,71 +0,0 @@
package it.cavallium.warppi.gui.graphicengine.impl.jansi8colors;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
import it.cavallium.warppi.gui.graphicengine.Skin;
public class JAnsi8Skin implements Skin {
public int[] skinData;
public int[] skinSize;
JAnsi8Skin(final String file) throws IOException {
load(file);
}
@Override
public void load(final String file) throws IOException {
final BufferedImage img = ImageIO.read(this.getClass().getResource("/" + file));
skinData = JAnsi8Skin.getMatrixOfImage(img);
skinSize = new int[] { img.getWidth(), img.getHeight() };
}
public static int[] getMatrixOfImage(final BufferedImage bufferedImage) {
BufferedImage after = new BufferedImage(bufferedImage.getWidth(null), bufferedImage.getHeight(null), BufferedImage.TYPE_INT_ARGB);
final AffineTransform at = new AffineTransform();
at.scale(1f / JAnsi8Engine.C_MUL_X, 1f / JAnsi8Engine.C_MUL_Y);
final AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
after = scaleOp.filter(bufferedImage, after);
final int width = after.getWidth(null);
final int height = after.getHeight(null);
final int[] pixels = new int[width * height];
for (int i = 0; i < width; i++)
for (int j = 0; j < height; j++)
pixels[i + j * width] = after.getRGB(i, j);
return pixels;
}
@Override
public void initialize(final GraphicEngine d) {
}
@Override
public void use(final GraphicEngine d) {
((JAnsi8Renderer) d.getRenderer()).currentSkin = this;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public int getSkinWidth() {
return 0;
}
@Override
public int getSkinHeight() {
return 0;
}
}

View File

@ -176,7 +176,7 @@ public class SwingEngine implements GraphicEngine {
public boolean isSupported() {
if (StaticVars.startupArguments.isEngineForced() && StaticVars.startupArguments.isCPUEngineForced() == false)
return false;
return (StaticVars.startupArguments.isHeadlessEngineForced() || GraphicsEnvironment.isHeadless()) == false;
return (GraphicsEnvironment.isHeadless()) == false;
}
@Override

View File

@ -162,8 +162,6 @@ public class JOGLEngine implements GraphicEngine {
public boolean isSupported() {
if (StaticVars.startupArguments.isEngineForced() && StaticVars.startupArguments.isGPUEngineForced() == false)
return false;
if (StaticVars.startupArguments.isHeadlessEngineForced())
return false;
boolean available = false;
boolean errored = false;
try {

View File

@ -168,8 +168,6 @@ public class FBEngine implements GraphicEngine {
public boolean isSupported() {
if (StaticVars.startupArguments.isEngineForced() && StaticVars.startupArguments.isFrameBufferEngineForced() == false)
return false;
if (StaticVars.startupArguments.isHeadlessEngineForced())
return false;
/*
File fbFile = new File("/dev/fb1");
try {

View File

@ -0,0 +1,9 @@
<html>
<body bgcolor="white">
<p>
Contains the code related to chunk management for the PNGJ library.</p>
<p>
Only needed by client code if some special chunk handling is required.
</p>
</body>
</html>

View File

@ -0,0 +1,49 @@
<html>
<body bgcolor="white">
<p>
PNGJ main package
</p>
<p>
Users of this library should rarely need more than the public members of this package.<br>
Newcomers: start with <a href="PngReader.html">PngReader</a> and <a href="PngWriter.html">PngWriter</a>.
</p>
<p>
Example of use: this code reads a true colour PNG image (RGB8 or RGBA8)
and reduces the red channel by half, increasing the green by 20.
It copies all the "safe" metadata from the original image, and adds a textual metadata.
<pre class="code">
public static void convert(String origFilename, String destFilename) {
// you can also use PngReader (esentially the same) or PngReaderByte
PngReaderInt pngr = new PngReaderInt(new File(origFilename));
System.out.println(pngr.toString());
int channels = pngr.imgInfo.channels;
if (channels &lt; 3 || pngr.imgInfo.bitDepth != 8)
throw new RuntimeException("For simplicity this supports only RGB8/RGBA8 images");
// writer with same image properties as original
PngWriter pngw = new PngWriter(new File(destFilename), pngr.imgInfo, true);
// instruct the writer to grab all ancillary chunks from the original
pngw.copyChunksFrom(pngr.getChunksList(), ChunkCopyBehaviour.COPY_ALL_SAFE);
// add a textual chunk to writer
pngw.getMetadata().setText(PngChunkTextVar.KEY_Description, "Decreased red and increased green");
// also: while(pngr.hasMoreRows())
for (int row = 0; row &lt; pngr.imgInfo.rows; row++) {
ImageLineInt l1 = pngr.readRowInt(); // each element is a sample
int[] scanline = l1.getScanline(); // to save typing
for (int j = 0; j < pngr.imgInfo.cols; j++) {
scanline[j * channels] /= 2;
scanline[j * channels + 1] = ImageLineHelper.clampTo_0_255(scanline[j * channels + 1] + 20);
}
pngw.writeRow(l1);
}
pngr.end(); // it's recommended to end the reader first, in case there are trailing chunks to read
pngw.end();
}
</pre>
For more examples, see the tests and samples.
</p>
</body>
</html>

View File

@ -0,0 +1,14 @@
<html>
<body bgcolor="white">
<p>
Mostly related with logic specific to reading/writing pixels.
</p>
<p>
Includes ImageLine related classes, and rows filtering
</p>
<p>
Some classes like ImageLineInt should belong here, but we keep them in the main package for backward compatibility.
</p>
</body>
</html>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<javadocOptions>
<docletArtifacts>
<docletArtifact />
</docletArtifacts>
<tagletArtifacts>
<tagletArtifact />
</tagletArtifacts>
<javadocResourcesDirectory>src/main/javadoc</javadocResourcesDirectory>
</javadocOptions>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
#Created by Apache Maven 3.5.2
groupId=it.cavallium
artifactId=warppi-teavm
version=0.9-SNAPSHOT

View File

@ -0,0 +1,119 @@
ar/com/hjg/pngj/chunks/PngChunkIEND.class
ar/com/hjg/pngj/ChunkSeqReader.class
ar/com/hjg/pngj/chunks/PngChunkMultiple.class
ar/com/hjg/pngj/PngWriterHc.class
ar/com/hjg/pngj/chunks/PngChunk.class
ar/com/hjg/pngj/IdatSet.class
ar/com/hjg/pngj/chunks/PngChunkIDAT.class
it/cavallium/warppi/teavm/TeaVMPngUtils.class
it/cavallium/warppi/teavm/TeaVMConsoleUtils$1.class
ar/com/hjg/pngj/PngjExceptionInternal.class
ar/com/hjg/pngj/ImageLineHelper.class
ar/com/hjg/pngj/ChunkSeqReader$2.class
ar/com/hjg/pngj/IImageLineSet.class
ar/com/hjg/pngj/chunks/PngMetadata.class
ar/com/hjg/pngj/chunks/PngChunkTextVar.class
ar/com/hjg/pngj/pixels/CompressorStreamLz4.class
ar/com/hjg/pngj/PngHelperInternal$1.class
ar/com/hjg/pngj/chunks/PngChunkUNKNOWN.class
ar/com/hjg/pngj/DeflatedChunksSet.class
ar/com/hjg/pngj/IPngWriterFactory.class
ar/com/hjg/pngj/ChunkSeqReaderPng$1.class
it/cavallium/warppi/teavm/TeaVMURLClassLoader.class
ar/com/hjg/pngj/PngReaderInt.class
ar/com/hjg/pngj/ChunkSeqReaderPng.class
it/cavallium/warppi/gui/graphicengine/html/HtmlFont.class
ar/com/hjg/pngj/IBytesConsumer.class
ar/com/hjg/pngj/pixels/FiltersPerformance.class
ar/com/hjg/pngj/PngjException.class
it/cavallium/warppi/teavm/TeaVMBoot.class
ar/com/hjg/pngj/pixels/DeflaterEstimatorHjg.class
ar/com/hjg/pngj/chunks/PngChunkTRNS.class
ar/com/hjg/pngj/Deinterlacer.class
ar/com/hjg/pngj/PngWriter.class
ar/com/hjg/pngj/chunks/ChunksList.class
it/cavallium/warppi/teavm/TeaVMStorageUtils.class
ar/com/hjg/pngj/chunks/ChunkHelper.class
ar/com/hjg/pngj/chunks/PngChunkHIST.class
ar/com/hjg/pngj/IImageLine.class
ar/com/hjg/pngj/chunks/PngChunkSRGB.class
ar/com/hjg/pngj/PngReaderApng$1.class
ar/com/hjg/pngj/chunks/PngChunkFCTL.class
ar/com/hjg/pngj/chunks/PngBadCharsetException.class
ar/com/hjg/pngj/chunks/PngChunkZTXT.class
ar/com/hjg/pngj/ImageInfo.class
ar/com/hjg/pngj/PngReader.class
ar/com/hjg/pngj/IDatChunkWriter.class
ar/com/hjg/pngj/PngjOutputException.class
ar/com/hjg/pngj/chunks/ChunkLoadBehaviour.class
ar/com/hjg/pngj/chunks/PngChunkSBIT.class
ar/com/hjg/pngj/chunks/PngChunkPHYS.class
ar/com/hjg/pngj/chunks/ChunksListForWrite.class
ar/com/hjg/pngj/chunks/PngChunkICCP.class
ar/com/hjg/pngj/pixels/PixelsWriterDefault.class
ar/com/hjg/pngj/chunks/PngChunkOFFS.class
ar/com/hjg/pngj/PngHelperInternal2.class
ar/com/hjg/pngj/BufferedStreamFeeder.class
ar/com/hjg/pngj/pixels/CompressorStream.class
ar/com/hjg/pngj/ChunkSeqSkipping.class
ar/com/hjg/pngj/pixels/PixelsWriterMultiple.class
ar/com/hjg/pngj/chunks/PngChunkITXT.class
ar/com/hjg/pngj/PngReaderFilter$1.class
ar/com/hjg/pngj/chunks/PngChunkSPLT.class
ar/com/hjg/pngj/IImageLineArray.class
ar/com/hjg/pngj/IdatSet$1.class
ar/com/hjg/pngj/pixels/DeflaterEstimatorLz4.class
it/cavallium/warppi/gui/graphicengine/html/HtmlEngine.class
ar/com/hjg/pngj/ImageLineSetDefault$1.class
ar/com/hjg/pngj/pixels/FiltersPerformance$1.class
ar/com/hjg/pngj/pixels/CompressorStreamDeflater.class
ar/com/hjg/pngj/PngReaderFilter.class
it/cavallium/warppi/teavm/TeaVMPngReader.class
ar/com/hjg/pngj/RowInfo.class
ar/com/hjg/pngj/pixels/PixelsWriter.class
ar/com/hjg/pngj/PngReaderByte.class
ar/com/hjg/pngj/chunks/ChunkPredicate.class
it/cavallium/warppi/gui/graphicengine/html/HtmlRenderer.class
ar/com/hjg/pngj/chunks/PngChunkSTER.class
ar/com/hjg/pngj/pixels/PixelsWriter$1.class
ar/com/hjg/pngj/chunks/PngChunkFDAT.class
ar/com/hjg/pngj/PngHelperInternal.class
ar/com/hjg/pngj/DeflatedChunkReader.class
ar/com/hjg/pngj/chunks/PngChunkTIME.class
ar/com/hjg/pngj/ImageLineByte.class
it/cavallium/warppi/teavm/TeaVMSettings.class
ar/com/hjg/pngj/ChunkSeqBuffering.class
ar/com/hjg/pngj/ChunkSeqReader$1.class
ar/com/hjg/pngj/chunks/PngChunkACTL.class
ar/com/hjg/pngj/ChunkReader$ChunkReaderMode.class
ar/com/hjg/pngj/FilterType.class
it/cavallium/warppi/teavm/TeaVMGpio.class
ar/com/hjg/pngj/chunks/PngChunkGAMA.class
ar/com/hjg/pngj/IImageLineSetFactory.class
ar/com/hjg/pngj/PngjUnsupportedException.class
ar/com/hjg/pngj/IImageLineFactory.class
ar/com/hjg/pngj/PngjInputException.class
ar/com/hjg/pngj/IChunkFactory.class
ar/com/hjg/pngj/chunks/PngChunkTEXT.class
ar/com/hjg/pngj/ImageLineSetDefault.class
it/cavallium/warppi/teavm/TeaVMPlatform.class
it/cavallium/warppi/teavm/TeaVMSemaphore.class
ar/com/hjg/pngj/chunks/PngChunkIHDR.class
ar/com/hjg/pngj/chunks/PngChunkPLTE.class
ar/com/hjg/pngj/chunks/PngChunkTextVar$PngTxtInfo.class
it/cavallium/warppi/teavm/TeaVMConsoleUtils.class
ar/com/hjg/pngj/chunks/ChunkHelper$1.class
it/cavallium/warppi/gui/graphicengine/html/HtmlSkin.class
ar/com/hjg/pngj/chunks/ChunkRaw.class
ar/com/hjg/pngj/chunks/ChunkCopyBehaviour.class
ar/com/hjg/pngj/ChunkReader.class
ar/com/hjg/pngj/ImageLineInt.class
ar/com/hjg/pngj/chunks/PngChunkCHRM.class
ar/com/hjg/pngj/chunks/ChunkFactory.class
ar/com/hjg/pngj/chunks/PngChunkSingle.class
ar/com/hjg/pngj/ChunkSeqSkipping$1.class
ar/com/hjg/pngj/chunks/PngChunkBKGD.class
ar/com/hjg/pngj/DeflatedChunksSet$State.class
ar/com/hjg/pngj/PngReaderApng.class
ar/com/hjg/pngj/PngjBadCrcException.class
ar/com/hjg/pngj/chunks/PngChunk$ChunkOrderingConstraint.class

View File

@ -0,0 +1,102 @@
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkHIST.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunkFactory.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkTIME.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/DeflatedChunksSet.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ChunkReader.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/CompressorStreamLz4.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ChunkSeqSkipping.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/PixelsWriterDefault.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngjOutputException.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngBadCharsetException.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlEngine.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngjBadCrcException.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/FiltersPerformance.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IImageLineSet.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngjException.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ChunkSeqReaderPng.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngReaderInt.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngjUnsupportedException.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunksList.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IdatSet.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunkLoadBehaviour.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkTRNS.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkZTXT.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMSettings.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMPngUtils.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ImageLineInt.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IBytesConsumer.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngReaderByte.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/DeflaterEstimatorHjg.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkSTER.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IImageLine.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/FilterType.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/PixelsWriterMultiple.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngReaderFilter.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunkRaw.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkFCTL.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkIHDR.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ChunkSeqReader.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMSemaphore.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMStorageUtils.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMGpio.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkGAMA.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/Deinterlacer.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunkPredicate.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngHelperInternal.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkPLTE.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMConsoleUtils.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkCHRM.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunkHelper.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkICCP.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkIDAT.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ImageLineHelper.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunk.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkIEND.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngjExceptionInternal.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/BufferedStreamFeeder.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IChunkFactory.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkBKGD.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkITXT.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngHelperInternal2.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkSingle.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkTextVar.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/CompressorStream.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkOFFS.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngjInputException.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMPngReader.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IImageLineFactory.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkUNKNOWN.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/PixelsWriter.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngWriterHc.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMURLClassLoader.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/DeflatedChunkReader.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/DeflaterEstimatorLz4.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IDatChunkWriter.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkMultiple.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngWriter.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunksListForWrite.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlRenderer.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ChunkSeqBuffering.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkSRGB.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngReader.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkFDAT.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/ChunkCopyBehaviour.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IImageLineSetFactory.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ImageLineSetDefault.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlSkin.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkSBIT.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkPHYS.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlFont.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IImageLineArray.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkTEXT.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkSPLT.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/IPngWriterFactory.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ImageInfo.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngMetadata.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/PngReaderApng.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/chunks/PngChunkACTL.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/pixels/CompressorStreamDeflater.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/ImageLineByte.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMPlatform.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/ar/com/hjg/pngj/RowInfo.java
/home/andreacavalli/Documents/WarpPI/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMBoot.java