COPASI API  4.16.103
Functions
CQEffectDescription.cpp File Reference
#include <QtGui/QGraphicsItem>
#include <QtGui/QGraphicsEffect>
#include <qlayout/CQEffectDescription.h>
#include <qlayout/CQCopasiEffect.h>
Include dependency graph for CQEffectDescription.cpp:

Go to the source code of this file.

Functions

QColor interpolate (const QColor &a, const QColor &b, float t)
 
qreal linear (qreal a, qreal b, qreal t)
 

Function Documentation

QColor interpolate ( const QColor &  a,
const QColor &  b,
float  t 
)

Interpolate between a, and b

0.0 <= t <= 1.0

Definition at line 22 of file CQEffectDescription.cpp.

References linear().

Referenced by CQEffectDescription::applyToScene().

23 {
24  int ah, as, av, aa;
25  a.getHsv(&ah, &as, &av, &aa);
26 
27  int bh, bs, bv, ba;
28  b.getHsv(&bh, &bs, &bv, &ba);
29 
30  int rh, rs, rv, ra;
31  rh = linear(ah, bh, t);
32  rs = linear(as, bs, t);
33  rv = linear(av, bv, t);
34  ra = linear(aa, ba, t);
35 
36  return QColor::fromHsv(rh, rs, rv, ra);
37 }
qreal linear(qreal a, qreal b, qreal t)
qreal linear ( qreal  a,
qreal  b,
qreal  t 
)

Definition at line 12 of file CQEffectDescription.cpp.

Referenced by CQEffectDescription::applyToScene(), CGA::creation(), getGradient(), interpolate(), COptMethodEP2::optimise(), and COptMethodHGASA::optimise().

13 {
14  return a * (1 - t) + b * t;
15 }