Debian Codegraph @

src/org/stathissideris/ascii2image/core/RenderingOptions.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /**
2 * ditaa - Diagrams Through Ascii Art
3 *
•4 * Copyright (C) 2004-2011 Efstathios Sideris
5 *
•6 * ditaa is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of
9 * the License, or (at your option) any later version.
10 *
•11 * ditaa is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
•14 * GNU Lesser General Public License for more details.
15 *
•16 * You should have received a copy of the GNU Lesser General Public
17 * License along with ditaa. If not, see <http://www.gnu.org/licenses/>.
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 * @author Efstathios Sideris
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 * Should the sides of trapezoids and parallelograms have fixed width (false, default)
117 * or fixed slope (true)?
118 * @return true for fixed slope, false for fixed width
119 */
120 public boolean isFixedSlope() {
121 return fixedSlope;
122 }
123
124 /**
125 * Should the sides of trapezoids and parallelograms have fixed width (false, default)
126 * or fixed slope (true)?
127 * @param b true for fixed slope, false for fixed width
128 */
129 public void setFixedSlope(boolean b) {
130 this.fixedSlope = b;
131 }
132 }