@@ -103,7 +103,7 @@ protected function drawImage():void{
103
103
104
104
foreach ($ this ->matrix ->matrix () as $ y => $ row ){
105
105
foreach ($ row as $ x => $ M_TYPE ){
106
- $ this ->drawPixel ($ x , $ y , $ M_TYPE );
106
+ $ this ->setPixel ($ x , $ y , $ M_TYPE );
107
107
}
108
108
}
109
109
@@ -113,14 +113,22 @@ protected function drawImage():void{
113
113
/**
114
114
* draws a single pixel at the given position
115
115
*/
116
- protected function drawPixel (int $ x , int $ y , int $ M_TYPE ):void {
116
+ protected function setPixel (int $ x , int $ y , int $ M_TYPE ):void {
117
117
$ this ->imagickDraw ->setStrokeColor ($ this ->moduleValues [$ M_TYPE ]);
118
118
$ this ->imagickDraw ->setFillColor ($ this ->moduleValues [$ M_TYPE ]);
119
- $ this ->imagickDraw ->rectangle (
120
- $ x * $ this ->scale ,
121
- $ y * $ this ->scale ,
122
- ($ x + 1 ) * $ this ->scale ,
123
- ($ y + 1 ) * $ this ->scale
119
+
120
+ $ this ->options ->drawCircularModules && !$ this ->matrix ->checkTypes ($ x , $ y , $ this ->options ->keepAsSquare )
121
+ ? $ this ->imagickDraw ->circle (
122
+ ($ x + 0.5 ) * $ this ->scale ,
123
+ ($ y + 0.5 ) * $ this ->scale ,
124
+ ($ x + 0.5 + $ this ->options ->circleRadius ) * $ this ->scale ,
125
+ ($ y + 0.5 ) * $ this ->scale
126
+ )
127
+ : $ this ->imagickDraw ->rectangle (
128
+ $ x * $ this ->scale ,
129
+ $ y * $ this ->scale ,
130
+ ($ x + 1 ) * $ this ->scale ,
131
+ ($ y + 1 ) * $ this ->scale
124
132
);
125
133
}
126
134
0 commit comments