mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-13 03:30:28 +00:00
Added lo/hi variations for black and white. Also made incremental improvements for image editing (fixed slowness issues)
This commit is contained in:
parent
ca3f295d8d
commit
21e5495202
@ -54,6 +54,7 @@ public class FileUtils {
|
||||
}
|
||||
if (create) {
|
||||
File file = f.showSaveDialog(Application.getPrimaryStage());
|
||||
if (file == null) return null;
|
||||
if (!file.getName().contains(".")) {
|
||||
return new File(file.getParentFile(), file.getName() + "." + supportedExtensions[0].extension);
|
||||
} else {
|
||||
|
@ -32,7 +32,7 @@ import org.badvision.outlaweditor.data.xml.PlatformData;
|
||||
*/
|
||||
public class AppleImageEditor extends ImageEditor implements EventHandler<MouseEvent> {
|
||||
|
||||
public int[] currentFillPattern = FillPattern.White.bytePattern;
|
||||
public int[] currentFillPattern = FillPattern.White_PC.bytePattern;
|
||||
public boolean hiBitMatters = true;
|
||||
protected DrawMode currentDrawMode = DrawMode.Pencil1px;
|
||||
protected WritableImage currentImage;
|
||||
@ -136,9 +136,13 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
break;
|
||||
}
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
|
||||
public void setDataAndRedraw(byte[] data) {
|
||||
setData(data);
|
||||
redraw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void togglePanZoom() {
|
||||
anchorPane.getChildren().stream().filter((n) -> !(n == screen)).forEach((n) -> {
|
||||
@ -390,7 +394,7 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
if (Clipboard.getSystemClipboard().hasContent(DataFormat.IMAGE)) {
|
||||
javafx.scene.image.Image image = Clipboard.getSystemClipboard().getImage();
|
||||
|
||||
importImage(image);
|
||||
importImage(image);
|
||||
}
|
||||
}
|
||||
//selection/map/2/x1/0/y1/0/x2/19/y2/11
|
||||
@ -431,7 +435,7 @@ public class AppleImageEditor extends ImageEditor implements EventHandler<MouseE
|
||||
private void importImage(javafx.scene.image.Image image) {
|
||||
ImageDitherEngine ditherEngine = new ImageDitherEngine(getPlatform());
|
||||
ditherEngine.setTargetCoordinates(0,0);
|
||||
UIAction.openImageConversionModal(image, ditherEngine, getWidth(), getHeight(), this::setData);
|
||||
UIAction.openImageConversionModal(image, ditherEngine, getWidth(), getHeight(), this::setDataAndRedraw);
|
||||
}
|
||||
|
||||
private int calculateHiresOffset(int y) {
|
||||
|
@ -95,8 +95,12 @@ public enum FillPattern {
|
||||
LightOrange2(true, 4, true,
|
||||
"-+++-+++-+++-+++-+++-+++-+++",
|
||||
"++-+++-+++-+++-+++-+++-+++-+"),
|
||||
Black(false, 1, false, "-------"),
|
||||
White(false, 1, false, "+++++++"),
|
||||
Black_PC(false, 1, false, "-------"),
|
||||
Black_Lo(true, 1, false, "-------"),
|
||||
Black_Hi(true, 1, true, "-------"),
|
||||
White_PC(false, 1, false, "+++++++"),
|
||||
White_Lo(true, 1, false, "+++++++"),
|
||||
White_Hi(true, 1, true, "+++++++"),
|
||||
BW1(false, 4, false,
|
||||
"++--++--++--++--++--++--++--",
|
||||
"--++--++--++--++--++--++--++"
|
||||
|
@ -4,7 +4,6 @@ import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javafx.scene.SnapshotParameters;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
@ -84,9 +83,7 @@ public class ImageDitherEngine {
|
||||
}
|
||||
|
||||
public WritableImage getPreviewImage() {
|
||||
WritableImage out = new WritableImage(pixelRenderWidth, height * 2);
|
||||
platform.imageRenderer.renderImage(out, screen, bufferWidth, height);
|
||||
return out;
|
||||
return platform.imageRenderer.renderImage(null, screen, bufferWidth, height);
|
||||
}
|
||||
|
||||
public void setOutputDimensions(int width, int height) {
|
||||
|
@ -50,16 +50,16 @@ public class AppleDHGRImageRenderer extends AppleImageRenderer {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public WritableImage renderImage(WritableImage img, byte[] rawImage) {
|
||||
// if (img == null) {
|
||||
// img = new WritableImage(560, 384);
|
||||
// }
|
||||
// for (int y = 0; y < 192; y++) {
|
||||
// renderScanline(img, y, rawImage);
|
||||
// }
|
||||
// return img;
|
||||
// }
|
||||
@Override
|
||||
public WritableImage renderImage(WritableImage img, byte[] rawImage, int width, int height) {
|
||||
if (img == null) {
|
||||
img = new WritableImage(width * 7, height * 2);
|
||||
}
|
||||
for (int y = 0; y < height; y++) {
|
||||
renderScanline(img, y, width, rawImage);
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WritableImage renderScanline(WritableImage img, int y, int width, byte[] rawImage) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user