| •1 |
|
| 2 |
|
| 3 |
|
| •4 |
|
| 5 |
|
| •6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| •11 |
|
| 12 |
|
| 13 |
|
| •14 |
|
| 15 |
|
| •16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
package org.stathissideris.ascii2image.core; |
| 21 |
|
| •22 |
import java.awt.Color; |
| 23 |
import java.util.HashMap; |
| 24 |
|
| 25 |
import org.stathissideris.ascii2image.graphics.CustomShapeDefinition; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public class RenderingOptions { |
| 32 |
|
| 33 |
private HashMap<String, CustomShapeDefinition> customShapes; |
| 34 |
|
| 35 |
private boolean dropShadows = true; |
| 36 |
private boolean renderDebugLines = false; |
| 37 |
private boolean antialias = true; |
| •38 |
private boolean fixedSlope = false; |
| 39 |
|
| 40 |
private int cellWidth = 10; |
| 41 |
private int cellHeight = 14; |
| 42 |
|
| 43 |
private float scale = 1; |
| •44 |
|
| 45 |
private Color backgroundColor = Color.white; |
| 46 |
|
| 47 |
public enum ImageType { PNG, SVG }; |
| 48 |
|
| 49 |
private ImageType imageType = ImageType.PNG; |
| 50 |
|
| 51 |
public ImageType getImageType() { return imageType; } |
| 52 |
public void setImageType(ImageType type) { imageType = type; } |
| 53 |
|
| 54 |
private String fontFamily = "Courier"; |
| 55 |
private String fontURL = null; |
| 56 |
|
| 57 |
public String getFontFamily() { return fontFamily; } |
| 58 |
public String getFontURL() { return fontURL; } |
| 59 |
public void setFontURL(String url) { fontFamily = "Custom"; fontURL = url; } |
| 60 |
|
| 61 |
public int getCellHeight() { |
| 62 |
return cellHeight; |
| 63 |
} |
| 64 |
|
| 65 |
public int getCellWidth() { |
| 66 |
return cellWidth; |
| 67 |
} |
| 68 |
|
| 69 |
public boolean dropShadows() { |
| 70 |
return dropShadows; |
| 71 |
} |
| 72 |
|
| 73 |
public boolean renderDebugLines() { |
| 74 |
return renderDebugLines; |
| 75 |
} |
| 76 |
|
| 77 |
public float getScale() { |
| 78 |
return scale; |
| 79 |
} |
| 80 |
|
| 81 |
public void setDropShadows(boolean b) { |
| 82 |
dropShadows = b; |
| 83 |
} |
| 84 |
|
| 85 |
public void setRenderDebugLines(boolean b) { |
| 86 |
renderDebugLines = b; |
| 87 |
} |
| 88 |
|
| 89 |
public void setScale(float f) { |
| 90 |
scale = f; |
| 91 |
cellWidth *= scale; |
| 92 |
cellHeight *= scale; |
| 93 |
} |
| 94 |
|
| 95 |
public boolean performAntialias() { |
| 96 |
return antialias; |
| 97 |
} |
| 98 |
|
| 99 |
public void setAntialias(boolean b) { |
| 100 |
antialias = b; |
| 101 |
} |
| 102 |
|
| •103 |
public Color getBackgroundColor() { |
| 104 |
return backgroundColor; |
| 105 |
} |
| 106 |
|
| 107 |
public void setBackgroundColor(Color backgroundColor) { |
| 108 |
this.backgroundColor = backgroundColor; |
| 109 |
} |
| 110 |
|
| 111 |
public boolean needsTransparency() { |
| 112 |
return backgroundColor.getAlpha() < 255; |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
public boolean isFixedSlope() { |
| 121 |
return fixedSlope; |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
public void setFixedSlope(boolean b) { |
| 130 |
this.fixedSlope = b; |
| 131 |
} |
| 132 |
} |