|
AGXDynamics
2.31.1.0
|
#include <ImageValueInterpreter.h>
Inheritance diagram for agxIO::PNGImageValueInterpreter:Public Member Functions | |
| PNGImageValueInterpreter () | |
| Default constructor. More... | |
| PNGImageValueInterpreter (float minValue, float maxValue) | |
| Construct given minimum- and maximum value. More... | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| agxIO::Image * | getImage () const |
| size_t | getImageHeight () const |
| size_t | getImageWidth () const |
| float | getMaxValue () const |
| float | getMinValue () const |
| int | getReferenceCount () const |
| float | getValue (size_t x, size_t y, GetValueFunction func=linearValueFunction) const |
| Reads image at pixel (x,y) and returns value between given minimum and maximum. More... | |
| float | getValueA (size_t x, size_t y, GetValueFunction func=linearValueFunction) const |
| Reads single "Alpha" channel at pixel (x,y) and returns value between given minimum and maximum. More... | |
| float | getValueB (size_t x, size_t y, GetValueFunction func=linearValueFunction) const |
| Reads single "Blue" channel at pixel (x,y) and returns value between given minimum and maximum. More... | |
| float | getValueG (size_t x, size_t y, GetValueFunction func=linearValueFunction) const |
| Reads single "Green" channel at pixel (x,y) and returns value between given minimum and maximum. More... | |
| float | getValueR (size_t x, size_t y, GetValueFunction func=linearValueFunction) const |
| Reads single "Red" channel at pixel (x,y) and returns value between given minimum and maximum. More... | |
| agx::Vec3f | getValueRGB (size_t x, size_t y, GetValueFunction func=linearValueFunction) const |
| Reads R, G, and B channels and returns Vec3f with result at pixel (x,y). More... | |
| agx::Vec4f | getValueRGBA (size_t x, size_t y, GetValueFunction func=linearValueFunction) const |
| Reads R, G, B and A channels and returns Vec4f with result at pixel (x,y). More... | |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| bool | read (const std::string &filename) |
| Read PNG image. More... | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| void | setMaxValue (float maxValue) |
| Set new maximum value for the accessors methods (i.e., channel value = 255 => maximum value). More... | |
| void | setMinValue (float minValue) |
| Set new minimum value for the accessors methods (i.e., channel value = 0 => minimum value). More... | |
| void | setValueA (unsigned char val, size_t x, size_t y) |
| Set current value to the "Alpha" channel. More... | |
| void | setValueB (unsigned char val, size_t x, size_t y) |
| Set current value to the "Blue" channel. More... | |
| void | setValueG (unsigned char val, size_t x, size_t y) |
| Set current value to the "Green" channel. More... | |
| void | setValueR (unsigned char val, size_t x, size_t y) |
| Set current value to the "Red" channel. More... | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| bool | valid () const |
Static Public Member Functions | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| virtual | ~PNGImageValueInterpreter () |
| Reference counted object. More... | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Static Protected Member Functions | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes | |
| agxIO::ImageRef | m_image |
| float | m_maxValue |
| float | m_minValue |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| ReadValue01Function | m_readFunction |
| AtomicValue | m_refCount |
Definition at line 82 of file ImageValueInterpreter.h.
| agxIO::PNGImageValueInterpreter::PNGImageValueInterpreter | ( | ) |
Default constructor.
Minimum value set to 0 and maximum value to 1.
| agxIO::PNGImageValueInterpreter::PNGImageValueInterpreter | ( | float | minValue, |
| float | maxValue | ||
| ) |
Construct given minimum- and maximum value.
| minValue | - minimum value when image channel value is zero |
| maxValue | - maximum value when image channel value is 255 |
|
protectedvirtual |
Reference counted object.
Protected destructor.
|
protectedinherited |
|
inherited |
Subclass casting.
Template type must match actual type, dynamic_cast assertion will fail otherwise.
Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
|
protectedinherited |
|
staticprotectedinherited |
| agxIO::Image* agxIO::PNGImageValueInterpreter::getImage | ( | ) | const |
| size_t agxIO::PNGImageValueInterpreter::getImageHeight | ( | ) | const |
| size_t agxIO::PNGImageValueInterpreter::getImageWidth | ( | ) | const |
| float agxIO::PNGImageValueInterpreter::getMaxValue | ( | ) | const |
| float agxIO::PNGImageValueInterpreter::getMinValue | ( | ) | const |
|
inherited |
| float agxIO::PNGImageValueInterpreter::getValue | ( | size_t | x, |
| size_t | y, | ||
| GetValueFunction | func = linearValueFunction |
||
| ) | const |
Reads image at pixel (x,y) and returns value between given minimum and maximum.
Alpha channel is ignored for any PNG with alpha (i.e., 2 or 4). For 3 and 4 channels the RGB channels are merged to a gray scale single value and passed to GetValueFunction func.
| x | - pixel at column x |
| y | - pixel at row y |
| func | - function taking a value from 0 to 1 following a given mathematical function (e.g., linear, quadratic, cubic etc) |
| float agxIO::PNGImageValueInterpreter::getValueA | ( | size_t | x, |
| size_t | y, | ||
| GetValueFunction | func = linearValueFunction |
||
| ) | const |
Reads single "Alpha" channel at pixel (x,y) and returns value between given minimum and maximum.
The PNG has to have either two or four channels for the value to be valid. E.g., if three channels, value of G will be calculated (offset = numChannels - 1). Asserts if number of channels is 1 or 3, but make sure you have the correct number of channels when calling this method.
| x | - pixel at column x |
| y | - pixel at row y |
| func | - function taking a value from 0 to 1 following a given mathematical function (e.g., linear, quadratic, cubic etc) |
| float agxIO::PNGImageValueInterpreter::getValueB | ( | size_t | x, |
| size_t | y, | ||
| GetValueFunction | func = linearValueFunction |
||
| ) | const |
Reads single "Blue" channel at pixel (x,y) and returns value between given minimum and maximum.
The PNG has to have at least three channels for valid calls to this method.
| x | - pixel at column x |
| y | - pixel at row y |
| func | - function taking a value from 0 to 1 following a given mathematical function (e.g., linear, quadratic, cubic etc) |
| float agxIO::PNGImageValueInterpreter::getValueG | ( | size_t | x, |
| size_t | y, | ||
| GetValueFunction | func = linearValueFunction |
||
| ) | const |
Reads single "Green" channel at pixel (x,y) and returns value between given minimum and maximum.
If the PNG has two channels, the alpha channel will be used here (i.e., same result as calling getValueA).
| x | - pixel at column x |
| y | - pixel at row y |
| func | - function taking a value from 0 to 1 following a given mathematical function (e.g., linear, quadratic, cubic etc) |
| float agxIO::PNGImageValueInterpreter::getValueR | ( | size_t | x, |
| size_t | y, | ||
| GetValueFunction | func = linearValueFunction |
||
| ) | const |
Reads single "Red" channel at pixel (x,y) and returns value between given minimum and maximum.
| x | - pixel at column x |
| y | - pixel at row y |
| func | - function taking a value from 0 to 1 following a given mathematical function (e.g., linear, quadratic, cubic etc) |
| agx::Vec3f agxIO::PNGImageValueInterpreter::getValueRGB | ( | size_t | x, |
| size_t | y, | ||
| GetValueFunction | func = linearValueFunction |
||
| ) | const |
Reads R, G, and B channels and returns Vec3f with result at pixel (x,y).
| x | - pixel at column x |
| y | - pixel at row y |
| func | - function taking a value from 0 to 1 following a given mathematical function (e.g., linear, quadratic, cubic etc) |
| agx::Vec4f agxIO::PNGImageValueInterpreter::getValueRGBA | ( | size_t | x, |
| size_t | y, | ||
| GetValueFunction | func = linearValueFunction |
||
| ) | const |
Reads R, G, B and A channels and returns Vec4f with result at pixel (x,y).
I.e., the PNG has to have four channels for the values to be valid.
| x | - pixel at column x |
| y | - pixel at row y |
| func | - function taking a value from 0 to 1 following a given mathematical function (e.g., linear, quadratic, cubic etc) |
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::EntityStorage::getInstances(), and agx::Object::getResource().
| bool agxIO::PNGImageValueInterpreter::read | ( | const std::string & | filename | ) |
Read PNG image.
Searches agx paths.
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
This method should be used with care, always balanced with the same number of calls to unreference.
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
| void agxIO::PNGImageValueInterpreter::setMaxValue | ( | float | maxValue | ) |
Set new maximum value for the accessors methods (i.e., channel value = 255 => maximum value).
| maxValue | - maximum value |
| void agxIO::PNGImageValueInterpreter::setMinValue | ( | float | minValue | ) |
Set new minimum value for the accessors methods (i.e., channel value = 0 => minimum value).
| minValue | - minimum value |
| void agxIO::PNGImageValueInterpreter::setValueA | ( | unsigned char | val, |
| size_t | x, | ||
| size_t | y | ||
| ) |
Set current value to the "Alpha" channel.
| void agxIO::PNGImageValueInterpreter::setValueB | ( | unsigned char | val, |
| size_t | x, | ||
| size_t | y | ||
| ) |
Set current value to the "Blue" channel.
| void agxIO::PNGImageValueInterpreter::setValueG | ( | unsigned char | val, |
| size_t | x, | ||
| size_t | y | ||
| ) |
Set current value to the "Green" channel.
| void agxIO::PNGImageValueInterpreter::setValueR | ( | unsigned char | val, |
| size_t | x, | ||
| size_t | y | ||
| ) |
Set current value to the "Red" channel.
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
This method should be used with care, always balanced with the same number of calls to reference.
Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().
|
inherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.
| bool agxIO::PNGImageValueInterpreter::valid | ( | ) | const |
|
staticinherited |
|
protected |
Definition at line 246 of file ImageValueInterpreter.h.
|
protected |
Definition at line 248 of file ImageValueInterpreter.h.
|
protected |
Definition at line 247 of file ImageValueInterpreter.h.
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
protected |
Definition at line 249 of file ImageValueInterpreter.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.