------------------------------------------------------------------------------ Fill a tube (thick line for initial 2D implementation).
| 396 | //------------------------------------------------------------------------------ |
| 397 | // Fill a tube (thick line for initial 2D implementation). |
| 398 | void vtkImageCanvasSource2D::FillTube(int a0, int a1, int b0, int b1, double radius) |
| 399 | { |
| 400 | void* ptr; |
| 401 | int z = this->DefaultZ; |
| 402 | int* extent = this->ImageData->GetExtent(); |
| 403 | |
| 404 | // Pre-multiply coords if needed |
| 405 | if (this->Ratio[0] != 1.0) |
| 406 | { |
| 407 | a0 = int(double(a0) * this->Ratio[0]); |
| 408 | b0 = int(double(b0) * this->Ratio[0]); |
| 409 | radius = int(radius * this->Ratio[0]); |
| 410 | } |
| 411 | if (this->Ratio[1] != 1.0) |
| 412 | { |
| 413 | a1 = int(double(a1) * this->Ratio[1]); |
| 414 | b1 = int(double(b1) * this->Ratio[1]); |
| 415 | } |
| 416 | if (this->Ratio[2] != 1.0) |
| 417 | { |
| 418 | z = int(double(z) * this->Ratio[2]); |
| 419 | } |
| 420 | |
| 421 | z = (z < extent[4]) ? extent[4] : z; |
| 422 | z = (z > extent[5]) ? extent[5] : z; |
| 423 | |
| 424 | ptr = this->ImageData->GetScalarPointer(extent[0], extent[2], z); |
| 425 | switch (this->ImageData->GetScalarType()) |
| 426 | { |
| 427 | vtkTemplateMacro(vtkImageCanvasSource2DFillTube( |
| 428 | this->ImageData, this->DrawColor, static_cast<VTK_TT*>(ptr), a0, a1, b0, b1, radius)); |
| 429 | default: |
| 430 | vtkErrorMacro(<< "FillTube: Cannot handle ScalarType."); |
| 431 | } |
| 432 | this->Modified(); |
| 433 | } |
| 434 | |
| 435 | //------------------------------------------------------------------------------ |
| 436 | // Fill a triangle (rasterize) |
no test coverage detected