Mercurial > hg > orthanc-stone
diff Framework/Radiography/RadiographyMaskLayer.cpp @ 677:077f28e3ea3d am-dev
clip mask before drawing
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 16 May 2019 10:46:35 +0200 |
parents | 42dadae61fa9 |
children | a5f2a6b04a31 |
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyMaskLayer.cpp Thu May 16 09:49:30 2019 +0200 +++ b/Framework/Radiography/RadiographyMaskLayer.cpp Thu May 16 10:46:35 2019 +0200 @@ -135,8 +135,16 @@ // first fill the complete image Orthanc::ImageProcessing::Set(*mask_, OUT_MASK_VALUE); + // clip corners + std::vector<Orthanc::ImageProcessing::ImagePoint> clippedCorners; + for (size_t i = 0; i < corners_.size(); i++) + { + clippedCorners.push_back(corners_[i]); + clippedCorners[i].ClipTo(0, mask_->GetWidth() - 1, 0, mask_->GetHeight() - 1); + } + // fill mask - Orthanc::ImageProcessing::FillPolygon(*mask_, corners_, IN_MASK_VALUE); + Orthanc::ImageProcessing::FillPolygon(*mask_, clippedCorners, IN_MASK_VALUE); }