BitMask Class Reference

Mask for selecting indiviual pixel locations. More...

#include <BitMask.h>

Inheritance diagram for BitMask:

Inheritance graph

List of all members.

Public Member Functions

virtual void clear ()=0
virtual void merge (const BitMask &rhs)=0
virtual void intersect (const BitMask &rhs)=0
virtual bool compare (const BitMask &rhs) const =0
virtual void invert ()=0
virtual bool isSubsetOf (const BitMask &source) const =0
virtual void setPixel (int x, int y, bool value)=0
virtual bool getPixel (int x, int y) const =0
virtual void getBoundingBox (int &x1, int &y1, int &x2, int &y2) const =0
virtual bool isOutsideSelected () const =0
virtual int getCount () const =0
virtual const bool ** getRegion (int x1, int y1, int x2, int y2)=0
virtual unsigned int getPixels (int x, int y) const =0
virtual void setPixels (int x, int y, unsigned int values)=0
virtual void setRegion (int x1, int y1, int x2, int y2, ModeType op)=0
virtual void toggle (const BitMask &rhs)=0
virtual void getMinimalBoundingBox (int &x1, int &y1, int &x2, int &y2) const =0

Protected Member Functions

virtual ~BitMask ()


Detailed Description

Mask for selecting indiviual pixel locations.

The BitMask class provides a means of selecting individual pixels within a scene. A pixel coordinate is marked as either 'on' or 'off'. The bounding box contains the outer most coordinates of selected pixels. The BitMask is underlying part of an AOI to represent selected pixel locations in a scene.

See also:
AOI
Examples:

Tutorial/Tutorial4.cpp.

Definition at line 26 of file BitMask.h.


Constructor & Destructor Documentation

virtual BitMask::~BitMask (  )  [protected, virtual]

This should be destroyed by calling ObjectFactory::destroyObject.

Definition at line 261 of file BitMask.h.


Member Function Documentation

virtual void BitMask::clear (  )  [pure virtual]

clear member function.

Re-initializes a bitmask to have no bits set

virtual void BitMask::merge ( const BitMask rhs  )  [pure virtual]

In-place bitwise 'OR' operator.

Merges two BitMasks. Upon return, the bitmask 'OR'ed with the parameter bitmask will have all bits set that it had originally, plus all that are set in the parameter bitmask. This can be looked at as the union of the two masks.

Parameters:
rhs "Right Hand Side". The mask to merge from.

virtual void BitMask::intersect ( const BitMask rhs  )  [pure virtual]

In-place bitwise 'AND' operator.

Merges two BitMasks. Upon return, the bitmask 'AND'ed with the parameter bitmask will have all bits set that were originally set in both it and the parameter bitmask. This can be looked at as the intersection of the two masks.

Parameters:
rhs "Right Hand Side". The mask to merge from.

virtual bool BitMask::compare ( const BitMask rhs  )  const [pure virtual]

Equivalence operator.

Compares two bitmasks.

