Package org.daisy.dotify.api.graphics
Class BrailleGraphics
- java.lang.Object
-
- org.daisy.dotify.api.graphics.BrailleGraphics
-
public class BrailleGraphics extends Object
Provides basic braille graphics support using standard braille patterns.
-
-
Constructor Summary
Constructors Constructor Description BrailleGraphics(boolean eightDot)
Creates a new instance of braille graphics, with either full 8-dot or 6-dot patterns.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<String>
combine(List<String> background, List<String> overlay, int x, int y)
Combines two braille images by combining characters from the two input images.List<String>
renderGraphics(Raster r)
Renders the raster using braille characters.static List<String>
sixDotFilter(List<String> input)
Filters the input braille image by discarding dots 7 and 8.
-
-
-
Method Detail
-
renderGraphics
public List<String> renderGraphics(Raster r)
Renders the raster using braille characters. It is assumed, in both 6-dot and 8-dot mode, that the next line follows directly after the previous line ends. In other words, no pixels are skipped in either mode. To get a better diagonal representation in 6-dot mode, render in 8-dot mode and filter the result using sixDotFilter.- Parameters:
r
- the raster to render- Returns:
- a braille image using characters in the range 0x2800-0x28FF or 0x2800-0x283F
-
sixDotFilter
public static List<String> sixDotFilter(List<String> input)
Filters the input braille image by discarding dots 7 and 8.- Parameters:
input
- the braille input, characters in the range 0x2800-0x28FF- Returns:
- the filtered braille image, characters in the range 0x2800-0x283F
-
combine
public static List<String> combine(List<String> background, List<String> overlay, int x, int y)
Combines two braille images by combining characters from the two input images. The overlay image overwrites a portion of the background image where it is placed. Bounds checking is performed to ensure that the overlay image is placed completely within the size of the background data.- Parameters:
background
- the image onto which data is to be placedoverlay
- the image to place onto the backgroundx
- the overlay offset in charactersy
- the overlay offset in rows- Returns:
- returns the combined image
- Throws:
IllegalArgumentException
- if x or y is negative, or if the overlay are out of bounds of the background image.
-
-