| 330 | // Draw a filled in block, defined by the corners of its rectangle. |
| 331 | |
| 332 | void DrawBlock(int x1, int y1, int x2, int y2) |
| 333 | { |
| 334 | int x, y; |
| 335 | |
| 336 | if (gs.fThick) { |
| 337 | x2 += gi.nScaleT; y2 += gi.nScaleT; |
| 338 | } |
| 339 | if (gi.fFile) { |
| 340 | if (gs.ft == ftBmp) { |
| 341 | // Force the coordinates to be within the bounds of the bitmap array. |
| 342 | if (x1 < 0) |
| 343 | x1 = 0; |
| 344 | if (x2 >= gs.xWin) |
| 345 | x2 = gs.xWin-1; |
| 346 | if (y1 < 0) |
| 347 | y1 = 0; |
| 348 | else if (y2 >= gs.yWin) |
| 349 | y2 = gs.yWin-1; |
| 350 | // For bitmap, just fill in the array. |
| 351 | if (!gi.fBmp) { |
| 352 | for (y = y1; y <= y2; y++) |
| 353 | for (x = x1; x <= x2; x++) |
| 354 | BmSet(gi.bm, x, y, gi.kiCur); |
| 355 | } else { |
| 356 | for (y = y1; y <= y2; y++) |
| 357 | for (x = x1; x <= x2; x++) |
| 358 | BmpSetXY(&gi.bmp, x, y, gi.kvCur); |
| 359 | } |
| 360 | } |
| 361 | #ifdef PS |
| 362 | else if (gs.ft == ftPS) { |
| 363 | DrawColor(gi.kiCur); |
| 364 | fprintf(gi.file, "%d %d %d %d rf\n", |
| 365 | Max(x1-gi.nPenWid/4, 0), Max(y1-gi.nPenWid/4, 0), |
| 366 | x2-x1+gi.nPenWid/4, y2-y1+gi.nPenWid/4); |
| 367 | } |
| 368 | #endif |
| 369 | #ifdef META |
| 370 | else if (gs.ft == ftWmf) { |
| 371 | gi.kiFillDes = gi.kiCur; |
| 372 | MetaSelect(); |
| 373 | MetaRectangle(x1-gi.nPenWid, y1-gi.nPenWid, |
| 374 | x2+gi.nPenWid, y2+gi.nPenWid); |
| 375 | } |
| 376 | #endif |
| 377 | #ifdef SVG |
| 378 | else if (gs.ft == ftSVG) { |
| 379 | SvgSetColor(); |
| 380 | fprintf(gi.file, "<rect width=\"%d\" height=\"%d\" x=\"%d\" y=\"%d\" " |
| 381 | "fill=\"%s\"/>\n", x2-x1+1, y2-y1+1, x1, y1, SzColorHTML(gi.kiSvgAct)); |
| 382 | } |
| 383 | #endif |
| 384 | #ifdef WIRE |
| 385 | else if (gs.ft == ftWire) { |
| 386 | if (x1 == x2 || y1 == y2) |
| 387 | WireLine(x1, y1, 0, x2, y2, 0); |
| 388 | } |
| 389 | #endif |
no test coverage detected