4
4
5
5
package mono.bitmap.manager.factory
6
6
7
+ import mono.common.Characters
7
8
import mono.graphics.bitmap.MonoBitmap
8
9
import mono.graphics.geo.Point
9
10
import mono.shape.extra.LineExtra
@@ -26,8 +27,8 @@ object LineBitmapFactory {
26
27
val strokeStyle = lineExtra.strokeStyle ? : PredefinedStraightStrokeStyle .NO_STROKE
27
28
createCharPoints(jointPoints, strokeStyle)
28
29
.forEachIndexed { index, pointChar ->
29
- val char = if (dashPattern.isGap(index)) ' ' else pointChar.char
30
- bitmapBuilder.put(pointChar.top, pointChar.left, char)
30
+ val visualChar = if (dashPattern.isGap(index)) ' ' else pointChar.char
31
+ bitmapBuilder.put(pointChar.top, pointChar.left, visualChar, pointChar. char)
31
32
}
32
33
33
34
val startAnchor = lineExtra.startAnchor
@@ -124,7 +125,13 @@ object LineBitmapFactory {
124
125
} else {
125
126
if (anchor.top < previousPoint.top) anchorChar.top else anchorChar.bottom
126
127
}
127
- put(anchor.row, anchor.column, char)
128
+ // Anchor point won't override the direction char.
129
+ put(
130
+ row = anchor.row,
131
+ column = anchor.column,
132
+ visualChar = char,
133
+ directionChar = Characters .TRANSPARENT_CHAR
134
+ )
128
135
}
129
136
130
137
private fun isHorizontal (point1 : Point , point2 : Point ): Boolean = point1.top == point2.top
@@ -137,8 +144,8 @@ object LineBitmapFactory {
137
144
) {
138
145
private val builder = MonoBitmap .Builder (width, height)
139
146
140
- fun put (row : Int , column : Int , char : Char ) =
141
- builder.put(row - row0, column - column0, char )
147
+ fun put (row : Int , column : Int , visualChar : Char , directionChar : Char ) =
148
+ builder.put(row - row0, column - column0, visualChar, directionChar )
142
149
143
150
fun toBitmap (): MonoBitmap = builder.toBitmap()
144
151
0 commit comments