Class DotMapperConfiguration.Builder
- java.lang.Object
-
- org.daisy.braille.utils.impl.tools.embosser.DotMapperConfiguration.Builder
-
- Enclosing class:
- DotMapperConfiguration
public static class DotMapperConfiguration.Builder extends Object
Provides a builder for aDotMapperConfiguration
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DotMapperConfiguration.Builder
baseCharacter(char value)
Sets the base character.DotMapperConfiguration
build()
Builds a new configuration based on the current state of the builder.DotMapperConfiguration.Builder
cellHeight(int value)
Sets the output cell height for this configuration.DotMapperConfiguration.Builder
cellWidth(int value)
Sets the output cell width for this configuration.DotMapperConfiguration.Builder
inputCellHeight(int value)
Sets the cell height of the input data.DotMapperConfiguration.Builder
map(int[] value)
Sets the bit pattern mapper.
-
-
-
Method Detail
-
cellHeight
public DotMapperConfiguration.Builder cellHeight(int value)
Sets the output cell height for this configuration. This represents the height of the window used to construct an output character from the dot grid. For example, if cellHeight = 1 and cellWidth = 1 then only two different characters will be used in the result, regardless of the contents of the input. In other words, this would be binary encoding using unicode characters).- Parameters:
value
- the value- Returns:
- this builder
-
cellWidth
public DotMapperConfiguration.Builder cellWidth(int value)
Sets the output cell width for this configuration. This represents the width of the window used to construct an output character from the dot grid. See alsocellHeight(int)
.- Parameters:
value
- the value- Returns:
- this builder
-
inputCellHeight
public DotMapperConfiguration.Builder inputCellHeight(int value)
Sets the cell height of the input data. For values less than 4, some input data may be ignored. For example, if this option is set to 3, dots 7 and 8 will be ignored. This is useful when mapping a 6-dot graphic onto 8-dot cells.- Parameters:
value
- the height, in the range [1, 4].- Returns:
- this builder
-
baseCharacter
public DotMapperConfiguration.Builder baseCharacter(char value)
Sets the base character. This character is used when all "bits" in the pattern are zero.- Parameters:
value
- the value- Returns:
- this builder
-
map
public DotMapperConfiguration.Builder map(int[] value)
Sets the bit pattern mapper. This maps input dots in a braille cell to a bit in the output character's bit pattern. When an input dot is present, it sets the corresponding bit in the output character. The result is superimposed onto the base character with logical or.- Parameters:
value
- an array of integers (all a power of two). Each value must occur only once.- Returns:
- this builder
- Throws:
IllegalArgumentException
- if any value isn't a power of two, or if a value occurs more than once.
-
build
public DotMapperConfiguration build()
Builds a new configuration based on the current state of the builder.- Returns:
- a new
DotMapperConfiguration
-
-