![]() |
ICF 3.0.5.47
Technical documentation of ICF Libraries
|
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 |
![]() | |
enum | ChangeFlags { CF_OBJECT_POSITION = 0x6ba340 } |
![]() | |
enum | ChangeFlags { CF_ICF_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 , SO_CHANGE_LOCK = 1 << 5 } |
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... | |
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=nullptr) |
Create 2D-region from some geometrical object. | |
void | CreateFromCircle (const i2d::CCircle &circle, const i2d::CRect *clipAreaPtr=nullptr) |
Create 2D-region from circle. | |
void | CreateFromRectangle (const i2d::CRectangle &rect, const i2d::CRect *clipAreaPtr=nullptr) |
Create 2D-region from rectangle. | |
void | CreateFromAnnulus (const i2d::CAnnulus &annulus, const i2d::CRect *clipAreaPtr=nullptr) |
Create 2D-region from annulus. | |
void | CreateFromPolygon (const i2d::CPolygon &polygon, const i2d::CRect *clipAreaPtr=nullptr) |
Create 2D-region from polygon. | |
void | CreateFromTube (const i2d::CTubePolyline &tube, const i2d::CRect *clipAreaPtr=nullptr) |
Create 2D-region from tube. | |
void | CreateFromBitmap (const iimg::IBitmap &bitmap, const i2d::CRect *clipAreaPtr=nullptr) |
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. | |
i2d::CVector2d | GetCenter () const override |
Returns center of this 2D-object. | |
void | MoveCenterTo (const i2d::CVector2d &position) override |
Move object to position position . | |
i2d::CRectangle | GetBoundingBox () const override |
Get bounding box of this shape. | |
bool | IsEmpty () const override |
Return true if this image is empty. | |
void | ResetImage () override |
Reset this image. | |
void | ClearImage () override |
Cleat this image. | |
istd::CIndex2d | GetImageSize () const override |
Get size of this raster image. | |
int | GetComponentsCount () const override |
Get number of color components. | |
icmm::CVarColor | GetColorAt (const istd::CIndex2d &position) const override |
Get color at specified pixel. | |
bool | SetColorAt (const istd::CIndex2d &position, const icmm::CVarColor &color) override |
Set color at specified pixel. | |
bool | Serialize (iser::IArchive &archive) override |
Load or store state of this object as a archive stream. | |
int | GetSupportedOperations () const override |
Get set of flags for supported operations. | |
bool | CopyFrom (const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override |
Copy this object from another one. | |
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 |
![]() | |
CObject2dBase () | |
CObject2dBase (const CObject2dBase &object2d) | |
CObject2dBase (CObject2dBase &&object2d) | |
const ICalibration2d * | GetCalibration () const override |
Get access to transformation object, which transforms a local logical coordinate system to global one. | |
void | SetCalibration (istd::TOptDelPtr< const ICalibration2d > &&calibrationPtr) override |
Set calibration of this object. | |
bool | Transform (const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override |
Transform this object using some transformation. | |
bool | InvTransform (const ITransformation2d &transformation, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) override |
Do inverse transformation of this object. | |
bool | GetTransformed (const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override |
Calulate transformation of the object into second one. | |
bool | GetInvTransformed (const ITransformation2d &transformation, IObject2d &result, ITransformation2d::ExactnessMode mode=ITransformation2d::EM_NONE, double *errorFactorPtr=nullptr) const override |
Calulate inverse transformation of the object into second one. | |
CObject2dBase & | operator= (const CObject2dBase &object2d) |
CObject2dBase & | operator= (CObject2dBase &&object2d) |
![]() | |
![]() | |
virtual QByteArray | GetFactoryId () const |
![]() | |
virtual quint32 | GetMinimalVersion (int versionId) const |
Get minimal needed version to correct storing of this data. | |
![]() | |
virtual bool | IsEqual (const IChangeable &object) const |
Compare this object with another object. | |
virtual std::unique_ptr< IChangeable > | CloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const |
Make a copy of this object. | |
virtual QMutex * | GetChangesLock () const |
Get mutex beeing locked during changes, if available. | |
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. | |
![]() | |
![]() |
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=nullptr) |
![]() | |
virtual void | OnBeginChanges () |
Callback function for begin change event. | |
virtual void | OnEndChanges (const ChangeSet &changeSet) |
Callback function for end change event. | |
Additional Inherited Members | |
![]() | |
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 const ChangeSet | s_objectMovedChange |
static const ChangeSet | s_objectModifiedChange |
Representation of a 2D-region as container of bitmap line scans.
Definition at line 34 of file CScanlineMask.h.
Definition at line 39 of file CScanlineMask.h.
Definition at line 40 of file CScanlineMask.h.
std::vector<int> iimg::CScanlineMask::Scanlines |
Definition at line 41 of file CScanlineMask.h.
iimg::CScanlineMask::CScanlineMask | ( | ) |
|
protected |
Referenced by EnsureBoundingBoxValid().
|
protected |
Definition at line 264 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(), istd::TRanges< ValueType >::InsertSwitchPoint(), istd::TRanges< ValueType >::IsEmpty(), 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. You may check, if this functionality is supported over GetSupportedOperations()
.
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 = nullptr ) |
Create 2D-region from annulus.
annulus | annulus object. |
clipAreaPtr | optional clipping area. |
void iimg::CScanlineMask::CreateFromBitmap | ( | const iimg::IBitmap & | bitmap, |
const i2d::CRect * | clipAreaPtr = nullptr ) |
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 = nullptr ) |
Create 2D-region from circle.
circle | circle object. |
clipAreaPtr | optional clipping area. |
bool iimg::CScanlineMask::CreateFromGeometry | ( | const i2d::IObject2d & | geometry, |
const i2d::CRect * | clipAreaPtr = nullptr ) |
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 = nullptr ) |
Create 2D-region from polygon.
polygon | polygon object. |
clipAreaPtr | optional clipping area. |
void iimg::CScanlineMask::CreateFromRectangle | ( | const i2d::CRectangle & | rect, |
const i2d::CRect * | clipAreaPtr = nullptr ) |
Create 2D-region from rectangle.
rect | rectangle object. |
clipAreaPtr | optional clipping area. |
void iimg::CScanlineMask::CreateFromTube | ( | const i2d::CTubePolyline & | tube, |
const i2d::CRect * | clipAreaPtr = nullptr ) |
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 253 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 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 245 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. You may check, if this functionality is supported over GetSupportedOperations()
.
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.
© Witold Gantzke and Kirill Lepskiy