Workspace 6.21.5
Public Types | Public Member Functions | List of all members
ImageOverlay Class Reference

Class for specifying an image and its overlay location. More...

#include <DataAnalysis/Image/imageoverlay.h>

Inheritance diagram for ImageOverlay:
[legend]

Public Types

enum  Anchor {
  TopLeft , TopCenter , TopRight , CenterLeft ,
  Center , CenterRight , BottomLeft , BottomCenter ,
  BottomRight , Tiled
}
 

Public Member Functions

 ImageOverlay ()
 
 ImageOverlay (const ImageOverlay &overlay)
 
 ~ImageOverlay () override
 
ImageOverlayclone () const override
 
Anchor getAnchor () const
 
const QImagegetImage () const
 
int getOffsetX () const
 
int getOffsetY () const
 
double getOpacity () const
 
QPoint getPlacement (int width, int height) const
 
ImageOverlayoperator= (const ImageOverlay &overlay)
 
void setAnchor (Anchor anchor)
 
void setImage (const QImage &image)
 
void setOffsetX (int x)
 
void setOffsetY (int y)
 
void setOpacity (double opacity)
 
- Public Member Functions inherited from ObjectGroup
 ~ObjectGroup () override
 
bool add (const QString &name, DataObject &obj)
 
bool canSerialize () const override
 
ObjectGroupclone () const override=0
 
bool empty () const
 
void ensureGroupHasData ()
 
void erase (int index)
 
DataObjectgetChild (const QString &name)
 
const DataObjectgetChild (const QString &name) const
 
DataObjectgetDataObject (int index)
 
const DataObjectgetDataObject (int index) const
 
int getIndex (const QString &name) const
 
const QString & getName (int index) const
 
virtual QString getPreferedWidget (const QString &name) const
 
bool hasData () const
 
bool haveName (const QString &name) const
 
bool insert (const QString &name, DataObject &obj, int index=-1)
 
bool load (const QJsonDocument &doc)
 
bool load (const SerializedItem &item) override
 
bool save (QJsonDocument &doc) const
 
bool save (SerializedItem &item) const override
 
unsigned size () const
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 
- Public Member Functions inherited from Serialize
virtual ~Serialize ()=default
 
virtual bool canSerialize () const =0
 
virtual bool load (const SerializedItem &item)=0
 
virtual bool save (SerializedItem &item) const =0
 

Additional Inherited Members

- Protected Member Functions inherited from ObjectGroup
 ObjectGroup ()
 
void clear ()
 
ObjectGroupoperator= (const ObjectGroup &rhs)
 
bool operator== (const ObjectGroup &rhs) const
 
void swap (ObjectGroup &rhs)
 

Detailed Description

The overlay location of the image is specified as an offset from an anchor point rather than as an absolute co-ordinate. This allows the image to be placed intelligently without necessarily knowing the dimensions of the image it will eventually be overlaid upon. A particularly useful use of this class is to overlay a color scale image onto an image of a rendered 3D model.

An image overlay also has an opacity parameter. An opacity of 0 will result in the image being hidden altogether, whereas an opacity of 1.0 will make the image fully opaque (transparent regions of the image will still be transparent though). Values in between will result in the image being blended with the base image. You can think of the opacity as a multiplier on the image's own alpha channel.

Member Enumeration Documentation

◆ Anchor

enum Anchor

Specifies how the image location X and Y co-ordinates are interpretted and where the (0,0) location of the image corresponds to. For example, an image anchored at BottomCenter will have the (0,0) locate at the mid-point along the bottom the image. If y is zero, the image will sit flush with the bottom of whatever it is overlaid onto. As y is increased, the image will move up. The x offset is ignored for this particular example because it must be centered and the x offset would de-center it.

The reason for the various different interpretations of the offset is so that the anchor point can be changed but the offset left the same and the image location will essentially self-adjust in a consistent way.

Enumerator
TopLeft 

(0,0) at top-left of image, translated by x (positive right) and y (positive down).

TopCenter 

(0,0) at top-center of image, translated by y only (positive down). X offset is ignored.

TopRight 

(0,0) at top-right of image, translated by x (positive left) and y (positive down).

CenterLeft 

(0,0) at center-left of image, translated by x only (positive right). Y offset is ignored.

Center 

(0,0) at center of image. Both x and y offsets are ignored.

CenterRight 

(0,0) at center-right of image, translated by x only (positive left). Y offset is ignored.

BottomLeft 

(0,0) at bottom-left of image, translated by x (positive right) and y (positive up).

BottomCenter 

(0,0) at bottom-center of image, translated by y only (positive up). X offset is ignored.

BottomRight 

(0,0) at bottom-right of image, translated by x (positive left) and y (positive up).

Tiled 

Like TopLeft except the image is repeated in x and y as needed to cover the base image.

Constructor & Destructor Documentation

◆ ImageOverlay() [1/2]

◆ ImageOverlay() [2/2]

ImageOverlay ( const ImageOverlay overlay)

◆ ~ImageOverlay()

~ImageOverlay ( )
override

Member Function Documentation

◆ clone()

ImageOverlay * clone ( ) const
overridevirtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

We redeclare this function only so that the more derived return type is available without casting.

Implements ObjectGroup.

Reimplemented in SceneOverlay.

◆ getAnchor()

ImageOverlay::Anchor getAnchor ( ) const

◆ getImage()

const QImage & getImage ( ) const

◆ getOffsetX()

int getOffsetX ( ) const

◆ getOffsetY()

int getOffsetY ( ) const

◆ getOpacity()

double getOpacity ( ) const

◆ getPlacement()

QPoint getPlacement ( int  width,
int  height 
) const
Parameters
widthThe width of the base image.
heightThe height of the base image.
Returns
The (X,Y) co-ordinates of the image overlay over a base image of the specified width and height.

For the special case of the anchor point being Tiled, the return value is calculated as the minimum x and y values of the tile in the upper-left corner. These x and y values will always be zero or negative.

◆ operator=()

ImageOverlay & operator= ( const ImageOverlay overlay)

◆ setAnchor()

void setAnchor ( Anchor  anchor)

◆ setImage()

void setImage ( const QImage image)

◆ setOffsetX()

void setOffsetX ( int  x)

◆ setOffsetY()

void setOffsetY ( int  y)

◆ setOpacity()

void setOpacity ( double  opacity)