|
ACF $AcfVersion:0$
|
Representation of a 2D-region as container of bitmap line scans. More...
#include <CScanlineMask.h>
Public Types | |
| typedef i2d::CObject2dBase | BaseClass |
| typedef QList< istd::CIntRanges > | RangesContainer |
| typedef std::vector< int > | Scanlines |
Public Types inherited from i2d::IObject2d | |
| enum | ChangeFlags { CF_OBJECT_POSITION = 0x6ba340 } |
Public Types inherited from istd::IChangeable | |
| enum | ChangeFlags { CF_ACF_INTERNAL = 0 , CF_ALL_DATA , CF_ANY , CF_DESTROYING , CF_DELEGATED , CF_NO_UNDO } |
| Data model change notification flags. More... | |
| enum | SupportedOperations { SO_NONE = 0 , SO_OBSERVE = 1 << 0 , SO_COPY = 1 << 1 , SO_CLONE = 1 << 2 , SO_COMPARE = 1 << 3 , SO_RESET = 1 << 4 } |
| Flags for supported operations. More... | |
| enum | CompatibilityMode { CM_STRICT , CM_WITHOUT_REFS , CM_WITH_REFS , CM_CONVERT } |
| Control how relationship betweeen objects are interpreted. More... | |
| typedef QMultiMap< QByteArray, QVariant > | ChangeInfoMap |
Public Member Functions | |
| CScanlineMask () | |
| bool | IsBitmapRegionEmpty () const |
| Check if region is empty. | |
| i2d::CRect | GetBoundingRect () const |
| Get rectangle containing all active pixels. | |
| void | ResetScanlines (const istd::CIntRange &verticalRange) |
| Set this mask to empty set for some vertical range. | |
| const istd::CIntRanges * | GetPixelRanges (int lineIndex) const |
| Get the list of pixel ranges per given line. | |
| void | CreateFilled (const i2d::CRect &clipArea) |
| Create filled 2D-region clipped to rectangle area. | |
| bool | CreateFromGeometry (const i2d::IObject2d &geometry, const i2d::CRect *clipAreaPtr=NULL) |
| Create 2D-region from some geometrical object. | |
| void | CreateFromCircle (const i2d::CCircle &circle, const i2d::CRect *clipAreaPtr=NULL) |
| Create 2D-region from circle. | |
| void | CreateFromRectangle (const i2d::CRectangle &rect, const i2d::CRect *clipAreaPtr=NULL) |
| Create 2D-region from rectangle. | |
| void | CreateFromAnnulus (const i2d::CAnnulus &annulus, const i2d::CRect *clipAreaPtr=NULL) |
| Create 2D-region from annulus. | |
| void | CreateFromPolygon (const i2d::CPolygon &polygon, const i2d::CRect *clipAreaPtr=NULL) |
| Create 2D-region from polygon. | |
| void | CreateFromTube (const i2d::CTubePolyline &tube, const i2d::CRect *clipAreaPtr=NULL) |
| Create 2D-region from tube. | |
| void | CreateFromBitmap (const iimg::IBitmap &bitmap, const i2d::CRect *clipAreaPtr=NULL) |
| Create 2D-region from a bitmap. | |
| void | GetInverted (const i2d::CRect &clipArea, CScanlineMask &result) const |
| Get inverted mask. | |
| void | Invert (const i2d::CRect &clipArea) |
| Invert mask on place. | |
| CScanlineMask | GetUnion (const CScanlineMask &mask) const |
| Get union of two masks. | |
| void | GetUnion (const CScanlineMask &mask, CScanlineMask &result) const |
| Get union of two masks. | |
| void | Union (const CScanlineMask &mask) |
| Calculate union of this mask and the other one. | |
| CScanlineMask | GetIntersection (const CScanlineMask &mask) const |
| Get intersection of two masks. | |
| void | GetIntersection (const CScanlineMask &mask, CScanlineMask &result) const |
| Get intersection of two masks. | |
| void | Intersection (const CScanlineMask &mask) |
| Calculate intersection of this mask and the other one. | |
| CScanlineMask | GetTranslated (int dx, int dy) const |
| Calculate translated (moved) mask. | |
| void | GetTranslated (int dx, int dy, CScanlineMask &result) const |
| Calculate translated (moved) mask. | |
| void | Translate (int dx, int dy) |
| Translated (move) this mask. | |
| void | Erode (int leftValue, int rightValue, int topValue, int bottomValue) |
| Calculate erosion of this range list with rectangle structured element. | |
| void | Dilate (int leftValue, int rightValue, int topValue, int bottomValue) |
| Calculate dilatation of this range list with rectangle structured element. | |
| virtual i2d::CVector2d | GetCenter () const override |
| Returns center of this 2D-object. | |
| virtual void | MoveCenterTo (const i2d::CVector2d &position) override |
Move object to position position. | |
| virtual i2d::CRectangle | GetBoundingBox () const override |
| Get bounding box of this shape. | |
| virtual bool | IsEmpty () const override |
| Return true if this image is empty. | |
| virtual void | ResetImage () override |
| Reset this image. | |
| virtual void | ClearImage () override |
| Cleat this image. | |
| virtual istd::CIndex2d | GetImageSize () const override |
| Get size of this raster image. | |
| virtual int | GetComponentsCount () const override |
| Get number of color components. | |
| virtual icmm::CVarColor | GetColorAt (const istd::CIndex2d &position) const override |
| Get color at specified pixel. | |
| virtual bool | SetColorAt (const istd::CIndex2d &position, const icmm::CVarColor &color) override |
| Set color at specified pixel. | |
| virtual const icmm::IColorModel * | GetColorModel () const override |
| Get the color model related to the image. | |
| virtual bool | Serialize (iser::IArchive &archive) override |
| Load or store state of this object as a archive stream. | |
| virtual int | GetSupportedOperations () const override |
| Get set of flags for supported operations. | |
| virtual bool | CopyFrom (const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override |
| Copy this object from another one. | |
| virtual bool | ResetData (CompatibilityMode mode=CM_WITHOUT_REFS) override |
| Reset data to its default state. | |
| bool | operator== (const CScanlineMask &mask) const |
| bool | operator!= (const CScanlineMask &mask) const |
Public Member Functions inherited from i2d::CObject2dBase | |
| CObject2dBase () | |
| CObject2dBase (const CObject2dBase &object2d) | |
| CObject2dBase (CObject2dBase &&object2d) | |
| CObject2dBase & | operator= (const CObject2dBase &object2d) |
| CObject2dBase & | operator= (CObject2dBase &&object2d) |
| virtual const ICalibration2d * | GetCalibration () const override |
| Get access to transformation object, which transforms a local logical coordinate system to global one. | |
| virtual void | SetCalibration (const ICalibration2d *calibrationPtr, bool releaseFlag=false) override |
| Set calibration of this object. | |
| virtual bool | Transform (const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override |
| Transform this object using some transformation. | |
| virtual bool | InvTransform (const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) override |
| Do inverse transformation of this object. | |
| virtual bool | GetTransformed (const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) const override |
| Calulate transformation of the object into second one. | |
| virtual bool | GetInvTransformed (const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=NULL) const override |
| Calulate inverse transformation of the object into second one. | |
Public Member Functions inherited from iser::IObject | |
| virtual QByteArray | GetFactoryId () const |
Public Member Functions inherited from iser::ISerializable | |
| virtual quint32 | GetMinimalVersion (int versionId) const |
| Get minimal needed version to correct storing of this data. | |
Public Member Functions inherited from istd::IChangeable | |
| virtual bool | IsEqual (const IChangeable &object) const |
| Compare this object with another object. | |
| virtual istd::TUniqueInterfacePtr< istd::IChangeable > | CloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const |
| Make a copy of this object. | |
| virtual void | BeginChanges (const ChangeSet &changeSet) |
| Starts the change transaction. | |
| virtual void | EndChanges (const ChangeSet &changeSet) |
| Ends the change transaction. | |
| virtual void | BeginChangeGroup (const ChangeSet &changeSet) |
| Starts group of changes. | |
| virtual void | EndChangeGroup (const ChangeSet &changeSet) |
| Ends group of changes. | |
Public Member Functions inherited from istd::IPolymorphic | |
| virtual | ~IPolymorphic () |
Protected Member Functions | |
| void | EnsureBoundingBoxValid () const |
| void | CalcBoundingBox () const |
| void | InitFromBoundingBox (const i2d::CRectangle &objectBoundingBox, const i2d::CRect *clipAreaPtr) |
| template<typename PixelType > | |
| void | CalculateMaskFromBitmap (const iimg::IBitmap &bitmap, const i2d::CRect *clipAreaPtr=NULL) |
Protected Member Functions inherited from istd::IChangeable | |
| virtual void | OnBeginChanges () |
| Callback function for begin change event. | |
| virtual void | OnEndChanges (const ChangeSet &changeSet) |
| Callback function for end change event. | |
Friends | |
| uint | qHash (const CScanlineMask &key, uint seed) |
Additional Inherited Members | |
Static Public Member Functions inherited from istd::IChangeable | |
| static const ChangeSet & | GetNoChanges () |
| Get empty set of changes. | |
| static const ChangeSet & | GetAnyChange () |
| Get anonymous change set. | |
| static const ChangeSet & | GetAllChanges () |
| Get anonymous change set. | |
| static const ChangeSet & | GetDelegatedChanges () |
| Get delegated change set. | |
Static Protected Attributes inherited from i2d::CObject2dBase | |
| static const ChangeSet | s_objectMovedChange |
| static const ChangeSet | s_objectModifiedChange |
Representation of a 2D-region as container of bitmap line scans.
Definition at line 32 of file CScanlineMask.h.
Definition at line 37 of file CScanlineMask.h.
| typedef QList<istd::CIntRanges> iimg::CScanlineMask::RangesContainer |
Definition at line 38 of file CScanlineMask.h.
| typedef std::vector<int> iimg::CScanlineMask::Scanlines |
Definition at line 39 of file CScanlineMask.h.
| iimg::CScanlineMask::CScanlineMask | ( | ) |
|
protected |
Referenced by EnsureBoundingBoxValid().
|
protected |
Definition at line 263 of file CScanlineMask.h.
References i2d::IObject2d::GetBoundingBox(), iimg::IRasterImage::GetImageSize(), i2d::CRect::GetLeft(), iimg::IBitmap::GetLinePtr(), i2d::CRect::GetRight(), istd::CIndex2d::GetX(), istd::CIndex2d::GetY(), InitFromBoundingBox(), NULL, and ResetImage().
|
overridevirtual |
Cleat this image.
After this operation all the image pixels will be set to the default value (black by default).
Implements iimg::IRasterImage.
|
overridevirtual |
Copy this object from another one.
Default implementation in istd::IChangeable does nothing.
Reimplemented from i2d::CObject2dBase.
| void iimg::CScanlineMask::CreateFilled | ( | const i2d::CRect & | clipArea | ) |
Create filled 2D-region clipped to rectangle area.
| clipArea | clipping area. |
| void iimg::CScanlineMask::CreateFromAnnulus | ( | const i2d::CAnnulus & | annulus, |
| const i2d::CRect * | clipAreaPtr = NULL |
||
| ) |
Create 2D-region from annulus.
| annulus | annulus object. |
| clipAreaPtr | optional clipping area. |
| void iimg::CScanlineMask::CreateFromBitmap | ( | const iimg::IBitmap & | bitmap, |
| const i2d::CRect * | clipAreaPtr = NULL |
||
| ) |
Create 2D-region from a bitmap.
| bitmap | Mask bitmap. Non-zero pixels of the image represent the object in the resulting mask. |
| clipAreaPtr | optional clipping area. |
| void iimg::CScanlineMask::CreateFromCircle | ( | const i2d::CCircle & | circle, |
| const i2d::CRect * | clipAreaPtr = NULL |
||
| ) |
Create 2D-region from circle.
| circle | circle object. |
| clipAreaPtr | optional clipping area. |
| bool iimg::CScanlineMask::CreateFromGeometry | ( | const i2d::IObject2d & | geometry, |
| const i2d::CRect * | clipAreaPtr = NULL |
||
| ) |
Create 2D-region from some geometrical object.
| geometry | some geometrical object. |
| clipAreaPtr | optional clipping area. |
| void iimg::CScanlineMask::CreateFromPolygon | ( | const i2d::CPolygon & | polygon, |
| const i2d::CRect * | clipAreaPtr = NULL |
||
| ) |
Create 2D-region from polygon.
| polygon | polygon object. |
| clipAreaPtr | optional clipping area. |
| void iimg::CScanlineMask::CreateFromRectangle | ( | const i2d::CRectangle & | rect, |
| const i2d::CRect * | clipAreaPtr = NULL |
||
| ) |
Create 2D-region from rectangle.
| rect | rectangle object. |
| clipAreaPtr | optional clipping area. |
| void iimg::CScanlineMask::CreateFromTube | ( | const i2d::CTubePolyline & | tube, |
| const i2d::CRect * | clipAreaPtr = NULL |
||
| ) |
Create 2D-region from tube.
| tube | tube object. |
| clipAreaPtr | optional clipping area. |
| void iimg::CScanlineMask::Dilate | ( | int | leftValue, |
| int | rightValue, | ||
| int | topValue, | ||
| int | bottomValue | ||
| ) |
Calculate dilatation of this range list with rectangle structured element.
Result is stored in this object.
|
inlineprotected |
Definition at line 252 of file CScanlineMask.h.
References CalcBoundingBox().
| void iimg::CScanlineMask::Erode | ( | int | leftValue, |
| int | rightValue, | ||
| int | topValue, | ||
| int | bottomValue | ||
| ) |
Calculate erosion of this range list with rectangle structured element.
Result is stored in this object.
|
overridevirtual |
Get bounding box of this shape.
Please note, this bounding box is in logical units, the calibration will not be considered.
Implements i2d::IObject2d.
| i2d::CRect iimg::CScanlineMask::GetBoundingRect | ( | ) | const |
Get rectangle containing all active pixels.
If this mask is infinite, it returns i2d::CRect::GetInvalid() rectangle. Agains the method GetBoundingBox() from i2d::IObject2d it returns integer rectangle.
|
overridevirtual |
Returns center of this 2D-object.
Implements i2d::IObject2d.
|
overridevirtual |
Get color at specified pixel.
| position | pixel position, must be inside of returned size. |
Implements iimg::IRasterImage.
|
overridevirtual |
Get the color model related to the image.
Implements iimg::IRasterImage.
|
overridevirtual |
Get number of color components.
Implements iimg::IRasterImage.
|
overridevirtual |
Get size of this raster image.
Implements iimg::IRasterImage.
| CScanlineMask iimg::CScanlineMask::GetIntersection | ( | const CScanlineMask & | mask | ) | const |
Get intersection of two masks.
| void iimg::CScanlineMask::GetIntersection | ( | const CScanlineMask & | mask, |
| CScanlineMask & | result | ||
| ) | const |
Get intersection of two masks.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void iimg::CScanlineMask::GetInverted | ( | const i2d::CRect & | clipArea, |
| CScanlineMask & | result | ||
| ) | const |
Get inverted mask.
| clipArea | clipping area. |
| result | result object, will be filled with inverted mask. |
| const istd::CIntRanges * iimg::CScanlineMask::GetPixelRanges | ( | int | lineIndex | ) | const |
Get the list of pixel ranges per given line.
|
overridevirtual |
Get set of flags for supported operations.
Reimplemented from istd::IChangeable.
| CScanlineMask iimg::CScanlineMask::GetTranslated | ( | int | dx, |
| int | dy | ||
| ) | const |
Calculate translated (moved) mask.
| void iimg::CScanlineMask::GetTranslated | ( | int | dx, |
| int | dy, | ||
| CScanlineMask & | result | ||
| ) | const |
Calculate translated (moved) mask.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| CScanlineMask iimg::CScanlineMask::GetUnion | ( | const CScanlineMask & | mask | ) | const |
Get union of two masks.
| void iimg::CScanlineMask::GetUnion | ( | const CScanlineMask & | mask, |
| CScanlineMask & | result | ||
| ) | const |
Get union of two masks.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
protected |
Referenced by CalculateMaskFromBitmap().
| void iimg::CScanlineMask::Intersection | ( | const CScanlineMask & | mask | ) |
Calculate intersection of this mask and the other one.
Result is stored in this object.
| void iimg::CScanlineMask::Invert | ( | const i2d::CRect & | clipArea | ) |
Invert mask on place.
| clipArea | clipping area. |
| bool iimg::CScanlineMask::IsBitmapRegionEmpty | ( | ) | const |
Check if region is empty.
|
overridevirtual |
Return true if this image is empty.
Implements iimg::IRasterImage.
|
overridevirtual |
Move object to position position.
Implements i2d::IObject2d.
|
inline |
Definition at line 244 of file CScanlineMask.h.
References operator==().
| bool iimg::CScanlineMask::operator== | ( | const CScanlineMask & | mask | ) | const |
Referenced by operator!=().
|
overridevirtual |
Reset data to its default state.
Default implementation in istd::IChangeable does nothing.
true if the operation was successful, and false otherwise. Reimplemented from i2d::CObject2dBase.
|
overridevirtual |
Reset this image.
After this operation image is set to initial state.
Implements iimg::IRasterImage.
Referenced by CalculateMaskFromBitmap().
| void iimg::CScanlineMask::ResetScanlines | ( | const istd::CIntRange & | verticalRange | ) |
Set this mask to empty set for some vertical range.
|
overridevirtual |
Load or store state of this object as a archive stream.
Type of operation is depending on archive type.
Implements iser::ISerializable.
|
overridevirtual |
Set color at specified pixel.
| position | pixel position, must be inside of returned size. |
| color | color of pixel will be set. |
Implements iimg::IRasterImage.
| void iimg::CScanlineMask::Translate | ( | int | dx, |
| int | dy | ||
| ) |
Translated (move) this mask.
| void iimg::CScanlineMask::Union | ( | const CScanlineMask & | mask | ) |
Calculate union of this mask and the other one.
Result is stored in this object.
|
friend |