@@ -3,6 +3,7 @@ import { Mask } from '../Mask';
3
3
import { Point } from '../utils/geometry/points' ;
4
4
import { getDefaultColor } from '../utils/getDefaultColor' ;
5
5
import { getOutputImage , maskToOutputMask } from '../utils/getOutputImage' ;
6
+ import { setBlendedVisiblePixel } from '../utils/setBlendedVisiblePixel' ;
6
7
import checkProcessable from '../utils/validators/checkProcessable' ;
7
8
8
9
export interface DrawRectangleOptions < OutType > {
@@ -82,16 +83,24 @@ export function drawRectangle(
82
83
currentColumn < column + width ;
83
84
currentColumn ++
84
85
) {
85
- newImage . setVisiblePixel ( currentColumn , row , strokeColor ) ;
86
- newImage . setVisiblePixel ( currentColumn , row + height - 1 , strokeColor ) ;
86
+ setBlendedVisiblePixel ( newImage , currentColumn , row , {
87
+ color : strokeColor ,
88
+ } ) ;
89
+ setBlendedVisiblePixel ( newImage , currentColumn , row + height - 1 , {
90
+ color : strokeColor ,
91
+ } ) ;
87
92
}
88
93
for (
89
94
let currentRow = row + 1 ;
90
95
currentRow < row + height - 1 ;
91
96
currentRow ++
92
97
) {
93
- newImage . setVisiblePixel ( column , currentRow , strokeColor ) ;
94
- newImage . setVisiblePixel ( column + width - 1 , currentRow , strokeColor ) ;
98
+ setBlendedVisiblePixel ( newImage , column , currentRow , {
99
+ color : strokeColor ,
100
+ } ) ;
101
+ setBlendedVisiblePixel ( newImage , column + width - 1 , currentRow , {
102
+ color : strokeColor ,
103
+ } ) ;
95
104
}
96
105
}
97
106
if ( fillColor !== 'none' ) {
@@ -105,8 +114,12 @@ export function drawRectangle(
105
114
currentColumn < column + width - 1 ;
106
115
currentColumn ++
107
116
) {
108
- newImage . setVisiblePixel ( currentColumn , currentRow , fillColor ) ;
109
- newImage . setVisiblePixel ( currentColumn , currentRow , fillColor ) ;
117
+ /* setBlendedVisiblePixel(newImage, currentColumn, currentRow, {
118
+ color: fillColor,
119
+ });*/
120
+ setBlendedVisiblePixel ( newImage , currentColumn , currentRow , {
121
+ color : fillColor ,
122
+ } ) ;
110
123
}
111
124
}
112
125
}
0 commit comments