OpenEnroth 631fe01
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
HitMap< T > Class Template Reference

#include <HitMap.h>

Classes

struct  Entry
 

Public Member Functions

void add (Pointi position, GraphicsImage *image, T value)
 
void clear ()
 
query (Pointi point, T defaultValue={}) const
 

Private Attributes

std::vector< Entry_entries
 
Recti _bounds
 

Detailed Description

template<class T>
class HitMap< T >

A canvas-like container that allows adding images with associated values, then querying pixels to get the value of the topmost non-transparent image at that position.

Template Parameters
TThe type of values associated with images.

Member Function Documentation

◆ add()

template<class T >
void HitMap< T >::add ( Pointi  position,
GraphicsImage image,
value 
)
inline

Add an image with associated value to the canvas.

Parameters
positionTop-left position where the image should be placed.
imagePointer to the graphics image.
valueValue to associate with this image.

◆ clear()

template<class T >
void HitMap< T >::clear ( )
inline

Clear all images from the canvas.

◆ query()

template<class T >
T HitMap< T >::query ( Pointi  point,
defaultValue = {} 
) const
inline

Query a pixel position to get the value from the topmost non-transparent image.

Parameters
pointPosition to query.
defaultValueValue to return if no non-transparent image is found at the position.
Returns
Value associated with the topmost non-transparent image at the given position, or defaultValue if no such image exists.

Member Data Documentation

◆ _bounds

template<class T >
Recti HitMap< T >::_bounds
private

◆ _entries

template<class T >
std::vector<Entry> HitMap< T >::_entries
private

The documentation for this class was generated from the following file: