projects
/
sixth-3d.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code cleanup and formatting.
[sixth-3d.git]
/
src
/
main
/
java
/
eu
/
svjatoslav
/
sixth
/
e3d
/
renderer
/
raster
/
shapes
/
composite
/
textcanvas
/
TextCanvas.java
diff --git
a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
index
5c594f2
..
737a5b8
100644
(file)
--- a/
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
+++ b/
src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
@@
-1,19
+1,19
@@
/*
/*
- * Sixth - System for data storage, computation, exploration and interaction.
- * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
+ * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 3 of the GNU Lesser General Public License
* or later as published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 3 of the GNU Lesser General Public License
* or later as published by the Free Software Foundation.
+ *
*/
package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
*/
package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
-import eu.svjatoslav.sixth.e3d.geometry.TransformPipe;
import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
import eu.svjatoslav.sixth.e3d.gui.TextPointer;
import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
import eu.svjatoslav.sixth.e3d.gui.TextPointer;
+import eu.svjatoslav.sixth.e3d.math.Transform;
+import eu.svjatoslav.sixth.e3d.math.TransformPipe;
import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.TexturedRectangle;
import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.TexturedRectangle;
@@
-38,8
+38,7
@@
public class TextCanvas extends TexturedRectangle {
private Color foregroundColor = Color.WHITE;
public TextCanvas(final Transform location, final String text,
private Color foregroundColor = Color.WHITE;
public TextCanvas(final Transform location, final String text,
- final Color foregroundColor, final Color backgroundColor)
- throws IOException {
+ final Color foregroundColor, final Color backgroundColor) {
this(location, getTextDimensions(text), foregroundColor,
backgroundColor);
setText(text);
this(location, getTextDimensions(text), foregroundColor,
backgroundColor);
setText(text);
@@
-86,8
+85,7
@@
public class TextCanvas extends TexturedRectangle {
setRenderMode(RenderMode.TEXTURE);
}
setRenderMode(RenderMode.TEXTURE);
}
- public static TextPointer getTextDimensions(final String text)
- throws IOException {
+ public static TextPointer getTextDimensions(final String text) {
final BufferedReader reader = new BufferedReader(new StringReader(text));
final BufferedReader reader = new BufferedReader(new StringReader(text));
@@
-95,7
+93,12
@@
public class TextCanvas extends TexturedRectangle {
int columns = 0;
while (true) {
int columns = 0;
while (true) {
- final String line = reader.readLine();
+ final String line;
+ try {
+ line = reader.readLine();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
if (line == null)
return new TextPointer(rows, columns);
if (line == null)
return new TextPointer(rows, columns);
@@
-147,7
+150,7
@@
public class TextCanvas extends TexturedRectangle {
}
private void drawCharToTexture(final int row, final int column,
}
private void drawCharToTexture(final int row, final int column,
- final char character, final Color
background, final Color
foreground) {
+ final char character, final Color foreground) {
final Graphics2D graphics = getTexture().graphics;
getTexture().primaryBitmap.drawRectangle(column * FONT_CHAR_WIDTH, row
final Graphics2D graphics = getTexture().graphics;
getTexture().primaryBitmap.drawRectangle(column * FONT_CHAR_WIDTH, row
@@
-212,7
+215,7
@@
public class TextCanvas extends TexturedRectangle {
canvasCharacter.setValue(character);
canvasCharacter.setBackgroundColor(backgroundColor);
canvasCharacter.setForegroundColor(foregroundColor);
canvasCharacter.setValue(character);
canvasCharacter.setBackgroundColor(backgroundColor);
canvasCharacter.setForegroundColor(foregroundColor);
- drawCharToTexture(row, column, character,
backgroundColor,
+ drawCharToTexture(row, column, character,
foregroundColor);
}
foregroundColor);
}
@@
-248,13
+251,18
@@
public class TextCanvas extends TexturedRectangle {
renderMode = mode;
}
renderMode = mode;
}
- public void setText(final String text)
throws IOException
{
+ public void setText(final String text) {
final BufferedReader reader = new BufferedReader(new StringReader(text));
int row = 0;
while (true) {
final BufferedReader reader = new BufferedReader(new StringReader(text));
int row = 0;
while (true) {
- final String line = reader.readLine();
+ final String line;
+ try {
+ line = reader.readLine();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
if (line == null)
return;
if (line == null)
return;