/*
- * 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.
+ *
*/
package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas;
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);
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));
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);
}
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
canvasCharacter.setValue(character);
canvasCharacter.setBackgroundColor(backgroundColor);
canvasCharacter.setForegroundColor(foregroundColor);
- drawCharToTexture(row, column, character, backgroundColor,
+ drawCharToTexture(row, column, character,
foregroundColor);
}
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 String line = reader.readLine();
+ final String line;
+ try {
+ line = reader.readLine();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
if (line == null)
return;