Parameters:
rhs "Right Hand Side". The mask to compare with.
Returns:
true if the two masks are identical in content ` false otherwise

virtual void BitMask::invert (  )  [pure virtual]

Mask inversion method.

Inverts all bits in the mask. All 1's become 0's and all 0's become 1's. It uses the ~ operator internally to perform the inversion operation

virtual bool BitMask::isSubsetOf ( const BitMask source  )  const [pure virtual]

Subset comparison method.

Compares two bitmasks.

Parameters:
source The mask to compare with.
Returns:
true if all bits set in the left-hand-side mask are also set in the parameter mask. Ensures that ~lhs | source == 1 for all bits in the masks. false otherwise.

virtual void BitMask::setPixel ( int  x,
int  y,
bool  value 
) [pure virtual]

setPixel method.

Sets a specified bit on or off.

Parameters:
x The column of the pixel to set.
y The row of the pixel to set.
value A flag indicating whether or not to set pixel to 1 or not. True means set the pixel to 1, false means set to 0.

virtual bool BitMask::getPixel ( int  x,
int  y 
) const [pure virtual]

getPixel method.

Gets a specified bit.

Parameters:
x The column of the pixel to get.
y The row of the pixel to get.
Returns:
the value of the pixel specified
Examples:
Tutorial/Tutorial4.cpp.

virtual void BitMask::getBoundingBox ( int &  x1,
int &  y1,
int &  x2,
int &  y2 
) const [pure virtual]

getBoundingBox method.

Gets the bounding box of set pixels in the bitmap. If no pixels are set in the bitmap, it sets the values to (0,0);(0,0).

Parameters:
x1 The column of the lower-left corner.
y1 The row of the lower-left corner.
x2 The column of the upper-right corner.
y2 The row of the upper-right corner.

virtual bool BitMask::isOutsideSelected (  )  const [pure virtual]

Access the state of points outside the bounding box.

Returns:
If this is true, than all points outside of the bounding box are selected. If this is false, that all points outside of the bounding box are not selected.
See also:
getBoundingBox(), getPixel()
Examples:
Tutorial/Tutorial4.cpp.

virtual int BitMask::getCount (  )  const [pure virtual]

getCount method.

Gets the number of bits that are set in the mask.

Returns:
the number of bits that are set in the mask

virtual const bool** BitMask::getRegion ( int  x1,
int  y1,
int  x2,
int  y2 
) [pure virtual]

getRegion method.

Gets all of the bits in a rectangular region. They are returned as a 2D array of bools. This array is owned by the BitMask and should not be modified or deleted. The array will remain unchanged until the next call to getRegion.

Parameters:
x1,y1 The coordinate of the lower-left corner of the region to get
x2,y2 The coordinate of the upper-right corner of the region to get
Returns:
a 2D array of bools representing the region specified

virtual unsigned int BitMask::getPixels ( int  x,
int  y 
) const [pure virtual]

GetPixels method.

Gets pixels 32 at a time.

Parameters:
x The column of the pixels to get. Must be a multiple of 32.
y The row of the starting pixel.
Returns:
the 32 bits specified, packed into an unsigned int

virtual void BitMask::setPixels ( int  x,
int  y,
unsigned int  values 
) [pure virtual]

SetPixels method.

Sets pixels 32 at a time.

Parameters:
x The column of the pixels to set. Must be a multiple of 32.
y The row of the starting pixel.
values An unsigned int containing the states for 32 bits, packed into an unsigned int

virtual void BitMask::setRegion ( int  x1,
int  y1,
int  x2,
int  y2,
ModeType  op 
) [pure virtual]

Changes a region of a bitmask.

If op is DRAW, if fills the region. If op is ERASE, it clears the region. If op is TOGGLE, it toggles all pixels in the region.

Parameters:
x1 The lower left x-coordinate of the region to change.
y1 The lower left y-coordinate of the region to change.
x2 The upper right x-coordinate of the region to change
y2 The upper right y-coordinate of the region to change
op The drawing mode

virtual void BitMask::toggle ( const BitMask rhs  )  [pure virtual]

Merges two BitMasks.

In-place bitwise 'XOR' operator.

Parameters:
rhs "Right Hand Side". The mask to merge from.

virtual void BitMask::getMinimalBoundingBox ( int &  x1,
int &  y1,
int &  x2,
int &  y2 
) const [pure virtual]

Gets the actual bounding box of set pixels in the bitmap.

If points have been removed from the BitMask, BitMask::getBoundingBox() may not be the minimum box needed to enclose the pixels. This method will always be the minimum. If no pixels are set in the bitmap, it sets the values to (0,0);(0,0).

Parameters:
x1 The column of the lower-left corner.
y1 The row of the lower-left corner.
x2 The column of the upper-right corner.
y2 The row of the upper-right corner.
Examples:
Tutorial/Tutorial4.cpp.


Software Development Kit - Opticks 4.9.0 Build 16218