Table Of Contents

Previous topic

7.8. Estimating the mask of a polygon shape

Next topic

7.10. Editing the color of shapes

Download

7.9. Estimating the mask of a polygon shape with Qt tools

spot

We wish to use the Qt classes to initialize the polygon shape mask. As for the corresponding algorithm development, the mask should hold the value:

  • 1 if a pixel is inside the polygon or on its contour,
  • 0 otherwise.

FYI, the Qt class to use is QBitmap.

The main steps of this exercize are:

  • to instantiate a QBitmap object,
  • to associate it with a QPainter object so as to draw the contour along the same principle than the on-screen display,
  • fill the contour using a QBrush,
  • initialize m_mask from the bitmap.
../_images/validate-step1.jpg

Validate this step