MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / createAlpha

Method createAlpha

qcustomplot.cpp:25502–25525  ·  view source on GitHub ↗

! \internal Allocates the internal alpha map with the current data map key/value size and, if \a initializeOpaque is true, initializes all values to 255. If \a initializeOpaque is false, the values are not initialized at all. In this case, the alpha map should be initialized manually, e.g. with \ref fillAlpha. If an alpha map exists already, it is deleted first. If this color map is em

Source from the content-addressed store, hash-verified

25500 true if the data map isn't empty and an alpha map was successfully allocated.
25501*/
25502bool QCPColorMapData::createAlpha(bool initializeOpaque)
25503{
25504 clearAlpha();
25505 if (isEmpty())
25506 return false;
25507
25508#ifdef __EXCEPTIONS
25509 try { // 2D arrays get memory intensive fast. So if the allocation fails, at least output debug message
25510#endif
25511 mAlpha = new unsigned char[mKeySize*mValueSize];
25512#ifdef __EXCEPTIONS
25513 } catch (...) { mAlpha = 0; }
25514#endif
25515 if (mAlpha)
25516 {
25517 if (initializeOpaque)
25518 fillAlpha(255);
25519 return true;
25520 } else
25521 {
25522 qDebug() << Q_FUNC_INFO << "out of memory for data dimensions "<< mKeySize << "*" << mValueSize;
25523 return false;
25524 }
25525}
25526
25527
25528////////////////////////////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 1

isEmptyFunction · 0.85

Tested by

no test coverage detected