186 void Erode(
int leftValue,
int rightValue,
int topValue,
int bottomValue);
192 void Dilate(
int leftValue,
int rightValue,
int topValue,
int bottomValue);
227 template <
typename PixelType>
238 mutable bool m_isBoundingBoxValid;
254 if (!m_isBoundingBoxValid){
262template <
typename PixelType>
267 int linesCount = int(m_scanlines.size());
268 if (linesCount <= 0){
274#if QT_VERSION >= 0x040700
275 m_rangesContainer.reserve(linesCount);
282 for (
int lineIndex = 0; lineIndex < linesCount; lineIndex++){
285 PixelType* imageLinePtr = (PixelType*)bitmap.
GetLinePtr(lineIndex);
286 Q_ASSERT(imageLinePtr !=
NULL);
291 for (
int x = 0; x < imageWidth; ++x){
292 PixelType pixel = *(imageLinePtr + x);
293 if ((pixel > 0) && (left < 0)){
297 if ((pixel == 0) && (left >= 0)){
299 if (clipAreaPtr !=
NULL){
300 if (left < clipAreaPtr->GetLeft()){
304 if (right > clipAreaPtr->
GetRight()){
310 rangeList.InsertSwitchPoint(left);
311 rangeList.InsertSwitchPoint(right);
319 if ((left >= 0) && (right < 0)){
320 rangeList.InsertSwitchPoint(left);
323 if (!rangeList.IsEmpty()){
324 m_rangesContainer.push_back(rangeList);
326 m_scanlines[lineIndex] = m_rangesContainer.size() - 1;
329 m_scanlines[lineIndex] = -1;
Definition of graphical annulus object.
Definition of graphical circle object.
Base class for 2D-objects implementing interface i2d::IObject2d.
Definition of the data model for a polygon.
Simple rectangle with integer bounds.
Definition of rectangle area orthogonal to axis of coordination system.
Definition of tube region based on polyline.
Definition of position or mathematical vector on 2D plane.
Common interface for describing the 2D-objects.
virtual CRectangle GetBoundingBox() const =0
Get bounding box of this shape.
Generic color implementation with variable number of color components.
Common interface for color model definitions in the ACF color management system.
Representation of a 2D-region as container of bitmap line scans.
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 icmm::CVarColor GetColorAt(const istd::CIndex2d &position) const override
Get color at specified pixel.
void CreateFromAnnulus(const i2d::CAnnulus &annulus, const i2d::CRect *clipAreaPtr=NULL)
Create 2D-region from annulus.
virtual bool IsEmpty() const override
Return true if this image is empty.
void GetTranslated(int dx, int dy, CScanlineMask &result) const
Calculate translated (moved) mask.
void GetUnion(const CScanlineMask &mask, CScanlineMask &result) const
Get union of two masks.
std::vector< int > Scanlines
virtual i2d::CVector2d GetCenter() const override
Returns center of this 2D-object.
CScanlineMask GetUnion(const CScanlineMask &mask) const
Get union of two masks.
void ResetScanlines(const istd::CIntRange &verticalRange)
Set this mask to empty set for some vertical range.
i2d::CObject2dBase BaseClass
void CalcBoundingBox() const
i2d::CRect GetBoundingRect() const
Get rectangle containing all active pixels.
virtual void ResetImage() override
Reset this image.
virtual bool CopyFrom(const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
Copy this object from another one.
void Dilate(int leftValue, int rightValue, int topValue, int bottomValue)
Calculate dilatation of this range list with rectangle structured element.
virtual bool ResetData(CompatibilityMode mode=CM_WITHOUT_REFS) override
Reset data to its default state.
void GetIntersection(const CScanlineMask &mask, CScanlineMask &result) const
Get intersection of two masks.
void CreateFromBitmap(const iimg::IBitmap &bitmap, const i2d::CRect *clipAreaPtr=NULL)
Create 2D-region from a bitmap.
virtual istd::CIndex2d GetImageSize() const override
Get size of this raster image.
QList< istd::CIntRanges > RangesContainer
virtual int GetComponentsCount() const override
Get number of color components.
bool CreateFromGeometry(const i2d::IObject2d &geometry, const i2d::CRect *clipAreaPtr=NULL)
Create 2D-region from some geometrical object.
bool operator==(const CScanlineMask &mask) const
void Erode(int leftValue, int rightValue, int topValue, int bottomValue)
Calculate erosion of this range list with rectangle structured element.
void CreateFromPolygon(const i2d::CPolygon &polygon, const i2d::CRect *clipAreaPtr=NULL)
Create 2D-region from polygon.
bool IsBitmapRegionEmpty() const
Check if region is empty.
const istd::CIntRanges * GetPixelRanges(int lineIndex) const
Get the list of pixel ranges per given line.
friend uint qHash(const CScanlineMask &key, uint seed)
void Union(const CScanlineMask &mask)
Calculate union of this mask and the other one.
void CreateFromCircle(const i2d::CCircle &circle, const i2d::CRect *clipAreaPtr=NULL)
Create 2D-region from circle.
CScanlineMask GetTranslated(int dx, int dy) const
Calculate translated (moved) mask.
void CalculateMaskFromBitmap(const iimg::IBitmap &bitmap, const i2d::CRect *clipAreaPtr=NULL)
void CreateFilled(const i2d::CRect &clipArea)
Create filled 2D-region clipped to rectangle area.
void Intersection(const CScanlineMask &mask)
Calculate intersection of this mask and the other one.
void GetInverted(const i2d::CRect &clipArea, CScanlineMask &result) const
Get inverted mask.
virtual int GetSupportedOperations() const override
Get set of flags for supported operations.
bool operator!=(const CScanlineMask &mask) const
virtual void MoveCenterTo(const i2d::CVector2d &position) override
Move object to position position.
void EnsureBoundingBoxValid() const
void InitFromBoundingBox(const i2d::CRectangle &objectBoundingBox, const i2d::CRect *clipAreaPtr)
CScanlineMask GetIntersection(const CScanlineMask &mask) const
Get intersection of two masks.
void CreateFromRectangle(const i2d::CRectangle &rect, const i2d::CRect *clipAreaPtr=NULL)
Create 2D-region from rectangle.
void Translate(int dx, int dy)
Translated (move) this mask.
virtual i2d::CRectangle GetBoundingBox() const override
Get bounding box of this shape.
void Invert(const i2d::CRect &clipArea)
Invert mask on place.
virtual void ClearImage() override
Cleat this image.
virtual bool SetColorAt(const istd::CIndex2d &position, const icmm::CVarColor &color) override
Set color at specified pixel.
void CreateFromTube(const i2d::CTubePolyline &tube, const i2d::CRect *clipAreaPtr=NULL)
Create 2D-region from tube.
Definition of single plane bitmap.
virtual const void * GetLinePtr(int positionY) const =0
Get pointer to buffer for single line.
General definition of image contains pixels in regular grid.
virtual istd::CIndex2d GetImageSize() const =0
Get size of this raster image.
Represents an input/output persistence archive for object serialization.
Index implementation for addressing elements in 2D-space.
Common interface for data model objects, which can be changed.
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Contains the system indenendent definitions of image and related themes.
uint qHash(const CScanlineMask &key, uint seed=0)
TRanges< int > CIntRanges